From 908613c0e63f47e8bb8721097d93a6efb41490e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?= <1175054+carlossanlop@users.noreply.github.com> Date: Thu, 15 Aug 2024 12:15:35 -0700 Subject: [PATCH 001/748] Bump the release/9.0 branch to RC2 (#106429) --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 825852f98342ac..c3885223cc5946 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -11,7 +11,7 @@ 7.0.20 6.0.$([MSBuild]::Add($([System.Version]::Parse('$(PackageVersionNet8)').Build),25)) rc - 1 + 2 false release From f91cf24e9d239b2604d863d321c2492652203c36 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 12:26:38 -0700 Subject: [PATCH 002/748] Change OneLocBuild mirror branch to release/9.0 temporarily (#106434) Co-authored-by: carlossanlop <1175054+carlossanlop@users.noreply.github.com> --- eng/pipelines/runtime-official.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/eng/pipelines/runtime-official.yml b/eng/pipelines/runtime-official.yml index a899d2d1991e33..55021be6e29ed4 100644 --- a/eng/pipelines/runtime-official.yml +++ b/eng/pipelines/runtime-official.yml @@ -41,12 +41,13 @@ extends: # Localization build # - - template: /eng/common/templates-official/job/onelocbuild.yml - parameters: - MirrorRepo: runtime - MirrorBranch: main - LclSource: lclFilesfromPackage - LclPackageId: 'LCL-JUNO-PROD-RUNTIME' + - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/9.0') }}: + - template: /eng/common/templates-official/job/onelocbuild.yml + parameters: + MirrorRepo: runtime + MirrorBranch: release/9.0 + LclSource: lclFilesfromPackage + LclPackageId: 'LCL-JUNO-PROD-RUNTIME' # # Source Index Build From 5694fe08646c64f2cf2435108981b32d0d3f4056 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 15:45:08 -0700 Subject: [PATCH 003/748] =?UTF-8?q?Revert=20"Use=20`Unsafe.BitCast`=20for?= =?UTF-8?q?=20`Int128`=20=E2=86=94`UInt128`=20operators=20(#104506)"=20(#1?= =?UTF-8?q?06431)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 01dbf511d03f17bff6ac3effc4c5aabaa597cf74. Co-authored-by: Stephen Toub --- src/libraries/System.Private.CoreLib/src/System/Int128.cs | 4 ++-- src/libraries/System.Private.CoreLib/src/System/UInt128.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Int128.cs b/src/libraries/System.Private.CoreLib/src/System/Int128.cs index 7a69db71674f47..241c1c39e71d55 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Int128.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Int128.cs @@ -425,7 +425,7 @@ public static explicit operator checked ulong(Int128 value) /// The value to convert. /// converted to a . [CLSCompliant(false)] - public static explicit operator UInt128(Int128 value) => Unsafe.BitCast(value); + public static explicit operator UInt128(Int128 value) => new UInt128(value._upper, value._lower); /// Explicitly converts a 128-bit signed integer to a value, throwing an overflow exception for any values that fall outside the representable range. /// The value to convert. @@ -438,7 +438,7 @@ public static explicit operator checked UInt128(Int128 value) { ThrowHelper.ThrowOverflowException(); } - return Unsafe.BitCast(value); + return new UInt128(value._upper, value._lower); } /// Explicitly converts a 128-bit signed integer to a value. diff --git a/src/libraries/System.Private.CoreLib/src/System/UInt128.cs b/src/libraries/System.Private.CoreLib/src/System/UInt128.cs index 7318f77480d0de..a37ec00c1b2809 100644 --- a/src/libraries/System.Private.CoreLib/src/System/UInt128.cs +++ b/src/libraries/System.Private.CoreLib/src/System/UInt128.cs @@ -344,7 +344,7 @@ public static explicit operator checked long(UInt128 value) /// The value to convert. /// converted to a . [CLSCompliant(false)] - public static explicit operator Int128(UInt128 value) => Unsafe.BitCast(value); + public static explicit operator Int128(UInt128 value) => new Int128(value._upper, value._lower); /// Explicitly converts a 128-bit unsigned integer to a value, throwing an overflow exception for any values that fall outside the representable range. /// The value to convert. @@ -357,7 +357,7 @@ public static explicit operator checked Int128(UInt128 value) { ThrowHelper.ThrowOverflowException(); } - return Unsafe.BitCast(value); + return new Int128(value._upper, value._lower); } /// Explicitly converts a 128-bit unsigned integer to a value. From 83bac9500ebe3e48357a3989f6764bac276716e1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 15:45:36 -0700 Subject: [PATCH 004/748] Update dependencies from https://github.com/dotnet/emsdk build 20240815.2 (#106481) Microsoft.SourceBuild.Intermediate.emsdk , Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport From Version 9.0.0-rc.1.24402.2 -> To Version 9.0.0-rc.1.24415.2 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 404afcb93bc191..64f4eae05adbe1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -64,14 +64,14 @@ ed276e79e30bffc3e6405afa8a9323ec7e67c700 - + https://github.com/dotnet/emsdk - edf3e90fa25b1fc4f7f63ceb45ef70f49c6b121a + 39cd6c01fd85bcf4a51b834fb430d05aaa57f955 - + https://github.com/dotnet/emsdk - edf3e90fa25b1fc4f7f63ceb45ef70f49c6b121a + 39cd6c01fd85bcf4a51b834fb430d05aaa57f955 diff --git a/eng/Versions.props b/eng/Versions.props index 825852f98342ac..bc476f4c8148b8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -239,7 +239,7 @@ Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-9_0_100_Transport --> - 9.0.0-rc.1.24402.2 + 9.0.0-rc.1.24415.2 $(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion) 1.1.87-gba258badda From 0784f3e4e5ce40da2df38406806d00cd47a11178 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 16:54:19 -0700 Subject: [PATCH 005/748] Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20240815.1 (#106499) Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers From Version 3.11.0-beta1.24405.1 -> To Version 3.11.0-beta1.24415.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 64f4eae05adbe1..369c6f9aed7c9b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -368,13 +368,13 @@ https://github.com/dotnet/roslyn bba7ceac50f68468ec9733a6a66f2314227101d4 - + https://github.com/dotnet/roslyn-analyzers - 3211f48253bc18560156d90dc5e710d35f7d03fa + fdb9965ce68c1f4e1c0ff301488adf9caa958615 - + https://github.com/dotnet/roslyn-analyzers - 3211f48253bc18560156d90dc5e710d35f7d03fa + fdb9965ce68c1f4e1c0ff301488adf9caa958615 diff --git a/eng/Versions.props b/eng/Versions.props index bc476f4c8148b8..393b03da78babe 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -34,8 +34,8 @@ - 3.11.0-beta1.24405.1 - 9.0.0-preview.24405.1 + 3.11.0-beta1.24415.1 + 9.0.0-preview.24415.1 diff --git a/eng/Versions.props b/eng/Versions.props index c3885223cc5946..daffdb49e922aa 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -34,8 +34,8 @@ - 3.11.0-beta1.24405.1 - 9.0.0-preview.24405.1 + 3.11.0-beta1.24415.1 + 9.0.0-preview.24415.1 - Date: Fri, 16 Aug 2024 11:02:21 -0700 Subject: [PATCH 009/748] Remove assert (#106542) Co-authored-by: Aman Khalid (from Dev Box) --- src/coreclr/jit/optimizebools.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/coreclr/jit/optimizebools.cpp b/src/coreclr/jit/optimizebools.cpp index 0362fdc2c91f8b..2346ef7e9e278f 100644 --- a/src/coreclr/jit/optimizebools.cpp +++ b/src/coreclr/jit/optimizebools.cpp @@ -1327,7 +1327,6 @@ void OptBoolsDsc::optOptimizeBoolsUpdateTrees() assert(m_b2->KindIs(BBJ_COND)); assert(m_b1->TrueTargetIs(m_b2->GetTrueTarget())); assert(m_b1->FalseTargetIs(m_b2)); - assert(!m_b2->IsLast()); // We now reach B2's false target via B1 false. // From 30f18f6205608cf4f367ef32bac4b8c954c0cc88 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:07:23 -0700 Subject: [PATCH 010/748] Update dependencies from https://github.com/dotnet/emsdk build 20240815.4 (#106533) Microsoft.SourceBuild.Intermediate.emsdk , Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport From Version 9.0.0-rc.1.24402.2 -> To Version 10.0.0-alpha.1.24415.4 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bbe99d493b6c0b..b3b4bed5b9f4ad 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -64,14 +64,14 @@ ed276e79e30bffc3e6405afa8a9323ec7e67c700 - + https://github.com/dotnet/emsdk - edf3e90fa25b1fc4f7f63ceb45ef70f49c6b121a + 6c91507683fd47c500956743cc93750aba4da54d - + https://github.com/dotnet/emsdk - edf3e90fa25b1fc4f7f63ceb45ef70f49c6b121a + 6c91507683fd47c500956743cc93750aba4da54d diff --git a/eng/Versions.props b/eng/Versions.props index daffdb49e922aa..57124b541d8474 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -239,7 +239,7 @@ Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-9_0_100_Transport --> - 9.0.0-rc.1.24402.2 + 10.0.0-alpha.1.24415.4 $(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion) 1.1.87-gba258badda From 61b7231dd61da3f4870dee24311e56a45c4e0554 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:08:08 -0700 Subject: [PATCH 011/748] [release/9.0] Update dependencies from dotnet/icu, dotnet/source-build-externals (#106532) * Update dependencies from https://github.com/dotnet/source-build-externals build 20240815.1 Microsoft.SourceBuild.Intermediate.source-build-externals From Version 9.0.0-alpha.1.24412.1 -> To Version 10.0.0-alpha.1.24415.1 * Update dependencies from https://github.com/dotnet/icu build 20240814.3 Microsoft.NETCore.Runtime.ICU.Transport From Version 9.0.0-rc.1.24373.1 -> To Version 10.0.0-alpha.1.24414.3 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b3b4bed5b9f4ad..ca5424509ef8c2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,8 +1,8 @@ - + https://github.com/dotnet/icu - 99e6c98ad1faf55e6335ab768dab5917b456a87f + 5e8042fc4234e09540448c06a3da434492dfc91c https://github.com/dotnet/msquic @@ -81,9 +81,9 @@ - + https://github.com/dotnet/source-build-externals - ee22054b44ec9615dc3481c4decc1b007a83a2b0 + 2cef086137a68586fdd69848261e2a8cf8c48b73 diff --git a/eng/Versions.props b/eng/Versions.props index 57124b541d8474..a36cb4e69c75a9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -216,7 +216,7 @@ 9.0.0-rc.1.24410.5 - 9.0.0-rc.1.24373.1 + 10.0.0-alpha.1.24414.3 2.4.3 9.0.0-alpha.1.24167.3 From e64da6057074ce15e00991b5cdc294ce2147967e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 11:50:20 -0700 Subject: [PATCH 012/748] [release/9.0] Fix Enum field type bug found when underlying type is set from assembly loaded with MLC (#106513) * Fix EnumBuilder.UnderlyingSystemType property * Remove validation that failing when setting constants with core assembly type --------- Co-authored-by: Buyaa Namnan --- .../src/Resources/Strings.resx | 3 + .../System/Reflection/Emit/EnumBuilderImpl.cs | 2 +- .../Reflection/Emit/FieldBuilderImpl.cs | 68 ------------------- .../System/Reflection/Emit/ILGeneratorImpl.cs | 14 ++-- .../Reflection/Emit/ParameterBuilderImpl.cs | 2 - .../Reflection/Emit/PropertyBuilderImpl.cs | 1 - .../System/Reflection/Emit/TypeBuilderImpl.cs | 26 ++++--- .../AssemblySaveEnumBuilderTests.cs | 6 +- .../AssemblySavePropertyBuilderTests.cs | 32 +++++---- 9 files changed, 44 insertions(+), 110 deletions(-) diff --git a/src/libraries/System.Reflection.Emit/src/Resources/Strings.resx b/src/libraries/System.Reflection.Emit/src/Resources/Strings.resx index 6103dbef1f159d..8ec0577d1f8ea8 100644 --- a/src/libraries/System.Reflection.Emit/src/Resources/Strings.resx +++ b/src/libraries/System.Reflection.Emit/src/Resources/Strings.resx @@ -303,4 +303,7 @@ Unmatching symbol scope. + + Type provided must be an Enum. + \ No newline at end of file diff --git a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/EnumBuilderImpl.cs b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/EnumBuilderImpl.cs index 1d8854bb43d9ad..5ca6e6c957749a 100644 --- a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/EnumBuilderImpl.cs +++ b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/EnumBuilderImpl.cs @@ -71,7 +71,7 @@ protected override void SetCustomAttributeCore(ConstructorInfo con, ReadOnlySpan public override Type? ReflectedType => _typeBuilder.ReflectedType; - public override Type UnderlyingSystemType => GetEnumUnderlyingType(); + public override Type UnderlyingSystemType => this; public override Type GetEnumUnderlyingType() => _underlyingField.FieldType; diff --git a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/FieldBuilderImpl.cs b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/FieldBuilderImpl.cs index f9f85f90b2aa57..8d0561d15be47b 100644 --- a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/FieldBuilderImpl.cs +++ b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/FieldBuilderImpl.cs @@ -40,78 +40,10 @@ internal FieldBuilderImpl(TypeBuilderImpl typeBuilder, string fieldName, Type ty protected override void SetConstantCore(object? defaultValue) { _typeBuilder.ThrowIfCreated(); - ValidateDefaultValueType(defaultValue, _fieldType); _defaultValue = defaultValue; _attributes |= FieldAttributes.HasDefault; } - internal static void ValidateDefaultValueType(object? defaultValue, Type destinationType) - { - if (defaultValue == null) - { - // nullable value types can hold null value. - if (destinationType.IsValueType && !(destinationType.IsGenericType && destinationType.GetGenericTypeDefinition() == typeof(Nullable<>))) - { - throw new ArgumentException(SR.Argument_ConstantNull); - } - } - else - { - Type sourceType = defaultValue.GetType(); - // We should allow setting a constant value on a ByRef parameter - if (destinationType.IsByRef) - { - destinationType = destinationType.GetElementType()!; - } - - // Convert nullable types to their underlying type. - destinationType = Nullable.GetUnderlyingType(destinationType) ?? destinationType; - - if (destinationType.IsEnum) - { - Type underlyingType; - if (destinationType is EnumBuilderImpl enumBldr) - { - underlyingType = enumBldr.GetEnumUnderlyingType(); - - if (sourceType != enumBldr._typeBuilder.UnderlyingSystemType && - sourceType != underlyingType && - // If the source type is an enum, should not throw when the underlying types match - sourceType.IsEnum && - sourceType.GetEnumUnderlyingType() != underlyingType) - { - throw new ArgumentException(SR.Argument_ConstantDoesntMatch); - } - } - else if (destinationType is TypeBuilderImpl typeBldr) - { - underlyingType = typeBldr.UnderlyingSystemType; - - if (underlyingType == null || (sourceType != typeBldr.UnderlyingSystemType && sourceType != underlyingType)) - { - throw new ArgumentException(SR.Argument_ConstantDoesntMatch); - } - } - else - { - underlyingType = Enum.GetUnderlyingType(destinationType); - - if (sourceType != destinationType && sourceType != underlyingType) - { - throw new ArgumentException(SR.Argument_ConstantDoesntMatch); - } - } - } - else - { - if (!destinationType.IsAssignableFrom(sourceType)) - { - throw new ArgumentException(SR.Argument_ConstantDoesntMatch); - } - } - } - } - internal void SetData(byte[] data) { _rvaData = data; diff --git a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ILGeneratorImpl.cs b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ILGeneratorImpl.cs index d4b40387e30e20..ef186a685a397c 100644 --- a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ILGeneratorImpl.cs +++ b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ILGeneratorImpl.cs @@ -601,7 +601,7 @@ public override void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[]? opti } EmitOpcode(opcode); - UpdateStackSize(GetStackChange(opcode, methodInfo, optionalParameterTypes)); + UpdateStackSize(GetStackChange(opcode, methodInfo, _moduleBuilder.GetTypeFromCoreAssembly(CoreTypeId.Void), optionalParameterTypes)); if (optionalParameterTypes == null || optionalParameterTypes.Length == 0) { WriteOrReserveToken(_moduleBuilder.TryGetMethodHandle(methodInfo), methodInfo); @@ -613,12 +613,12 @@ public override void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[]? opti } } - private static int GetStackChange(OpCode opcode, MethodInfo methodInfo, Type[]? optionalParameterTypes) + private static int GetStackChange(OpCode opcode, MethodInfo methodInfo, Type voidType, Type[]? optionalParameterTypes) { int stackChange = 0; // Push the return value if there is one. - if (methodInfo.ReturnType != typeof(void)) + if (methodInfo.ReturnType != voidType) { stackChange++; } @@ -665,7 +665,7 @@ public override void EmitCalli(OpCode opcode, CallingConventions callingConventi } } - int stackChange = GetStackChange(returnType, parameterTypes); + int stackChange = GetStackChange(returnType, _moduleBuilder.GetTypeFromCoreAssembly(CoreTypeId.Void), parameterTypes); // Pop off VarArg arguments. if (optionalParameterTypes != null) @@ -685,17 +685,17 @@ public override void EmitCalli(OpCode opcode, CallingConventions callingConventi public override void EmitCalli(OpCode opcode, CallingConvention unmanagedCallConv, Type? returnType, Type[]? parameterTypes) { - int stackChange = GetStackChange(returnType, parameterTypes); + int stackChange = GetStackChange(returnType, _moduleBuilder.GetTypeFromCoreAssembly(CoreTypeId.Void), parameterTypes); UpdateStackSize(stackChange); Emit(OpCodes.Calli); _il.Token(_moduleBuilder.GetSignatureToken(unmanagedCallConv, returnType, parameterTypes)); } - private static int GetStackChange(Type? returnType, Type[]? parameterTypes) + private static int GetStackChange(Type? returnType, Type voidType, Type[]? parameterTypes) { int stackChange = 0; // If there is a non-void return type, push one. - if (returnType != typeof(void)) + if (returnType != voidType) { stackChange++; } diff --git a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ParameterBuilderImpl.cs b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ParameterBuilderImpl.cs index 93040c155f2074..f1b6446be8e0f8 100644 --- a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ParameterBuilderImpl.cs +++ b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ParameterBuilderImpl.cs @@ -32,8 +32,6 @@ public ParameterBuilderImpl(MethodBuilderImpl methodBuilder, int sequence, Param public override void SetConstant(object? defaultValue) { - Type parameterType = _position == 0 ? _methodBuilder.ReturnType : _methodBuilder.ParameterTypes![_position - 1]; - FieldBuilderImpl.ValidateDefaultValueType(defaultValue, parameterType); _defaultValue = defaultValue; _attributes |= ParameterAttributes.HasDefault; } diff --git a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/PropertyBuilderImpl.cs b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/PropertyBuilderImpl.cs index 68cc5a813451d3..faf1538a1a8e84 100644 --- a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/PropertyBuilderImpl.cs +++ b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/PropertyBuilderImpl.cs @@ -57,7 +57,6 @@ protected override void AddOtherMethodCore(MethodBuilder mdBuilder) protected override void SetConstantCore(object? defaultValue) { _containingType.ThrowIfCreated(); - FieldBuilderImpl.ValidateDefaultValueType(defaultValue, _propertyType); _defaultValue = defaultValue; } diff --git a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/TypeBuilderImpl.cs b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/TypeBuilderImpl.cs index c4480d7cee5538..4a48349359e71e 100644 --- a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/TypeBuilderImpl.cs +++ b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/TypeBuilderImpl.cs @@ -305,7 +305,6 @@ protected override MethodBuilder DefineMethodCore(string name, MethodAttributes { ThrowIfCreated(); - MethodBuilderImpl methodBuilder = new(name, attributes, callingConvention, returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, _module, this); _methodDefinitions.Add(methodBuilder); @@ -616,23 +615,22 @@ public override Type GetGenericTypeDefinition() public override string? Namespace => _namespace; public override Assembly Assembly => _module.Assembly; public override Module Module => _module; - public override Type UnderlyingSystemType + public override Type UnderlyingSystemType => this; + + public override Type GetEnumUnderlyingType() { - get + if (IsEnum) { - if (IsEnum) - { - if (_enumUnderlyingType == null) - { - throw new InvalidOperationException(SR.InvalidOperation_NoUnderlyingTypeOnEnum); - } - - return _enumUnderlyingType; - } - else + if (_enumUnderlyingType == null) { - return this; + throw new InvalidOperationException(SR.InvalidOperation_NoUnderlyingTypeOnEnum); } + + return _enumUnderlyingType; + } + else + { + throw new ArgumentException(SR.Argument_MustBeEnum); } } public override bool IsSZArray => false; diff --git a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveEnumBuilderTests.cs b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveEnumBuilderTests.cs index 3c569b815da639..b10126675568e3 100644 --- a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveEnumBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveEnumBuilderTests.cs @@ -37,7 +37,7 @@ public static IEnumerable DefineLiteral_TestData() yield return new object[] { typeof(uint), (uint)1 }; yield return new object[] { typeof(int), 0 }; - yield return new object[] { typeof(int), 1 }; + yield return new object[] { typeof(int), Test.Second }; yield return new object[] { typeof(ulong), (ulong)0 }; yield return new object[] { typeof(ulong), (ulong)1 }; @@ -100,7 +100,7 @@ public void CreateEnumWithMlc() PersistedAssemblyBuilder ab = new PersistedAssemblyBuilder(PopulateAssemblyName(), mlc.CoreAssembly); ModuleBuilder mb = ab.DefineDynamicModule("My Module"); Type intType = mlc.CoreAssembly.GetType("System.Int32"); - EnumBuilder enumBuilder = mb.DefineEnum("TestEnum", TypeAttributes.Public, typeof(int)); + EnumBuilder enumBuilder = mb.DefineEnum("TestEnum", TypeAttributes.Public, intType); FieldBuilder field = enumBuilder.DefineLiteral("Default", 0); enumBuilder.CreateTypeInfo(); @@ -118,7 +118,7 @@ public void CreateEnumWithMlc() FieldInfo testField = createdEnum.GetField("Default"); Assert.Equal(createdEnum, testField.FieldType); - Assert.Equal(typeof(int), enumBuilder.GetEnumUnderlyingType()); + Assert.Equal(intType, enumBuilder.GetEnumUnderlyingType()); Assert.Equal(FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal | FieldAttributes.HasDefault, testField.Attributes); } } diff --git a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySavePropertyBuilderTests.cs b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySavePropertyBuilderTests.cs index 06caf8dbb6a7de..a8cd0754c853fb 100644 --- a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySavePropertyBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySavePropertyBuilderTests.cs @@ -163,6 +163,24 @@ public void SetConstantVariousValues(Type returnType, object defaultValue) Assert.Equal(defaultValue, property.GetConstantValue()); } + [Theory] + [MemberData(nameof(SetConstant_TestData))] + public void SetConstantVariousValuesMlcCoreAssembly(Type returnType, object defaultValue) + { + using (MetadataLoadContext mlc = new MetadataLoadContext(new CoreMetadataAssemblyResolver())) + { + PersistedAssemblyBuilder ab = new PersistedAssemblyBuilder(new AssemblyName("MyDynamicAssembly"), mlc.CoreAssembly); + ModuleBuilder mb = ab.DefineDynamicModule("My Module"); + Type returnTypeFromCore = returnType != typeof(PropertyBuilderTest11.Colors) ? mlc.CoreAssembly.GetType(returnType.FullName, true) : returnType; + TypeBuilder type = mb.DefineType("MyType", TypeAttributes.Public); + + PropertyBuilder property = type.DefineProperty("TestProperty", PropertyAttributes.HasDefault, returnTypeFromCore, null); + property.SetConstant(defaultValue); + + Assert.Equal(defaultValue, property.GetConstantValue()); + } + } + [Fact] public void SetCustomAttribute_ConstructorInfo_ByteArray_NullConstructorInfo_ThrowsArgumentNullException() { @@ -194,7 +212,6 @@ public void Set_WhenTypeAlreadyCreated_ThrowsInvalidOperationException() MethodAttributes getMethodAttributes = MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.HideBySig; MethodBuilder method = type.DefineMethod("TestMethod", getMethodAttributes, typeof(int), null); method.GetILGenerator().Emit(OpCodes.Ret); - AssertExtensions.Throws(() => property.SetConstant((decimal)10)); CustomAttributeBuilder customAttrBuilder = new CustomAttributeBuilder(typeof(IntPropertyAttribute).GetConstructor([typeof(int)]), [10]); type.CreateType(); @@ -204,18 +221,5 @@ public void Set_WhenTypeAlreadyCreated_ThrowsInvalidOperationException() Assert.Throws(() => property.SetConstant(1)); Assert.Throws(() => property.SetCustomAttribute(customAttrBuilder)); } - - [Fact] - public void SetConstant_ValidationThrows() - { - AssemblySaveTools.PopulateAssemblyBuilderAndTypeBuilder(out TypeBuilder type); - FieldBuilder field = type.DefineField("TestField", typeof(int), FieldAttributes.Private); - PropertyBuilder property = type.DefineProperty("TestProperty", PropertyAttributes.HasDefault, typeof(int), null); - - AssertExtensions.Throws(() => property.SetConstant((decimal)10)); - AssertExtensions.Throws(() => property.SetConstant(null)); - type.CreateType(); - Assert.Throws(() => property.SetConstant(1)); - } } } From 6d543fa114a4df03504717d57633e7cc75d7caca Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 12:25:55 -0700 Subject: [PATCH 013/748] Remove CONTEXT_XSTATE in FaultingExceptionFrame::UpdateRegDisplay (#106550) Fixing the problem introduced by the previous attempt to fix that. The problem was that the CONTEXT_XSTATE contains not only the bit for the xstate, but also the architecture "id" (CONTEXT_AMD64, CONTEXT_ARM64, ...). I've verified this fix using the debugger tests that the previous change was breaking. There is a bug in updating REGDISPLAY from a faulting exception frame. The context stored in the frame can contain extended state, but we only copy the basic CONTEXT part. But we are not removing the CONTEXT_XSTATE flag. There was an issue found on arm64 Windows with SVE enabled. The context from a hardware exception contains the SVE extended state and when we resume after catch for the exception or start propagating it through native frames, the RtlRestoreContext uses some garbage to try to restore the extended state and ends up corrupting memory. The fix is to remove the CONTEXT_XSTATE flag from the context after we copy it to the REGDISPLAY. While we have hit this problem on Windows ARM64 with SVE only, I have made the same change for other targets that can have extended state too. Close #105483 Co-authored-by: Jan Vorlicek --- src/coreclr/inc/clrnt.h | 18 ++++++++++++++++++ src/coreclr/vm/amd64/cgenamd64.cpp | 4 ++++ src/coreclr/vm/arm64/stubs.cpp | 4 ++++ src/coreclr/vm/i386/cgenx86.cpp | 4 ++++ src/coreclr/vm/threadsuspend.cpp | 20 -------------------- 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/coreclr/inc/clrnt.h b/src/coreclr/inc/clrnt.h index e555f5ead2328f..2d935a95317e69 100644 --- a/src/coreclr/inc/clrnt.h +++ b/src/coreclr/inc/clrnt.h @@ -369,6 +369,24 @@ RtlVirtualUnwind( IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers OPTIONAL ); +// Mirror the XSTATE_ARM64_SVE flags from winnt.h + +#ifndef XSTATE_ARM64_SVE +#define XSTATE_ARM64_SVE (2) +#endif // XSTATE_ARM64_SVE + +#ifndef XSTATE_MASK_ARM64_SVE +#define XSTATE_MASK_ARM64_SVE (1ui64 << (XSTATE_ARM64_SVE)) +#endif // XSTATE_MASK_ARM64_SVE + +#ifndef CONTEXT_ARM64_XSTATE +#define CONTEXT_ARM64_XSTATE (CONTEXT_ARM64 | 0x20L) +#endif // CONTEXT_ARM64_XSTATE + +#ifndef CONTEXT_XSTATE +#define CONTEXT_XSTATE CONTEXT_ARM64_XSTATE +#endif // CONTEXT_XSTATE + #endif #ifdef TARGET_LOONGARCH64 diff --git a/src/coreclr/vm/amd64/cgenamd64.cpp b/src/coreclr/vm/amd64/cgenamd64.cpp index a7ec8d33f050b1..5f515d1c427d53 100644 --- a/src/coreclr/vm/amd64/cgenamd64.cpp +++ b/src/coreclr/vm/amd64/cgenamd64.cpp @@ -231,6 +231,10 @@ void FaultingExceptionFrame::UpdateRegDisplay(const PREGDISPLAY pRD, bool update memcpy(pRD->pCurrentContext, &m_ctx, sizeof(CONTEXT)); + // Clear the CONTEXT_XSTATE, since the REGDISPLAY contains just plain CONTEXT structure + // that cannot contain any extended state. + pRD->pCurrentContext->ContextFlags &= ~(CONTEXT_XSTATE & CONTEXT_AREA_MASK); + pRD->ControlPC = m_ctx.Rip; pRD->SP = m_ctx.Rsp; diff --git a/src/coreclr/vm/arm64/stubs.cpp b/src/coreclr/vm/arm64/stubs.cpp index 25a62472d1e6b4..7d1a91b97894b9 100644 --- a/src/coreclr/vm/arm64/stubs.cpp +++ b/src/coreclr/vm/arm64/stubs.cpp @@ -635,6 +635,10 @@ void FaultingExceptionFrame::UpdateRegDisplay(const PREGDISPLAY pRD, bool update // Copy the context to regdisplay memcpy(pRD->pCurrentContext, &m_ctx, sizeof(T_CONTEXT)); + // Clear the CONTEXT_XSTATE, since the REGDISPLAY contains just plain CONTEXT structure + // that cannot contain any extended state. + pRD->pCurrentContext->ContextFlags &= ~(CONTEXT_XSTATE & CONTEXT_AREA_MASK); + pRD->ControlPC = ::GetIP(&m_ctx); pRD->SP = ::GetSP(&m_ctx); diff --git a/src/coreclr/vm/i386/cgenx86.cpp b/src/coreclr/vm/i386/cgenx86.cpp index 1738fd04905046..878405e0db1af3 100644 --- a/src/coreclr/vm/i386/cgenx86.cpp +++ b/src/coreclr/vm/i386/cgenx86.cpp @@ -478,6 +478,10 @@ void FaultingExceptionFrame::UpdateRegDisplay(const PREGDISPLAY pRD, bool update memcpy(pRD->pCurrentContext, &m_ctx, sizeof(CONTEXT)); + // Clear the CONTEXT_XSTATE, since the REGDISPLAY contains just plain CONTEXT structure + // that cannot contain any extended state. + pRD->pCurrentContext->ContextFlags &= ~(CONTEXT_XSTATE & CONTEXT_AREA_MASK); + pRD->SP = m_ctx.Esp; pRD->ControlPC = m_ctx.Eip; diff --git a/src/coreclr/vm/threadsuspend.cpp b/src/coreclr/vm/threadsuspend.cpp index e9b9ab99b3737f..f8ecdcba72417a 100644 --- a/src/coreclr/vm/threadsuspend.cpp +++ b/src/coreclr/vm/threadsuspend.cpp @@ -28,26 +28,6 @@ ThreadSuspend::SUSPEND_REASON ThreadSuspend::m_suspendReason; void* ThreadSuspend::g_returnAddressHijackTarget = NULL; #endif // TARGET_WINDOWS -#if defined(TARGET_ARM64) -// Mirror the XSTATE_ARM64_SVE flags from winnt.h - -#ifndef XSTATE_ARM64_SVE -#define XSTATE_ARM64_SVE (2) -#endif // XSTATE_ARM64_SVE - -#ifndef XSTATE_MASK_ARM64_SVE -#define XSTATE_MASK_ARM64_SVE (1ui64 << (XSTATE_ARM64_SVE)) -#endif // XSTATE_MASK_ARM64_SVE - -#ifndef CONTEXT_ARM64_XSTATE -#define CONTEXT_ARM64_XSTATE (CONTEXT_ARM64 | 0x20L) -#endif // CONTEXT_ARM64_XSTATE - -#ifndef CONTEXT_XSTATE -#define CONTEXT_XSTATE CONTEXT_ARM64_XSTATE -#endif // CONTEXT_XSTATE -#endif // TARGET_ARM64 - // If you add any thread redirection function, make sure the debugger can 1) recognize the redirection // function, and 2) retrieve the original CONTEXT. See code:Debugger.InitializeHijackFunctionAddress and // code:DacDbiInterfaceImpl.RetrieveHijackedContext. From e4335dfcfce4d1118b65628798f30aadaf0aac60 Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Fri, 16 Aug 2024 14:26:20 -0500 Subject: [PATCH 014/748] Bump downlevel versions to 8.0.9 (#106547) --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 393b03da78babe..590d5e32390f4e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -7,7 +7,7 @@ 0 0 9.0.100 - 8.0.7 + 8.0.9 7.0.20 6.0.$([MSBuild]::Add($([System.Version]::Parse('$(PackageVersionNet8)').Build),25)) rc From 63c95650fd3e5f884c5cddf71860e98faafbdc34 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 16:04:55 -0700 Subject: [PATCH 015/748] [release/9.0-rc1] Fallback to treating as object if not collection (#106517) * Fallback to treating as object if not collection The reflection binder will fallback if a type does not meet collection heuristics, but the source generator did not. * Fix UnsupportedTypes test * Update collection to object fallback condition This matches what the refelction binder does, and fixes the baseline diffs (and diagnostics changes) we were seeing for unsupported collection types. * Refactor fallback from collection to object mode --------- Co-authored-by: Eric StJohn --- .../ConfigurationBindingGenerator.Parser.cs | 43 +++++++++++-------- .../ConfigurationBinderTests.TestClasses.cs | 21 +++++++++ .../tests/Common/ConfigurationBinderTests.cs | 22 ++++++++++ 3 files changed, 68 insertions(+), 18 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/ConfigurationBindingGenerator.Parser.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/ConfigurationBindingGenerator.Parser.cs index 81fb4985537210..0982628197ea65 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/ConfigurationBindingGenerator.Parser.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/ConfigurationBindingGenerator.Parser.cs @@ -197,7 +197,7 @@ private TypeSpec CreateTypeSpec(TypeParseInfo typeParseInfo) } else if (IsCollection(type)) { - spec = CreateCollectionSpec(typeParseInfo); + spec = CreateCollectionSpec(typeParseInfo) ?? CreateObjectSpec(typeParseInfo); } else if (SymbolEqualityComparer.Default.Equals(type, _typeSymbols.IConfigurationSection)) { @@ -360,34 +360,37 @@ private TypeSpec CreateArraySpec(TypeParseInfo typeParseInfo) }; } - private TypeSpec CreateCollectionSpec(TypeParseInfo typeParseInfo) + private TypeSpec? CreateCollectionSpec(TypeParseInfo typeParseInfo) { INamedTypeSymbol type = (INamedTypeSymbol)typeParseInfo.TypeSymbol; - TypeSpec spec; + TypeSpec? spec; if (IsCandidateDictionary(type, out ITypeSymbol? keyType, out ITypeSymbol? elementType)) { spec = CreateDictionarySpec(typeParseInfo, keyType, elementType); - Debug.Assert(spec is DictionarySpec or UnsupportedTypeSpec); + Debug.Assert(spec is DictionarySpec or UnsupportedTypeSpec or null); } else { spec = CreateEnumerableSpec(typeParseInfo); - Debug.Assert(spec is EnumerableSpec or UnsupportedTypeSpec); + Debug.Assert(spec is EnumerableSpec or UnsupportedTypeSpec or null); } return spec; } - private TypeSpec CreateDictionarySpec(TypeParseInfo typeParseInfo, ITypeSymbol keyTypeSymbol, ITypeSymbol elementTypeSymbol) + private TypeSpec? CreateDictionarySpec(TypeParseInfo typeParseInfo, ITypeSymbol keyTypeSymbol, ITypeSymbol elementTypeSymbol) { + INamedTypeSymbol type = (INamedTypeSymbol)typeParseInfo.TypeSymbol; + + // treat as unsupported if it implements IDictionary<,>, otherwise we'll try to fallback and treat as an object + bool isDictionary = _typeSymbols.GenericICollection is not null && GetInterface(type, _typeSymbols.GenericIDictionary_Unbound) is not null; + if (IsUnsupportedType(keyTypeSymbol) || IsUnsupportedType(elementTypeSymbol)) { - return CreateUnsupportedCollectionSpec(typeParseInfo); + return isDictionary ? CreateUnsupportedCollectionSpec(typeParseInfo) : null; } - INamedTypeSymbol type = (INamedTypeSymbol)typeParseInfo.TypeSymbol; - CollectionInstantiationStrategy instantiationStrategy; CollectionInstantiationConcreteType instantiationConcreteType; CollectionPopulationCastType populationCastType; @@ -402,14 +405,15 @@ private TypeSpec CreateDictionarySpec(TypeParseInfo typeParseInfo, ITypeSymbol k { populationCastType = CollectionPopulationCastType.NotApplicable; } - else if (_typeSymbols.GenericIDictionary is not null && GetInterface(type, _typeSymbols.GenericIDictionary_Unbound) is not null) + else if (isDictionary) { // implements IDictionary<,> -- cast to it. populationCastType = CollectionPopulationCastType.IDictionary; } else { - return CreateUnsupportedCollectionSpec(typeParseInfo); + // not a dictionary + return null; } } else if (_typeSymbols.Dictionary is not null && @@ -429,7 +433,7 @@ private TypeSpec CreateDictionarySpec(TypeParseInfo typeParseInfo, ITypeSymbol k } else { - return CreateUnsupportedCollectionSpec(typeParseInfo); + return isDictionary ? CreateUnsupportedCollectionSpec(typeParseInfo) : null; } TypeRef keyTypeRef = EnqueueTransitiveType(typeParseInfo, keyTypeSymbol, DiagnosticDescriptors.DictionaryKeyNotSupported); @@ -447,18 +451,20 @@ private TypeSpec CreateDictionarySpec(TypeParseInfo typeParseInfo, ITypeSymbol k }; } - private TypeSpec CreateEnumerableSpec(TypeParseInfo typeParseInfo) + private TypeSpec? CreateEnumerableSpec(TypeParseInfo typeParseInfo) { INamedTypeSymbol type = (INamedTypeSymbol)typeParseInfo.TypeSymbol; + bool isCollection = _typeSymbols.GenericICollection is not null && GetInterface(type, _typeSymbols.GenericICollection_Unbound) is not null; + if (!TryGetElementType(type, out ITypeSymbol? elementType)) { - return CreateUnsupportedCollectionSpec(typeParseInfo); + return isCollection ? CreateUnsupportedCollectionSpec(typeParseInfo) : null; } if (IsUnsupportedType(elementType)) { - return CreateUnsupportedCollectionSpec(typeParseInfo); + return isCollection ? CreateUnsupportedCollectionSpec(typeParseInfo) : null; } CollectionInstantiationStrategy instantiationStrategy; @@ -475,14 +481,15 @@ private TypeSpec CreateEnumerableSpec(TypeParseInfo typeParseInfo) { populationCastType = CollectionPopulationCastType.NotApplicable; } - else if (_typeSymbols.GenericICollection is not null && GetInterface(type, _typeSymbols.GenericICollection_Unbound) is not null) + else if (isCollection) { // implements ICollection<> -- cast to it populationCastType = CollectionPopulationCastType.ICollection; } else { - return CreateUnsupportedCollectionSpec(typeParseInfo); + // not a collection + return null; } } else if ((IsInterfaceMatch(type, _typeSymbols.GenericICollection_Unbound) || IsInterfaceMatch(type, _typeSymbols.GenericIList_Unbound))) @@ -523,7 +530,7 @@ private TypeSpec CreateEnumerableSpec(TypeParseInfo typeParseInfo) } else { - return CreateUnsupportedCollectionSpec(typeParseInfo); + return isCollection ? CreateUnsupportedCollectionSpec(typeParseInfo) : null; } TypeRef elementTypeRef = EnqueueTransitiveType(typeParseInfo, elementType, DiagnosticDescriptors.ElementTypeNotSupported); diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.TestClasses.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.TestClasses.cs index 0e6e09e637c0e0..28209c1c5deb7b 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.TestClasses.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.TestClasses.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; @@ -1067,5 +1068,25 @@ public class DerivedClassWithHiddenMembers : IntermediateDerivedClass public override int X { set => base.X = value + 1; } } + public class EnumerableNotCollection : IEnumerable> + { + public string Names { get; set; } + + public string[] Keywords { get; set; } + + public bool Enabled { get; set; } + + private IEnumerable> enumerate() + { + yield return new KeyValuePair(nameof(Names), Names); + yield return new KeyValuePair(nameof(Keywords), string.Join(",", Keywords)); + yield return new KeyValuePair(nameof(Enabled), Enabled.ToString()); + } + + public IEnumerator> GetEnumerator() => enumerate().GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() => enumerate().GetEnumerator(); + } + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs index 406738478d1c55..6ce085d5ec9cde 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs @@ -2602,5 +2602,27 @@ public void CanBindToClassWithNewProperties() Assert.Equal(53, obj.X); Assert.Equal(53, obj.XBase); } + + [Fact] + public void CanGetEnumerableNotCollection() + { + var builder = new ConfigurationBuilder(); + builder.AddInMemoryCollection(new KeyValuePair[] + { + new("Names", "John,Jane,Stephen"), + new("Enabled", "true"), + new("Keywords:1", "new"), + new("Keywords:2", "class"), + new("Keywords:3", "rosebud") + }); + + var config = builder.Build(); + + var result = config.Get(); + + Assert.Equal("John,Jane,Stephen", result.Names); + Assert.True(result.Enabled); + Assert.Equal(new [] { "new", "class", "rosebud"}, result.Keywords); + } } } From 01607d3819c40b5123c89c7c3a6a2c9ab4796f91 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 18 Aug 2024 14:45:18 -0500 Subject: [PATCH 016/748] Workaround for #106521 (#106589) Co-authored-by: Jan Kotas --- src/native/external/zlib-ng/functable.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/native/external/zlib-ng/functable.c b/src/native/external/zlib-ng/functable.c index 37c4aeef7d0e87..7ca05c98016730 100644 --- a/src/native/external/zlib-ng/functable.c +++ b/src/native/external/zlib-ng/functable.c @@ -3,6 +3,10 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ +#if defined(_MSC_VER) +# include +#endif + #include "zbuild.h" #include "zendian.h" #include "crc32_braid_p.h" @@ -11,10 +15,6 @@ #include "functable.h" #include "cpu_features.h" -#if defined(_MSC_VER) -# include -#endif - /* Platform has pointer size atomic store */ #if defined(__GNUC__) || defined(__clang__) # define FUNCTABLE_ASSIGN(VAR, FUNC_NAME) \ From 904fd57eef9abee30829c565f597bb3cbf377a1f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:34:16 -0700 Subject: [PATCH 017/748] Update dependencies from https://github.com/dotnet/emsdk build 20240816.2 (#106567) Microsoft.SourceBuild.Intermediate.emsdk , Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport From Version 9.0.0-rc.1.24415.2 -> To Version 9.0.0-rc.1.24416.2 Co-authored-by: dotnet-maestro[bot] Co-authored-by: Larry Ewing --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 369c6f9aed7c9b..dbf16b28fa69f8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -64,14 +64,14 @@ ed276e79e30bffc3e6405afa8a9323ec7e67c700 - + https://github.com/dotnet/emsdk - 39cd6c01fd85bcf4a51b834fb430d05aaa57f955 + 459c92904b224d125a350a3f3e431fe90152a95e - + https://github.com/dotnet/emsdk - 39cd6c01fd85bcf4a51b834fb430d05aaa57f955 + 459c92904b224d125a350a3f3e431fe90152a95e diff --git a/eng/Versions.props b/eng/Versions.props index 590d5e32390f4e..a018ef2195731e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -239,7 +239,7 @@ Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-9_0_100_Transport --> - 9.0.0-rc.1.24415.2 + 9.0.0-rc.1.24416.2 $(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion) 1.1.87-gba258badda From a73a65b1e9c8b05846ff4105c720806ae82cb3f8 Mon Sep 17 00:00:00 2001 From: Farhad Alizada <104755925+f-alizada@users.noreply.github.com> Date: Mon, 19 Aug 2024 19:37:01 +0200 Subject: [PATCH 018/748] [release/9.0-rc1] Add workflow file for interbranch merging (#106614) Co-authored-by: Farhad Alizada --- .github/workflows/inter-branch-merge-flow.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/inter-branch-merge-flow.yml 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 From 2a9d9bc6274412cec94d561c999d060df0e53457 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:37:47 -0700 Subject: [PATCH 019/748] [release/9.0-rc1] Fix condition for adding package readmes (#106592) * Fix condition for adding package readmes Fixes https://github.com/dotnet/runtime/issues/106585 The EnableDefualtPackageReadmeFile property needs to be defined before packaging.targets is imported. * Update workloads.csproj --------- Co-authored-by: Viktor Hofer --- eng/packaging.targets | 1 + .../pkg/sfx/Microsoft.NETCore.App/Directory.Build.props | 1 - src/libraries/Directory.Build.targets | 3 --- .../Microsoft.NET.Runtime.WebAssembly.Templates.csproj | 2 ++ .../Microsoft.Diagnostics.NETCore.Client.csproj | 2 ++ src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj | 2 ++ src/workloads/workloads.csproj | 5 +++-- 7 files changed, 10 insertions(+), 6 deletions(-) diff --git a/eng/packaging.targets b/eng/packaging.targets index 6ad92552c25611..bc52dce0d14e53 100644 --- a/eng/packaging.targets +++ b/eng/packaging.targets @@ -22,6 +22,7 @@ $(MSBuildThisFileDirectory)useSharedDesignerContext.txt + true PACKAGE.md PACKAGE.md $(BeforePack);ValidatePackageReadmeExists diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props index d6af2ef9b786c8..f2379fc9ff34da 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props @@ -6,7 +6,6 @@ $(MicrosoftNetCoreAppFrameworkName) false .NET Runtime - true - true diff --git a/src/mono/wasm/templates/Microsoft.NET.Runtime.WebAssembly.Templates.csproj b/src/mono/wasm/templates/Microsoft.NET.Runtime.WebAssembly.Templates.csproj index 0a4927e350fe7a..bc6ac6d8a84747 100644 --- a/src/mono/wasm/templates/Microsoft.NET.Runtime.WebAssembly.Templates.csproj +++ b/src/mono/wasm/templates/Microsoft.NET.Runtime.WebAssembly.Templates.csproj @@ -16,6 +16,8 @@ $(NoWarn);NU5128 true false + + false diff --git a/src/tests/tracing/eventpipe/common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj b/src/tests/tracing/eventpipe/common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj index 49503b15eedcda..8acc555e78d55b 100644 --- a/src/tests/tracing/eventpipe/common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj +++ b/src/tests/tracing/eventpipe/common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj @@ -13,6 +13,8 @@ true false true + + false diff --git a/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj b/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj index c7bda095b5b2ba..ea27178d3faabe 100644 --- a/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj +++ b/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj @@ -18,6 +18,8 @@ false false $(TargetsForTfmSpecificContentInPackage);AddBuildOutputToToolsPackage + + false - + + From f028127b6c99596783a7ccb5596cdccc5330bebf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:54:29 -0700 Subject: [PATCH 020/748] [release/9.0-rc1] JIT: fix unused operand marking in LowerHWIntrinsicTernaryLogic (#106574) * JIT: fix unused operand marking in LowerHWIntrinsicTernaryLogic In `LowerHWIntrinsicTernaryLogic` we do some operand swapping and replacing, and were not accounting for this when marking operands as unused. Fixes #106480. * review feedback --------- Co-authored-by: Andy Ayers --- src/coreclr/jit/lowerxarch.cpp | 7 +++++ .../JitBlue/Runtime_106480/Runtime_106480.cs | 31 +++++++++++++++++++ .../Runtime_106480/Runtime_106480.csproj | 8 +++++ 3 files changed, 46 insertions(+) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106480/Runtime_106480.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106480/Runtime_106480.csproj diff --git a/src/coreclr/jit/lowerxarch.cpp b/src/coreclr/jit/lowerxarch.cpp index 0a1c884f3848cd..e2c4671974773b 100644 --- a/src/coreclr/jit/lowerxarch.cpp +++ b/src/coreclr/jit/lowerxarch.cpp @@ -3927,6 +3927,13 @@ GenTree* Lowering::LowerHWIntrinsicTernaryLogic(GenTreeHWIntrinsic* node) } } + // Update the locals to reflect any operand swaps we did above. + + op1 = node->Op(1); + op2 = node->Op(2); + op3 = node->Op(3); + assert(op4 == node->Op(4)); + GenTree* replacementNode = nullptr; switch (useFlags) diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106480/Runtime_106480.cs b/src/tests/JIT/Regression/JitBlue/Runtime_106480/Runtime_106480.cs new file mode 100644 index 00000000000000..620d7c6be52638 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106480/Runtime_106480.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. + +// Found by Antigen +// Reduced from 121.36 KB to 3.38 +// Further redued by hand + +using System; +using System.Runtime.Intrinsics; +using System.Runtime.Intrinsics.X86; +using Xunit; + +public class Runtime_106480 +{ + Vector512 v512_ushort_102 = Vector512.AllBitsSet; + + void Problem() + { + if (Avx512F.IsSupported) + { + byte byte_126 = 5; + Avx512F.TernaryLogic(v512_ushort_102, v512_ushort_102, v512_ushort_102, byte_126); + } + } + + [Fact] + public static void Test() + { + new Runtime_106480().Problem(); + } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106480/Runtime_106480.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_106480/Runtime_106480.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106480/Runtime_106480.csproj @@ -0,0 +1,8 @@ + + + True + + + + + From 075bbef3585b43bfb00783c16045f55f147fa9b4 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 11:42:30 -0700 Subject: [PATCH 021/748] [release/9.0] Update dependencies from dotnet/roslyn (#106573) * Update dependencies from https://github.com/dotnet/roslyn build 20240816.5 Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset From Version 4.12.0-2.24414.1 -> To Version 4.12.0-2.24416.5 * Update dependencies from https://github.com/dotnet/roslyn build 20240817.1 Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset From Version 4.12.0-2.24416.5 -> To Version 4.12.0-2.24417.1 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ca5424509ef8c2..2c5bab895c4b31 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -356,17 +356,17 @@ https://github.com/dotnet/runtime-assets 3ed40d4f2335532ee7b04f8449468c52b4e2a643 - + https://github.com/dotnet/roslyn - bba7ceac50f68468ec9733a6a66f2314227101d4 + 75b26a2088e76855528483674a1fbeea0137241b - + https://github.com/dotnet/roslyn - bba7ceac50f68468ec9733a6a66f2314227101d4 + 75b26a2088e76855528483674a1fbeea0137241b - + https://github.com/dotnet/roslyn - bba7ceac50f68468ec9733a6a66f2314227101d4 + 75b26a2088e76855528483674a1fbeea0137241b https://github.com/dotnet/roslyn-analyzers @@ -377,9 +377,9 @@ fdb9965ce68c1f4e1c0ff301488adf9caa958615 - + https://github.com/dotnet/roslyn - bba7ceac50f68468ec9733a6a66f2314227101d4 + 75b26a2088e76855528483674a1fbeea0137241b diff --git a/eng/Versions.props b/eng/Versions.props index a36cb4e69c75a9..d753a363149f40 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -42,9 +42,9 @@ Any tools that contribute to the design-time experience should use the MicrosoftCodeAnalysisVersion_LatestVS property above to ensure they do not break the local dev experience. --> - 4.12.0-2.24414.1 - 4.12.0-2.24414.1 - 4.12.0-2.24414.1 + 4.12.0-2.24417.1 + 4.12.0-2.24417.1 + 4.12.0-2.24417.1 - + https://github.com/dotnet/runtime - 7cb32e193a55a95c74fc3bd56501b951b48b700f + 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae - + https://github.com/dotnet/runtime - 7cb32e193a55a95c74fc3bd56501b951b48b700f + 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae - + https://github.com/dotnet/runtime - 7cb32e193a55a95c74fc3bd56501b951b48b700f + 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae - + https://github.com/dotnet/runtime - 7cb32e193a55a95c74fc3bd56501b951b48b700f + 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae https://github.com/dotnet/xharness @@ -352,9 +352,9 @@ https://github.com/dotnet/hotreload-utils 90b2ffe6186a5fa3782a65f61ef396b0463d29b2 - + https://github.com/dotnet/runtime-assets - 3ed40d4f2335532ee7b04f8449468c52b4e2a643 + 6d82d2732e240983f23ebe53d3cfb8fcd3b3ec0d https://github.com/dotnet/roslyn diff --git a/eng/Versions.props b/eng/Versions.props index d753a363149f40..db6595fff9419f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -104,10 +104,10 @@ 6.0.0-preview.1.102 - 9.0.0-rc.1.24410.5 + 9.0.0-rc.1.24419.2 6.0.0 - 9.0.0-rc.1.24410.5 + 9.0.0-rc.1.24419.2 6.0.0 1.1.1 @@ -119,39 +119,39 @@ 8.0.0 5.0.0 4.5.5 - 9.0.0-rc.1.24410.5 - 9.0.0-rc.1.24410.5 + 9.0.0-rc.1.24419.2 + 9.0.0-rc.1.24419.2 6.0.0 5.0.0 5.0.0 5.0.0 7.0.0 - 9.0.0-rc.1.24410.5 + 9.0.0-rc.1.24419.2 6.0.0 7.0.0 4.5.4 4.5.0 - 9.0.0-rc.1.24410.5 + 9.0.0-rc.1.24419.2 8.0.0 8.0.0 8.0.0 8.0.0 - 9.0.0-beta.24407.1 - 9.0.0-beta.24407.1 - 9.0.0-beta.24407.1 - 9.0.0-beta.24407.1 - 9.0.0-beta.24407.1 - 9.0.0-beta.24407.1 - 9.0.0-beta.24407.1 - 9.0.0-beta.24407.1 - 9.0.0-beta.24407.1 - 9.0.0-beta.24407.1 - 9.0.0-beta.24407.1 - 9.0.0-beta.24407.1 - 9.0.0-beta.24407.1 - 9.0.0-beta.24407.1 + 9.0.0-beta.24419.1 + 9.0.0-beta.24419.1 + 9.0.0-beta.24419.1 + 9.0.0-beta.24419.1 + 9.0.0-beta.24419.1 + 9.0.0-beta.24419.1 + 9.0.0-beta.24419.1 + 9.0.0-beta.24419.1 + 9.0.0-beta.24419.1 + 9.0.0-beta.24419.1 + 9.0.0-beta.24419.1 + 9.0.0-beta.24419.1 + 9.0.0-beta.24419.1 + 9.0.0-beta.24419.1 1.0.0-prerelease.24376.4 1.0.0-prerelease.24376.4 @@ -214,7 +214,7 @@ 0.11.5-alpha.24413.1 - 9.0.0-rc.1.24410.5 + 9.0.0-rc.1.24419.2 10.0.0-alpha.1.24414.3 diff --git a/global.json b/global.json index ec8a8797b90408..9c5a350b0f574e 100644 --- a/global.json +++ b/global.json @@ -13,6 +13,6 @@ "Microsoft.DotNet.SharedFramework.Sdk": "9.0.0-beta.24408.2", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0", - "Microsoft.NET.Sdk.IL": "9.0.0-rc.1.24410.5" + "Microsoft.NET.Sdk.IL": "9.0.0-rc.1.24419.2" } } From 623b40260c5e99ff5999ef30a8e35c7d90bd8699 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 11:43:06 -0700 Subject: [PATCH 023/748] Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20240809.2 (#106630) optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR From Version 1.0.0-prerelease.24376.4 -> To Version 1.0.0-prerelease.24409.2 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 24 ++++++++++++------------ eng/Versions.props | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0f86aebbf1c649..13bd727b33a79b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -332,21 +332,21 @@ https://github.com/dotnet/arcade 60ae233c3d77f11c5fdb53e570b64d503b13ba59 - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 1b39aa819a38d504f7f828c28ff173acca7f99e2 + 8674aaa459d33551d419fece377f5512a1d93689 - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 1b39aa819a38d504f7f828c28ff173acca7f99e2 + 8674aaa459d33551d419fece377f5512a1d93689 - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 1b39aa819a38d504f7f828c28ff173acca7f99e2 + 8674aaa459d33551d419fece377f5512a1d93689 - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 1b39aa819a38d504f7f828c28ff173acca7f99e2 + 8674aaa459d33551d419fece377f5512a1d93689 https://github.com/dotnet/hotreload-utils @@ -392,13 +392,13 @@ 43360291a50c9c7c471551f8f8363919d38014ea - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 1b39aa819a38d504f7f828c28ff173acca7f99e2 + 8674aaa459d33551d419fece377f5512a1d93689 - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 1b39aa819a38d504f7f828c28ff173acca7f99e2 + 8674aaa459d33551d419fece377f5512a1d93689 diff --git a/eng/Versions.props b/eng/Versions.props index db6595fff9419f..cd93abaf34136a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -153,12 +153,12 @@ 9.0.0-beta.24419.1 9.0.0-beta.24419.1 - 1.0.0-prerelease.24376.4 - 1.0.0-prerelease.24376.4 - 1.0.0-prerelease.24376.4 - 1.0.0-prerelease.24376.4 - 1.0.0-prerelease.24376.4 - 1.0.0-prerelease.24376.4 + 1.0.0-prerelease.24409.2 + 1.0.0-prerelease.24409.2 + 1.0.0-prerelease.24409.2 + 1.0.0-prerelease.24409.2 + 1.0.0-prerelease.24409.2 + 1.0.0-prerelease.24409.2 2.0.0 17.10.0-beta1.24272.1 From 0bf8d1e16158c2f8fb4e7039fee1be11d216a0ec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 08:41:10 -0700 Subject: [PATCH 024/748] Include libz.a in native aot packages (#106673) Fixes #106566 Co-authored-by: Jan Kotas --- .../Microsoft.NETCore.Native.Unix.targets | 8 ++++++-- .../libs/System.IO.Compression.Native/CMakeLists.txt | 7 +------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index 19c6ce7a4b376a..d2696ffbcad6dc 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -24,7 +24,7 @@ The .NET Foundation licenses this file to you under the MIT license. lld bfd 1572864 - true + true @@ -136,7 +136,6 @@ The .NET Foundation licenses this file to you under the MIT license. - @@ -151,6 +150,11 @@ The .NET Foundation licenses this file to you under the MIT license. + + + + + diff --git a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt index 7fa92062d8e5b0..69d333ae53f9c5 100644 --- a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt +++ b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt @@ -184,12 +184,7 @@ else () endif () if((NOT CLR_CMAKE_USE_SYSTEM_ZLIB) AND STATIC_LIBS_ONLY) - if (CLR_CMAKE_TARGET_UNIX) - # zlib on Unix needs to be installed in the same location as System.IO.Compression.Native so that we can then treat is as a 'z' native library. - install_static_library(zlib ${STATIC_LIB_DESTINATION} nativeaot) - else() - install_static_library(zlib aotsdk nativeaot) - endif() + install_static_library(zlib aotsdk nativeaot) endif() install (TARGETS System.IO.Compression.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) From fe0cfd55339cc2a0d745f742a48d5e880c112ec2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 10:34:49 -0700 Subject: [PATCH 025/748] Fix IOCP count config var test (#106669) The TcpListener was being disposed too early. Co-authored-by: Koundinya Veluri --- .../tests/ThreadPoolTests.cs | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs b/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs index 4d2638c11c8003..7c3c215c5ee6c5 100644 --- a/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs +++ b/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs @@ -1394,22 +1394,26 @@ static async Task RunAsyncIOTest() var done = new AutoResetEvent(false); // Receiver + bool stop = false; var receiveBuffer = new byte[1]; - using var listener = new TcpListener(IPAddress.Loopback, 0); + var listener = new TcpListener(IPAddress.Loopback, 0); listener.Start(); var t = ThreadTestHelpers.CreateGuardedThread( out Action checkForThreadErrors, out Action waitForThread, async () => { - while (true) + using (listener) { - // Accept a connection, receive a byte - using var socket = await listener.AcceptSocketAsync(); - int bytesRead = - await socket.ReceiveAsync(new ArraySegment(receiveBuffer), SocketFlags.None); - Assert.Equal(1, bytesRead); - done.Set(); // indicate byte received + while (!stop) + { + // Accept a connection, receive a byte + using var socket = await listener.AcceptSocketAsync(); + int bytesRead = + await socket.ReceiveAsync(new ArraySegment(receiveBuffer), SocketFlags.None); + Assert.Equal(1, bytesRead); + done.Set(); // indicate byte received + } } }); t.IsBackground = true; @@ -1427,6 +1431,9 @@ static async Task RunAsyncIOTest() Assert.Equal(1, bytesSent); done.CheckedWait(); // wait for byte to the received } + + stop = true; + waitForThread(); } }).Dispose(); }, ioCompletionPortCount.ToString()).Dispose(); From 34649600b82d23edb65c772523aafe4cb04682ed Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 15:01:27 -0700 Subject: [PATCH 026/748] [release/9.0] Update `MethodTable::IsDynamicStatics` and `DacpMethodTableData::bIsDynamic` to return 0/1 instead of flag value (#106643) * Update assert in GetMethodTableData for cDAC/DAC bIsDynamic values * Make DAC return TRUE/FALSE instead of flag value for DacpMethodTableData::bIsDynamic * Make MethodTable::IsDynamicStatics return 0/1 instead of flag value --------- Co-authored-by: Elinor Fung --- src/coreclr/debug/daccess/request.cpp | 2 +- src/coreclr/vm/methodtable.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/debug/daccess/request.cpp b/src/coreclr/debug/daccess/request.cpp index 71c9df21dfa763..2f9636c67021a2 100644 --- a/src/coreclr/debug/daccess/request.cpp +++ b/src/coreclr/debug/daccess/request.cpp @@ -2160,7 +2160,7 @@ ClrDataAccess::GetMethodTableDataImpl(CLRDATA_ADDRESS mt, struct DacpMethodTable MTData->dwAttrClass = pMT->GetAttrClass(); MTData->bContainsPointers = pMT->ContainsGCPointers(); MTData->bIsShared = FALSE; - MTData->bIsDynamic = pMT->IsDynamicStatics(); + MTData->bIsDynamic = pMT->IsDynamicStatics() ? TRUE : FALSE; } return S_OK; } diff --git a/src/coreclr/vm/methodtable.h b/src/coreclr/vm/methodtable.h index 751ec9d0855ddc..79334cb03201fd 100644 --- a/src/coreclr/vm/methodtable.h +++ b/src/coreclr/vm/methodtable.h @@ -2567,10 +2567,10 @@ class MethodTable inline PTR_BYTE GetNonGCThreadStaticsBasePointer(PTR_Thread pThread); inline PTR_BYTE GetGCThreadStaticsBasePointer(PTR_Thread pThread); - inline DWORD IsDynamicStatics() + inline BOOL IsDynamicStatics() { LIMITED_METHOD_DAC_CONTRACT; - return GetFlag(enum_flag_DynamicStatics); + return GetFlag(enum_flag_DynamicStatics) == enum_flag_DynamicStatics; } inline void SetDynamicStatics() From 6b5d89152d7f4f71c87009dc8ee99c1f7cba8b5e Mon Sep 17 00:00:00 2001 From: Eric StJohn Date: Tue, 20 Aug 2024 16:00:30 -0700 Subject: [PATCH 027/748] Revert Update dependencies from https://github.com/dotnet/runtime build 20240819.2 (#106729) This introduced a dependency on a newer runtime from build tools --- eng/Version.Details.xml | 36 ++++++++++++++++++------------------ eng/Versions.props | 14 +++++++------- global.json | 2 +- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2820c2b35e8193..dde7f403b99dbd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -278,43 +278,43 @@ https://github.com/dotnet/llvm-project b9b4464b3b10c1961ed0ff39b5f33b3b3bbf62d1 - + https://github.com/dotnet/runtime - 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae + 7cb32e193a55a95c74fc3bd56501b951b48b700f - + https://github.com/dotnet/runtime - 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae + 7cb32e193a55a95c74fc3bd56501b951b48b700f - + https://github.com/dotnet/runtime - 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae + 7cb32e193a55a95c74fc3bd56501b951b48b700f - + https://github.com/dotnet/runtime - 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae + 7cb32e193a55a95c74fc3bd56501b951b48b700f - + https://github.com/dotnet/runtime - 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae + 7cb32e193a55a95c74fc3bd56501b951b48b700f - + https://github.com/dotnet/runtime - 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae + 7cb32e193a55a95c74fc3bd56501b951b48b700f - + https://github.com/dotnet/runtime - 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae + 7cb32e193a55a95c74fc3bd56501b951b48b700f - + https://github.com/dotnet/runtime - 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae + 7cb32e193a55a95c74fc3bd56501b951b48b700f - + https://github.com/dotnet/runtime - 418c3b9e2753715fa017ace6b3f1f5ec4d4d6aae + 7cb32e193a55a95c74fc3bd56501b951b48b700f https://github.com/dotnet/xharness diff --git a/eng/Versions.props b/eng/Versions.props index e307e599cebc66..643e1f3e923ece 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -104,10 +104,10 @@ 6.0.0-preview.1.102 - 9.0.0-rc.1.24419.2 + 9.0.0-rc.1.24410.5 6.0.0 - 9.0.0-rc.1.24419.2 + 9.0.0-rc.1.24410.5 6.0.0 1.1.1 @@ -119,19 +119,19 @@ 8.0.0 5.0.0 4.5.5 - 9.0.0-rc.1.24419.2 - 9.0.0-rc.1.24419.2 + 9.0.0-rc.1.24410.5 + 9.0.0-rc.1.24410.5 6.0.0 5.0.0 5.0.0 5.0.0 7.0.0 - 9.0.0-rc.1.24419.2 + 9.0.0-rc.1.24410.5 6.0.0 7.0.0 4.5.4 4.5.0 - 9.0.0-rc.1.24419.2 + 9.0.0-rc.1.24410.5 8.0.0 8.0.0 @@ -214,7 +214,7 @@ 0.11.5-alpha.24413.1 - 9.0.0-rc.1.24419.2 + 9.0.0-rc.1.24410.5 10.0.0-alpha.1.24414.3 diff --git a/global.json b/global.json index 9c5a350b0f574e..ec8a8797b90408 100644 --- a/global.json +++ b/global.json @@ -13,6 +13,6 @@ "Microsoft.DotNet.SharedFramework.Sdk": "9.0.0-beta.24408.2", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0", - "Microsoft.NET.Sdk.IL": "9.0.0-rc.1.24419.2" + "Microsoft.NET.Sdk.IL": "9.0.0-rc.1.24410.5" } } From 705315640600de8baa9b2f09e582b8fed128a892 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 20:36:40 -0500 Subject: [PATCH 028/748] Update dependencies from https://github.com/dotnet/emsdk build 20240820.4 (#106739) Microsoft.SourceBuild.Intermediate.emsdk , Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport From Version 9.0.0-rc.1.24416.2 -> To Version 9.0.0-rc.2.24420.4 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index dde7f403b99dbd..9e8fc78057b96f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -64,14 +64,14 @@ ed276e79e30bffc3e6405afa8a9323ec7e67c700 - + https://github.com/dotnet/emsdk - 459c92904b224d125a350a3f3e431fe90152a95e + 9945277ad92ce1d53d6a7a578f9f5bd2af858ddd - + https://github.com/dotnet/emsdk - 459c92904b224d125a350a3f3e431fe90152a95e + 9945277ad92ce1d53d6a7a578f9f5bd2af858ddd diff --git a/eng/Versions.props b/eng/Versions.props index 643e1f3e923ece..725f285875ba4f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -239,7 +239,7 @@ Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-9_0_100_Transport --> - 9.0.0-rc.1.24416.2 + 9.0.0-rc.2.24420.4 $(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion) 1.1.87-gba258badda From c4a79875fcb2c76b2e92ff50940d4ea9264e2eeb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 00:37:49 -0700 Subject: [PATCH 029/748] Update dependencies from https://github.com/dotnet/emsdk build 20240820.5 (#106743) Microsoft.SourceBuild.Intermediate.emsdk , Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport From Version 9.0.0-rc.1.24416.2 -> To Version 9.0.0-rc.1.24420.5 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index dbf16b28fa69f8..e46836cb31a8a2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -64,12 +64,12 @@ ed276e79e30bffc3e6405afa8a9323ec7e67c700 - + https://github.com/dotnet/emsdk 459c92904b224d125a350a3f3e431fe90152a95e - + https://github.com/dotnet/emsdk 459c92904b224d125a350a3f3e431fe90152a95e diff --git a/eng/Versions.props b/eng/Versions.props index a018ef2195731e..a132c4a8c44728 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -239,7 +239,7 @@ Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-9_0_100_Transport --> - 9.0.0-rc.1.24416.2 + 9.0.0-rc.1.24420.5 $(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion) 1.1.87-gba258badda From 8e6d11792a66c41c17e7481595adf096252be161 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:01:18 -0700 Subject: [PATCH 030/748] Update dependencies from https://github.com/dotnet/arcade build 20240820.6 (#106758) Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XliffTasks , Microsoft.DotNet.XUnitAssert , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 9.0.0-beta.24408.2 -> To Version 9.0.0-beta.24420.6 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 84 ++++++++++++++++++++--------------------- eng/Versions.props | 32 ++++++++-------- global.json | 6 +-- 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9e8fc78057b96f..3270605e058e7a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -88,87 +88,87 @@ - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d https://github.com/dotnet/runtime-assets @@ -328,9 +328,9 @@ https://github.com/dotnet/xharness 9794254fa909ff5adc46326e9b54009793f61dcd - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + b435d26f349d3960d12281321972ed323c35319d https://dev.azure.com/dnceng/internal/_git/dotnet-optimization diff --git a/eng/Versions.props b/eng/Versions.props index 725f285875ba4f..fb575375db50cf 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -83,22 +83,22 @@ 9.0.100-rc.1.24409.1 - 9.0.0-beta.24408.2 - 9.0.0-beta.24408.2 - 9.0.0-beta.24408.2 - 9.0.0-beta.24408.2 - 2.9.0-beta.24408.2 - 9.0.0-beta.24408.2 - 2.9.0-beta.24408.2 - 9.0.0-beta.24408.2 - 9.0.0-beta.24408.2 - 9.0.0-beta.24408.2 - 9.0.0-beta.24408.2 - 9.0.0-beta.24408.2 - 9.0.0-beta.24408.2 - 9.0.0-beta.24408.2 - 9.0.0-beta.24408.2 - 9.0.0-beta.24408.2 + 9.0.0-beta.24420.6 + 9.0.0-beta.24420.6 + 9.0.0-beta.24420.6 + 9.0.0-beta.24420.6 + 2.9.0-beta.24420.6 + 9.0.0-beta.24420.6 + 2.9.0-beta.24420.6 + 9.0.0-beta.24420.6 + 9.0.0-beta.24420.6 + 9.0.0-beta.24420.6 + 9.0.0-beta.24420.6 + 9.0.0-beta.24420.6 + 9.0.0-beta.24420.6 + 9.0.0-beta.24420.6 + 9.0.0-beta.24420.6 + 9.0.0-beta.24420.6 1.4.0 diff --git a/global.json b/global.json index ec8a8797b90408..c4a1f222a0aaae 100644 --- a/global.json +++ b/global.json @@ -8,9 +8,9 @@ "dotnet": "9.0.100-preview.7.24407.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24408.2", - "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.24408.2", - "Microsoft.DotNet.SharedFramework.Sdk": "9.0.0-beta.24408.2", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24420.6", + "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.24420.6", + "Microsoft.DotNet.SharedFramework.Sdk": "9.0.0-beta.24420.6", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0", "Microsoft.NET.Sdk.IL": "9.0.0-rc.1.24410.5" From 06269ca6a34b24cffe28d3fb3045a86ec07a4a9e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:07:02 -0700 Subject: [PATCH 031/748] [release/9.0] JIT: Cast UInt64 to Single directly during const folding (#106720) * Fix cast folding on ARM64 * Add test * Fix weird comment spacing * Fix test * Fix test * Flip params * Run test on CoreCLR only * Add RequiresProcessIsolation * Do single-step conversion on all platforms * Expand test coverage * Update test * Try running test on all CoreCLR platforms * Fix condition --------- Co-authored-by: Aman Khalid (from Dev Box) --- src/coreclr/jit/gentree.cpp | 2 +- src/coreclr/jit/utils.cpp | 3 +- .../JitBlue/Runtime_106338/Runtime_106338.cs | 36 +++++++++++++++++++ .../Runtime_106338/Runtime_106338.csproj | 8 +++++ 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106338/Runtime_106338.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106338/Runtime_106338.csproj diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index f687f9139f5981..50adf99687d371 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -15607,7 +15607,7 @@ GenTree* Compiler::gtFoldExprConst(GenTree* tree) case TYP_FLOAT: { -#if defined(TARGET_64BIT) +#ifdef TARGET_64BIT if (tree->IsUnsigned() && (lval1 < 0)) { f1 = FloatingPointUtils::convertUInt64ToFloat((uint64_t)lval1); diff --git a/src/coreclr/jit/utils.cpp b/src/coreclr/jit/utils.cpp index 209b23ac6f46a0..cbee0be0158183 100644 --- a/src/coreclr/jit/utils.cpp +++ b/src/coreclr/jit/utils.cpp @@ -2272,8 +2272,7 @@ double FloatingPointUtils::convertUInt64ToDouble(uint64_t uIntVal) float FloatingPointUtils::convertUInt64ToFloat(uint64_t u64) { - double d = convertUInt64ToDouble(u64); - return (float)d; + return (float)u64; } uint64_t FloatingPointUtils::convertDoubleToUInt64(double d) diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106338/Runtime_106338.cs b/src/tests/JIT/Regression/JitBlue/Runtime_106338/Runtime_106338.cs new file mode 100644 index 00000000000000..5cc1b75d42fda1 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106338/Runtime_106338.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. + +// Generated by Fuzzlyn v2.2 on 2024-08-13 00:04:04 +// Run on Arm64 MacOS +// Seed: 13207615092246842583-vectort,vector64,vector128,armadvsimd,armadvsimdarm64,armaes,armarmbase,armarmbasearm64,armcrc32,armcrc32arm64,armdp,armrdm,armrdmarm64,armsha1,armsha256 +// Reduced from 226.8 KiB to 0.4 KiB in 00:02:12 +// Debug: Outputs 1600094603 +// Release: Outputs 1600094604 +using System; +using System.Runtime.InteropServices; +using System.Runtime.Intrinsics.X86; +using Xunit; + +public class Runtime_106338 +{ + [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368", TestPlatforms.Any)] + public static void TestEntryPoint() + { + ulong vr10 = 16105307123914158031UL; + float vr11 = 4294967295U | vr10; + uint result = BitConverter.SingleToUInt32Bits(vr11); + + if ((RuntimeInformation.ProcessArchitecture == Architecture.Arm64) || ((RuntimeInformation.ProcessArchitecture == Architecture.X64) && Avx512F.IsSupported)) + { + // Expected to cast ulong -> float directly + Assert.Equal(1600094603U, result); + } + else + { + // Expected to cast ulong -> double -> float + Assert.Equal(1600094604U, result); + } + } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106338/Runtime_106338.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_106338/Runtime_106338.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106338/Runtime_106338.csproj @@ -0,0 +1,8 @@ + + + True + + + + + From 03a1d52b9aa13cbdc4a04a166262535ed8c899fc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:28:14 -0700 Subject: [PATCH 032/748] [release/9.0] Update dependencies from dotnet/roslyn (#106688) * Update dependencies from https://github.com/dotnet/roslyn build 20240819.4 Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset From Version 4.12.0-2.24417.1 -> To Version 4.12.0-2.24419.4 * Update dependencies from https://github.com/dotnet/roslyn build 20240820.10 Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset From Version 4.12.0-2.24419.4 -> To Version 4.12.0-2.24420.10 --------- Co-authored-by: dotnet-maestro[bot] Co-authored-by: Larry Ewing --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5ba4ca94494a4c..3c6370e8c349bd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -357,17 +357,17 @@ https://github.com/dotnet/runtime-assets 6d82d2732e240983f23ebe53d3cfb8fcd3b3ec0d - + https://github.com/dotnet/roslyn - 75b26a2088e76855528483674a1fbeea0137241b + c63e7b69c8a24803129f63b382c0ab1558112cf6 - + https://github.com/dotnet/roslyn - 75b26a2088e76855528483674a1fbeea0137241b + c63e7b69c8a24803129f63b382c0ab1558112cf6 - + https://github.com/dotnet/roslyn - 75b26a2088e76855528483674a1fbeea0137241b + c63e7b69c8a24803129f63b382c0ab1558112cf6 https://github.com/dotnet/roslyn-analyzers @@ -378,9 +378,9 @@ fdb9965ce68c1f4e1c0ff301488adf9caa958615 - + https://github.com/dotnet/roslyn - 75b26a2088e76855528483674a1fbeea0137241b + c63e7b69c8a24803129f63b382c0ab1558112cf6 diff --git a/eng/Versions.props b/eng/Versions.props index ee707e7a3b8ba9..9e5ff83002144e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -42,9 +42,9 @@ Any tools that contribute to the design-time experience should use the MicrosoftCodeAnalysisVersion_LatestVS property above to ensure they do not break the local dev experience. --> - 4.12.0-2.24417.1 - 4.12.0-2.24417.1 - 4.12.0-2.24417.1 + 4.12.0-2.24420.10 + 4.12.0-2.24420.10 + 4.12.0-2.24420.10 - + https://github.com/dotnet/cecil - ed276e79e30bffc3e6405afa8a9323ec7e67c700 + c667bfea9cdbc5b5493e49e7ddc8dd635a217891 @@ -82,9 +82,9 @@ - + https://github.com/dotnet/source-build-externals - 2cef086137a68586fdd69848261e2a8cf8c48b73 + ee22054b44ec9615dc3481c4decc1b007a83a2b0 @@ -349,9 +349,9 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-optimization 8674aaa459d33551d419fece377f5512a1d93689 - + https://github.com/dotnet/hotreload-utils - 90b2ffe6186a5fa3782a65f61ef396b0463d29b2 + 8392605e46c7424eba5f43591fc44d2c3b1f28df https://github.com/dotnet/runtime-assets diff --git a/eng/Versions.props b/eng/Versions.props index 9e5ff83002144e..0663bdef3e627f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -184,7 +184,7 @@ 9.0.0-prerelease.24405.1 9.0.0-prerelease.24405.1 9.0.0-prerelease.24405.1 - 9.0.0-alpha.0.24412.1 + 9.0.0-alpha.0.24419.1 3.12.0 4.5.0 6.0.0 @@ -212,7 +212,7 @@ 8.0.0-preview-20230918.1 - 0.11.5-alpha.24413.1 + 0.11.5-alpha.24419.1 9.0.0-rc.1.24410.5 From 02bb8c3d197b143029eb9b5389c7abee09dfcb4b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:45:58 -0700 Subject: [PATCH 034/748] [release/9.0] [NativeAOT] Introduce pointer-based CompareExchange intrinsic and use operating with syncblock bits. (#106727) * introduce CompareExchange(int* location1, int value, int comparand) * Apply suggestions from code review Co-authored-by: Jan Kotas * fix arm32 build --------- Co-authored-by: vsadov <8218165+VSadov@users.noreply.github.com> Co-authored-by: Vladimir Sadov Co-authored-by: Jan Kotas Co-authored-by: Jeff Schwartz --- .../src/System/Runtime/RuntimeImports.cs | 4 ++++ .../src/System/Threading/Interlocked.cs | 19 +++++++++++++++++++ .../src/System/Threading/ObjectHeader.cs | 12 ++++++------ .../src/System/Runtime/RuntimeImports.cs | 4 ++++ 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs index 17a0bca07e13ba..7f833e613e5c4b 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs @@ -649,6 +649,10 @@ internal static IntPtr RhGetModuleSection(TypeManagerHandle module, ReadyToRunSe [RuntimeImport(RuntimeLibrary, "RhpLockCmpXchg32")] internal static extern int InterlockedCompareExchange(ref int location1, int value, int comparand); + [MethodImplAttribute(MethodImplOptions.InternalCall)] + [RuntimeImport(RuntimeLibrary, "RhpLockCmpXchg32")] + internal static extern unsafe int InterlockedCompareExchange(int* location1, int value, int comparand); + [MethodImplAttribute(MethodImplOptions.InternalCall)] [RuntimeImport(RuntimeLibrary, "RhpLockCmpXchg64")] internal static extern long InterlockedCompareExchange(ref long location1, long value, long comparand); diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Interlocked.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Interlocked.cs index 0a7fc2e65f2e30..7596f676c901e8 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Interlocked.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Interlocked.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; using System.Runtime.CompilerServices; @@ -23,6 +24,24 @@ public static int CompareExchange(ref int location1, int value, int comparand) #endif } + // This is used internally by NativeAOT runtime in cases where having a managed + // ref to the location is unsafe (Ex: it is the syncblock of a pinned object). + // The intrinsic expansion for this overload is exactly the same as for the `ref int` + // variant and will go on the same path since expansion is triggered by the name and + // return type of the method. + // The important part is avoiding `ref *location` in the unexpanded scenario, like + // in a case when compiling the Debug flavor of the app. + [Intrinsic] + internal static unsafe int CompareExchange(int* location1, int value, int comparand) + { +#if TARGET_X86 || TARGET_AMD64 || TARGET_ARM64 || TARGET_RISCV64 + return CompareExchange(location1, value, comparand); // Must expand intrinsic +#else + Debug.Assert(location1 != null); + return RuntimeImports.InterlockedCompareExchange(location1, value, comparand); +#endif + } + [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static long CompareExchange(ref long location1, long value, long comparand) diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/ObjectHeader.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/ObjectHeader.cs index 1d0c27751521b9..b56054d9f164e0 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/ObjectHeader.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/ObjectHeader.cs @@ -152,7 +152,7 @@ private static unsafe int AssignHashCode(object o, int* pHeader) // there is nothing - try set hashcode inline Debug.Assert((oldBits & BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX) == 0); int newBits = BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX | BIT_SBLK_IS_HASHCODE | oldBits | newHash; - if (Interlocked.CompareExchange(ref *pHeader, newBits, oldBits) == oldBits) + if (Interlocked.CompareExchange(pHeader, newBits, oldBits) == oldBits) { return newHash; } @@ -247,7 +247,7 @@ public static unsafe void SetSyncEntryIndex(int* pHeader, int syncIndex) newBits = oldBits & ~(BIT_SBLK_IS_HASHCODE | MASK_HASHCODE_INDEX); newBits |= syncIndex | BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX; } - while (Interlocked.CompareExchange(ref *pHeader, newBits, oldBits) != oldBits); + while (Interlocked.CompareExchange(pHeader, newBits, oldBits) != oldBits); } // @@ -312,7 +312,7 @@ public static unsafe int TryAcquire(object obj, int currentThreadID, bool oneSho // N.B. hashcode, thread ID and sync index are never 0, and hashcode is largest of all if ((oldBits & MASK_HASHCODE_INDEX) == 0) { - if (Interlocked.CompareExchange(ref *pHeader, oldBits | currentThreadID, oldBits) == oldBits) + if (Interlocked.CompareExchange(pHeader, oldBits | currentThreadID, oldBits) == oldBits) { return -1; } @@ -369,7 +369,7 @@ private static unsafe int TryAcquireUncommon(object obj, int currentThreadID, bo if ((oldBits & MASK_HASHCODE_INDEX) == 0) { int newBits = oldBits | currentThreadID; - if (Interlocked.CompareExchange(ref *pHeader, newBits, oldBits) == oldBits) + if (Interlocked.CompareExchange(pHeader, newBits, oldBits) == oldBits) { return -1; } @@ -398,7 +398,7 @@ private static unsafe int TryAcquireUncommon(object obj, int currentThreadID, bo int newBits = oldBits + SBLK_LOCK_RECLEVEL_INC; if ((newBits & SBLK_MASK_LOCK_RECLEVEL) != 0) { - if (Interlocked.CompareExchange(ref *pHeader, newBits, oldBits) == oldBits) + if (Interlocked.CompareExchange(pHeader, newBits, oldBits) == oldBits) { return -1; } @@ -458,7 +458,7 @@ public static unsafe void Release(object obj) oldBits - SBLK_LOCK_RECLEVEL_INC : oldBits & ~SBLK_MASK_LOCK_THREADID; - if (Interlocked.CompareExchange(ref *pHeader, newBits, oldBits) == oldBits) + if (Interlocked.CompareExchange(pHeader, newBits, oldBits) == oldBits) { return; } diff --git a/src/coreclr/nativeaot/Test.CoreLib/src/System/Runtime/RuntimeImports.cs b/src/coreclr/nativeaot/Test.CoreLib/src/System/Runtime/RuntimeImports.cs index 70b0cda4d2f6ac..52d1277f0bd0c5 100644 --- a/src/coreclr/nativeaot/Test.CoreLib/src/System/Runtime/RuntimeImports.cs +++ b/src/coreclr/nativeaot/Test.CoreLib/src/System/Runtime/RuntimeImports.cs @@ -94,6 +94,10 @@ internal static IntPtr RhGetModuleSection(TypeManagerHandle module, ReadyToRunSe [RuntimeImport(RuntimeLibrary, "RhpLockCmpXchg32")] internal static extern int InterlockedCompareExchange(ref int location1, int value, int comparand); + [MethodImplAttribute(MethodImplOptions.InternalCall)] + [RuntimeImport(RuntimeLibrary, "RhpLockCmpXchg32")] + internal static extern unsafe int InterlockedCompareExchange(int* location1, int value, int comparand); + [MethodImplAttribute(MethodImplOptions.InternalCall)] [RuntimeImport(RuntimeLibrary, "RhpLockCmpXchg64")] internal static extern long InterlockedCompareExchange(ref long location1, long value, long comparand); From 84e8aa4ce964530cba20f01ce9dae629f7db17d9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 11:58:07 -0700 Subject: [PATCH 035/748] [release/9.0] JIT: Avoid removing CSE candidates in fgMorphExpandCast (#106746) * JIT: Avoid removing CSE candidates in fgMorphExpandCast Fix #106609 * Fix test --------- Co-authored-by: Jakob Botsch Nielsen Co-authored-by: Jeff Schwartz --- src/coreclr/jit/morph.cpp | 3 +- .../JitBlue/Runtime_106609/Runtime_106609.cs | 45 +++++++++++++++++++ .../Runtime_106609/Runtime_106609.csproj | 8 ++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106609/Runtime_106609.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106609/Runtime_106609.csproj diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index d037282e447ab5..f8989a40f405ff 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -451,7 +451,8 @@ GenTree* Compiler::fgMorphExpandCast(GenTreeCast* tree) // Because there is no IL instruction conv.r4.un, uint/ulong -> float // casts are always imported as CAST(float <- CAST(double <- uint/ulong)). // We can eliminate the redundant intermediate cast as an optimization. - else if ((dstType == TYP_FLOAT) && (srcType == TYP_DOUBLE) && oper->OperIs(GT_CAST) + else if ((dstType == TYP_FLOAT) && (srcType == TYP_DOUBLE) && oper->OperIs(GT_CAST) && + !gtIsActiveCSE_Candidate(tree) #ifdef TARGET_ARM && !varTypeIsLong(oper->AsCast()->CastOp()) #endif diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106609/Runtime_106609.cs b/src/tests/JIT/Regression/JitBlue/Runtime_106609/Runtime_106609.cs new file mode 100644 index 00000000000000..e640f91d86c669 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106609/Runtime_106609.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. + +// Generated by Fuzzlyn v2.2 on 2024-08-17 17:16:59 +// Run on Arm64 Windows +// Seed: 18124298882625099135-vectort,vector64,vector128,armadvsimd,armadvsimdarm64,armaes,armarmbase,armarmbasearm64,armcrc32,armcrc32arm64,armdp,armsha1,armsha256 +// Reduced from 129.5 KiB to 0.4 KiB in 00:04:55 +// Hits JIT assert in Release: +// Assertion failed 'link' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Optimize Valnum CSEs' (IL size 39; hash 0xade6b36b; FullOpts) +// +// File: D:\a\_work\1\s\src\coreclr\jit\optcse.cpp Line: 5295 +// +using System.Runtime.CompilerServices; +using System.Runtime.Intrinsics; +using System.Runtime.Intrinsics.Arm; +using Xunit; + +public class Runtime_106609 +{ + [Fact] + public static void TestEntrypoint() + { + if (AdvSimd.IsSupported) + { + try + { + Test(); + } + catch + { + } + } + } + + public static float[] s_2; + [MethodImpl(MethodImplOptions.NoInlining)] + private static void Test() + { + for (int vr8 = 0; vr8 < 2; vr8++) + { + var vr9 = Vector64.Create(0); + s_2[0] = (float)(-(-(double)AdvSimd.Extract(vr9, 0))); + } + } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106609/Runtime_106609.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_106609/Runtime_106609.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106609/Runtime_106609.csproj @@ -0,0 +1,8 @@ + + + True + + + + + From a80d1c1615eeed8e82d9a9c5474bfdbf34e346da Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 13:08:27 -0700 Subject: [PATCH 036/748] [release/9.0] Fix Issue #105820 (#106656) * Check for writing sign flag for skipping test condition in compare to zero * Only skip test instruction in case Writes_PF, Writes ZF, WritesSF, ResetsCF and ResetsOF are true --------- Co-authored-by: Khushal Modi Co-authored-by: Jeff Schwartz --- src/coreclr/jit/emitxarch.cpp | 19 ++++++++++++++++++- src/coreclr/jit/emitxarch.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/coreclr/jit/emitxarch.cpp b/src/coreclr/jit/emitxarch.cpp index e3561bbff37978..2b98d14183abab 100644 --- a/src/coreclr/jit/emitxarch.cpp +++ b/src/coreclr/jit/emitxarch.cpp @@ -355,6 +355,22 @@ bool emitter::DoesWriteZeroFlag(instruction ins) return (flags & Writes_ZF) != 0; } +//------------------------------------------------------------------------ +// DoesWriteParityFlag: check if the instruction write the +// PF flag. +// +// Arguments: +// ins - instruction to test +// +// Return Value: +// true if instruction writes the PF flag, false otherwise. +// +bool emitter::DoesWriteParityFlag(instruction ins) +{ + insFlags flags = CodeGenInterface::instInfo[ins]; + return (flags & Writes_PF) != 0; +} + //------------------------------------------------------------------------ // DoesWriteSignFlag: check if the instruction writes the // SF flag. @@ -979,7 +995,8 @@ bool emitter::AreFlagsSetToZeroCmp(regNumber reg, emitAttr opSize, GenCondition // Certain instruction like and, or and xor modifies exactly same flags // as "test" instruction. // They reset OF and CF to 0 and modifies SF, ZF and PF. - if (DoesResetOverflowAndCarryFlags(lastIns)) + if (DoesResetOverflowAndCarryFlags(lastIns) && DoesWriteSignFlag(lastIns) && DoesWriteZeroFlag(lastIns) && + DoesWriteParityFlag(lastIns)) { return id->idOpSize() == opSize; } diff --git a/src/coreclr/jit/emitxarch.h b/src/coreclr/jit/emitxarch.h index d24a697d93c727..7ff6902613d59c 100644 --- a/src/coreclr/jit/emitxarch.h +++ b/src/coreclr/jit/emitxarch.h @@ -484,6 +484,7 @@ bool IsThreeOperandAVXInstruction(instruction ins) const; static bool HasRegularWideForm(instruction ins); static bool HasRegularWideImmediateForm(instruction ins); static bool DoesWriteZeroFlag(instruction ins); +static bool DoesWriteParityFlag(instruction ins); static bool DoesWriteSignFlag(instruction ins); static bool DoesResetOverflowAndCarryFlags(instruction ins); bool IsFlagsAlwaysModified(instrDesc* id); From c689e35216bf63c9652dcbca1b20875a1f29e4a3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:58:51 -0600 Subject: [PATCH 037/748] [release/9.0] Fix Type System Equivalence Checks (#106723) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial fix for the type not being read bug. * Addressed initial feedback to fully fix the bug. --------- Co-authored-by: Ivan Diaz Co-authored-by: Carlos Sánchez López <1175054+carlossanlop@users.noreply.github.com> --- .../Ecma/EcmaType.TypeEquivalence.cs | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaType.TypeEquivalence.cs b/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaType.TypeEquivalence.cs index 94d7722c28485f..b7fb3327a2655d 100644 --- a/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaType.TypeEquivalence.cs +++ b/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaType.TypeEquivalence.cs @@ -14,6 +14,7 @@ public partial class EcmaType private TypeIdentifierData ComputeTypeIdentifierFromGuids() { CustomAttributeValue? guidAttribute; + if (IsInterface && _typeDefinition.Attributes.HasFlag(TypeAttributes.Import)) { // ComImport interfaces get scope from their GUID @@ -23,6 +24,7 @@ private TypeIdentifierData ComputeTypeIdentifierFromGuids() { // other equivalent types get it from the declaring assembly var attributeHandle = this.MetadataReader.GetCustomAttributeHandle(MetadataReader.GetAssemblyDefinition().GetCustomAttributes(), "System.Runtime.InteropServices", "GuidAttribute"); + if (attributeHandle.IsNil) return null; @@ -40,6 +42,7 @@ private TypeIdentifierData ComputeTypeIdentifierFromGuids() string scope = (string)guidAttribute.Value.FixedArguments[0].Value; string name = this.Name; + if (this.Namespace != null) name = this.Namespace + "." + name; @@ -53,6 +56,7 @@ private TypeIdentifierData ComputeTypeIdentifierData() // Check for type identifier attribute var typeIdentifierAttribute = this.GetDecodedCustomAttribute("System.Runtime.InteropServices", "TypeIdentifierAttribute"); + if (typeIdentifierAttribute.HasValue) { // If the type has a type identifier attribute it is always considered to be type equivalent @@ -68,28 +72,38 @@ private TypeIdentifierData ComputeTypeIdentifierData() if (typeIdentifierAttribute.Value.FixedArguments[1].Type != Context.GetWellKnownType(WellKnownType.String)) return null; - _data = new TypeIdentifierData((string)typeIdentifierAttribute.Value.FixedArguments[0].Value, (string)typeIdentifierAttribute.Value.FixedArguments[1].Value); - return _data; + return new TypeIdentifierData((string)typeIdentifierAttribute.Value.FixedArguments[0].Value, (string)typeIdentifierAttribute.Value.FixedArguments[1].Value); } - else + + // In addition to the TypeIdentifierAttribute certain other types may also be opted in to type equivalence + if (Context.SupportsCOMInterop) { - // In addition to the TypeIdentifierAttribute certain other types may also be opted in to type equivalence - if (Context.SupportsCOMInterop) + // 1. The assembly is marked with ImportedFromTypeLibAttribute or PrimaryInteropAssemblyAttribute + // We will verify this by checking for their attribute handles using the Metadata Reader. + + CustomAttributeHandle importedFromTypeLibHdl = this.MetadataReader.GetCustomAttributeHandle( + MetadataReader.GetAssemblyDefinition().GetCustomAttributes(), + "System.Runtime.InteropServices", + "ImportedFromTypeLibAttribute" + ); + + CustomAttributeHandle primaryInteropAssemblyHdl = this.MetadataReader.GetCustomAttributeHandle( + MetadataReader.GetAssemblyDefinition().GetCustomAttributes(), + "System.Runtime.InteropServices", + "PrimaryInteropAssemblyAttribute" + ); + + if (!importedFromTypeLibHdl.IsNil || !primaryInteropAssemblyHdl.IsNil) { - // 1. Type is within assembly marked with ImportedFromTypeLibAttribute or PrimaryInteropAssemblyAttribute - if (this.HasCustomAttribute("System.Runtime.InteropServices", "ImportedFromTypeLibAttribute") || this.HasCustomAttribute("System.Runtime.InteropServices", "PrimaryInteropAssemblyAttribute")) - { - // This type has a TypeIdentifier attribute if it has an appropriate shape to be considered type equivalent - } - + // This type has a TypeIdentifier attribute if it has an appropriate shape to be considered type equivalent if (!TypeHasCharacteristicsRequiredToBeTypeEquivalent) return null; - _data = ComputeTypeIdentifierFromGuids(); + return ComputeTypeIdentifierFromGuids(); } - - return null; } + + return null; } public override TypeIdentifierData TypeIdentifierData From 2f15b15de162ea03bcb8515907bc0eed24fc9ea4 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Wed, 21 Aug 2024 15:00:46 -0700 Subject: [PATCH 038/748] Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2519905 (#106714) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Carlos Sánchez López <1175054+carlossanlop@users.noreply.github.com> --- .../gen/Common/Resources/xlf/Strings.pl.xlf | 518 +++++++++--------- 1 file changed, 259 insertions(+), 259 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf index e2f7643bf88883..2405d7a821b9a9 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf @@ -4,7 +4,7 @@ Add 'GeneratedComClassAttribute' to enable passing objects of this type to COM and allow unsafe code - Add 'GeneratedComClassAttribute' to enable passing objects of this type to COM and allow unsafe code + Dodaj atrybut „GeneratedComClassAttributeâ€, aby umożliwić przekazywanie obiektów tego typu do modelu COM i zezwalać na niebezpieczny kod @@ -14,57 +14,57 @@ Add the 'GeneratedComClassAttribute' to '{0}' to enable passing objects of type '{0}' to COM - Add the 'GeneratedComClassAttribute' to '{0}' to enable passing objects of type '{0}' to COM + Dodaj atrybut „GeneratedComClassAttribute†do „{0}â€, aby umożliwić przekazywanie obiektów typu „{0}†do modelu COM Add 'GeneratedComClassAttribute' to enable passing objects of this type to COM - Add 'GeneratedComClassAttribute' to enable passing objects of this type to COM + Dodaj atrybut „GeneratedComClassAttributeâ€, aby umożliwić przekazywanie obiektów tego typu do modelu COM Add missing custom type marshaller members - Add missing custom type marshaller members + Dodaj brakujÄ…ce skÅ‚adowe elementu przeprowadzajÄ…cego marshalling typu niestandardowego The analysis required to generate code for this interface or method has failed due to an unexpected code pattern. If you are using new or unconventional syntax, consider using other syntax. - The analysis required to generate code for this interface or method has failed due to an unexpected code pattern. If you are using new or unconventional syntax, consider using other syntax. + Analiza wymagana do wygenerowania kodu dla tego interfejsu lub metody nie powiodÅ‚a siÄ™ z powodu nieoczekiwanego wzorca kodu. JeÅ›li używasz nowej skÅ‚adni lub nieszablonowej skÅ‚adni, rozważ użycie innej skÅ‚adni. Analysis of interface '{0}' has failed. ComInterfaceGenerator will not generate code for this interface. - Analysis of interface '{0}' has failed. ComInterfaceGenerator will not generate code for this interface. + Analiza interfejsu „{0}†nie powiodÅ‚a siÄ™. Element ComInterfaceGenerator nie wygeneruje kodu dla tego interfejsu. Analysis of method '{0}' has failed. ComInterfaceGenerator will not generate code for this method. - Analysis of method '{0}' has failed. ComInterfaceGenerator will not generate code for this method. + Analiza metody „{0}†nie powiodÅ‚a siÄ™. Element ComInterfaceGenerator nie wygeneruje kodu dla tej metody. Analysis for COM interface generation has failed. - Analysis for COM interface generation has failed. + Analiza generowania interfejsu COM nie powiodÅ‚a siÄ™. Marshalling an array from unmanaged to managed requires either the 'SizeParamIndex' or 'SizeConst' fields to be set on a 'MarshalAsAttribute' or the 'ConstantElementCount' or 'CountElementName' properties to be set on a 'MarshalUsingAttribute'. - Marshalling an array from unmanaged to managed requires either the 'SizeParamIndex' or 'SizeConst' fields to be set on a 'MarshalAsAttribute' or the 'ConstantElementCount' or 'CountElementName' properties to be set on a 'MarshalUsingAttribute'. + Skierowanie tablicy z niezarzÄ…dzanej do zarzÄ…dzanej wymaga ustawienia pól „SizeParamIndex†lub „SizeConst†we wÅ‚aÅ›ciwoÅ›ciach dla atrybutu„MarshalAsAttribute†lub wartoÅ›ci „ConstantElementCount†lub elementu „CountElementName†we wÅ‚aÅ›ciwoÅ›ciach dla atrybutu „MarshalUsingAttributeâ€. COM interface source generation requires all base COM interfaces to be valid interfaces. Fix any issues on the base interface to resolve this diagnostic. - COM interface source generation requires all base COM interfaces to be valid interfaces. Fix any issues on the base interface to resolve this diagnostic. + Generowanie źródÅ‚a interfejsu COM wymaga, aby wszystkie podstawowe interfejsy COM byÅ‚y prawidÅ‚owymi interfejsami. Rozwiąż wszelkie problemy z interfejsem podstawowym, aby rozwiÄ…zać ten problem diagnostyczny. COM interface {0} inherits from {1}, which has errors. ComInterfaceGenerator will not generate source for {0}. - COM interface {0} inherits from {1}, which has errors. ComInterfaceGenerator will not generate source for {0}. + Interfejs COM {0} dziedziczy po {1}, który zawiera błędy. Program ComInterfaceGenerator nie wygeneruje źródÅ‚a dla {0}. The base COM interface failed to generate source. Code will not be generated for this interface. - The base COM interface failed to generate source. Code will not be generated for this interface. + Podstawowy interfejs COM nie może wygenerować źródÅ‚a. Kod nie zostanie wygenerowany dla tego interfejsu. @@ -79,427 +79,427 @@ A 'GeneratedComInterface' cannot specify 'ComInterfaceOptions.ManagedObjectWrapper' or 'ComInterfaceOptions.ComObjectWrapper' unless the base interface type did not specify options or specified at least the same options. - A 'GeneratedComInterface' cannot specify 'ComInterfaceOptions.ManagedObjectWrapper' or 'ComInterfaceOptions.ComObjectWrapper' unless the base interface type did not specify options or specified at least the same options. + Element „GeneratedComInterface†nie może okreÅ›lać elementu „ComInterfaceOptions.ManagedObjectWrapper†lub „ComInterfaceOptions.ComObjectWrapperâ€, chyba że podstawowy typ interfejsu nie okreÅ›liÅ‚ opcji lub okreÅ›liÅ‚ co najmniej te same opcje. The specified parameter needs to be marshalled from managed to unmanaged and unmanaged to managed, but the marshaller type '{0}' does not support it. - The specified parameter needs to be marshalled from managed to unmanaged and unmanaged to managed, but the marshaller type '{0}' does not support it. + OkreÅ›lony parametr musi być kierowany z zarzÄ…dzanego do niezarzÄ…dzanego i niezarzÄ…dzanego do zarzÄ…dzanego, ale typ marszaÅ‚ka „{0}†go nie obsÅ‚uguje. When the 'Managed to Unmanaged with Caller-Allocated Buffer' shape is used by providing a 'FromManaged' method that takes a 'Span<T>' on the marshaller type, the type must provide a static 'BufferSize' property to provide the number of elements in the caller-allocated buffer. - When the 'Managed to Unmanaged with Caller-Allocated Buffer' shape is used by providing a 'FromManaged' method that takes a 'Span<T>' on the marshaller type, the type must provide a static 'BufferSize' property to provide the number of elements in the caller-allocated buffer. + Gdy ksztaÅ‚t „ZarzÄ…dzane do niezarzÄ…dzanego za pomocÄ… buforu przydzielonego przez wywoÅ‚ujÄ…cego†jest używany przez podanie metody „FromManagedâ€, która przyjmuje element „Span< T>†w typie marshallera, typ musi udostÄ™pniać statycznÄ… wÅ‚aÅ›ciwość „BufferSizeâ€, aby podać liczbÄ™ elementów w buforze przydzielonym przez wywoÅ‚ujÄ…cego. The marshaller type '{0}' must have a static read-only 'int' 'BufferSize' property to specify the size of the caller-allocated buffer because it has a FromManaged method that takes a caller-allocated 'Span<{1}>' - The marshaller type '{0}' must have a static read-only 'int' 'BufferSize' property to specify the size of the caller-allocated buffer because it has a FromManaged method that takes a caller-allocated 'Span<{1}>' + Typ marshallera „{0}†musi mieć statycznÄ… wÅ‚aÅ›ciwość „int†„BufferSize†tylko do odczytu, aby okreÅ›lić rozmiar buforu przydzielonego przez wywoÅ‚ujÄ…cego, ponieważ ma metodÄ™ FromManaged, która przyjmuje przydzielony przez wywoÅ‚ujÄ…cego element „Span<{1}>†The generated 'DllImportAttribute' will not have a value corresponding to '{0}'. - The generated 'DllImportAttribute' will not have a value corresponding to '{0}'. + Wygenerowany atrybut „DllImportAttribute†nie bÄ™dzie miaÅ‚ wartoÅ›ci odpowiadajÄ…cej elementowi „{0}â€. '{0}' has no equivalent in 'DllImportAttribute' and will not be forwarded - '{0}' has no equivalent in 'DllImportAttribute' and will not be forwarded + Element „{0}†nie ma odpowiednika w atrybucie „DllImportAtttribute†i nie zostanie przekazany Specified 'LibraryImportAttribute' arguments cannot be forwarded to 'DllImportAttribute' - Specified 'LibraryImportAttribute' arguments cannot be forwarded to 'DllImportAttribute' + OkreÅ›lonych argumentów „LibraryImportAttribute†nie można przekazać do elementu „DllImportAttribute†Casting between a 'ComImport' type and a source-generated COM type is not supported and will fail at runtime - Casting between a 'ComImport' type and a source-generated COM type is not supported and will fail at runtime + Rzutowanie miÄ™dzy typem „ComImport†i wygenerowanym przez źródÅ‚o typem COM nie jest obsÅ‚ugiwane i zakoÅ„czy siÄ™ niepowodzeniem w czasie wykonywania Casting between a 'ComImport' type and a source-generated COM type is not supported - Casting between a 'ComImport' type and a source-generated COM type is not supported + Rzutowanie miÄ™dzy typem „ComImport†i wygenerowanym przez źródÅ‚o typem COM nie jest obsÅ‚ugiwane Casting between a 'ComImport' type and a source-generated COM type is not supported - Casting between a 'ComImport' type and a source-generated COM type is not supported + Rzutowanie miÄ™dzy typem „ComImport†i wygenerowanym przez źródÅ‚o typem COM nie jest obsÅ‚ugiwane A class with 'GeneratedComClassAttribute' must implement at least one interface with 'GeneratedComInterfaceAttribute' or else the generated code with not have an effect. - A class with 'GeneratedComClassAttribute' must implement at least one interface with 'GeneratedComInterfaceAttribute' or else the generated code with not have an effect. + Klasa z atrybutem „GeneratedComClassAttribute†musi implementować co najmniej jeden interfejs z atrybutem „GeneratedComInterfaceAttributeâ€. W przeciwnym wypadku wygenerowany kod nie bÄ™dzie miaÅ‚ efektu. Class '{0}' with 'GeneratedComClassAttribute' does not implement any interfaces with 'GeneratedComInterfaceAttribute'. Source will not be generated for '{0}'. - Class '{0}' with 'GeneratedComClassAttribute' does not implement any interfaces with 'GeneratedComInterfaceAttribute'. Source will not be generated for '{0}'. + Klasa „{0}†z atrybutem „GeneratedComClassAttribute†nie implementuje żadnych interfejsów z atrybutem „GeneratedComInterfaceAttributeâ€. ŹródÅ‚o nie zostanie wygenerowane dla „{0}â€. The specified collection size parameter for an collection must be an integer type. If the size information is applied to a nested collection, the size parameter must be a collection of one less level of nesting with an integral element. - The specified collection size parameter for an collection must be an integer type. If the size information is applied to a nested collection, the size parameter must be a collection of one less level of nesting with an integral element. + OkreÅ›lony parametr rozmiaru kolekcji dla kolekcji musi być liczbÄ… caÅ‚kowitÄ…. JeÅ›li informacje o rozmiarze sÄ… stosowane do kolekcji zagnieżdżonej, parametr rozmiaru musi być kolekcjÄ… o jednym poziomie zagnieżdżenia mniej, o liczbie caÅ‚kowitej. .NET COM hosting with 'EnableComHosting' only supports built-in COM interop. It does not support source-generated COM interop with 'GeneratedComInterfaceAttribute'. - .NET COM hosting with 'EnableComHosting' only supports built-in COM interop. It does not support source-generated COM interop with 'GeneratedComInterfaceAttribute'. + Hosting modelu COM platformy .NET z elementem „EnableComHosting†obsÅ‚uguje tylko wbudowanÄ… usÅ‚ugÄ™ miÄ™dzyoperacyjnÄ… modelu COM. Nie obsÅ‚uguje usÅ‚ugi miÄ™dzyoperacyjnej modelu COM wygenerowanej przez źródÅ‚o przy użyciu atrybutu „GeneratedComInterfaceAttributeâ€. .NET COM hosting with 'EnableComHosting' does not support interfaces with the 'GeneratedComInterfaceAttribute'. Change any COM exposed interfaces implemented by '{0}' to use the 'System.Runtime.InteropServices.ComVisibleAttribute' instead - .NET COM hosting with 'EnableComHosting' does not support interfaces with the 'GeneratedComInterfaceAttribute'. Change any COM exposed interfaces implemented by '{0}' to use the 'System.Runtime.InteropServices.ComVisibleAttribute' instead + Hosting modelu COM platformy .NET z elementem „EnableComHosting†nie obsÅ‚uguje interfejsów z atrybutem „GeneratedComInterfaceAttributeâ€. ZmieÅ„ wszystkie interfejsy ujawnione przez model COM zaimplementowane przez „{0}â€, aby zamiast tego użyć atrybutu „System.Runtime.InteropServices.ComVisibleAttribute†.NET COM hosting with 'EnableComHosting' does not support interfaces with the 'GeneratedComInterfaceAttribute' - .NET COM hosting with 'EnableComHosting' does not support interfaces with the 'GeneratedComInterfaceAttribute' + Hosting modelu COM platformy .NET z elementem „EnableComHosting†nie obsÅ‚uguje interfejsów z atrybutem „GeneratedComInterfaceAttribute†The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0} - The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. {0} + Użycie atrybutu „GeneratedComInterfaceAttribute†nie jest zgodne z zaleceniami. {0} The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. - The usage of 'GeneratedComInterfaceAttribute' does not follow recommendations. + Użycie atrybutu „GeneratedComInterfaceAttribute†nie jest zgodne z zaleceniami. The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method. - The return value in the managed definition will be converted to an 'out' parameter when calling the unmanaged COM method. If the return value is intended to be the HRESULT code returned by the unmanaged COM method, use '[PreserveSig]' on the method. + Wartość zwracana w definicji zarzÄ…dzanej zostanie przekonwertowana na parametr „out†podczas wywoÅ‚ywania niezarzÄ…dzanej metody COM. JeÅ›li wartość zwracana ma być kodem HRESULT zwracanym przez niezarzÄ…dzanÄ… metodÄ™ COM, należy użyć „[PreserveSig]†w metodzie. The return value in the managed definition will be converted to an additional 'out' parameter at the end of the parameter list when calling the unmanaged COM method. - The return value in the managed definition will be converted to an additional 'out' parameter at the end of the parameter list when calling the unmanaged COM method. + Wartość zwracana w definicji zarzÄ…dzanej zostanie przekonwertowana na dodatkowy parametr „out†na koÅ„cu listy parametrów podczas wywoÅ‚ywania niezarzÄ…dzanej metody COM. Source-generated COM will ignore any configuration that is not supported. - Source-generated COM will ignore any configuration that is not supported. + COM wygenerowany przez źródÅ‚o zignoruje każdÄ… konfiguracjÄ™, która nie jest obsÅ‚ugiwana. Source-generated P/Invokes will ignore any configuration that is not supported. - Source-generated P/Invokes will ignore any configuration that is not supported. + Funkcja P/Invokes generowana przez źródÅ‚o zignoruje każdÄ… nieobsÅ‚ugiwanÄ… konfiguracjÄ™. The '{0}' configuration is not supported by source-generated COM. If the specified configuration is required, use `ComImport` instead. - The '{0}' configuration is not supported by source-generated COM. If the specified configuration is required, use `ComImport` instead. + Konfiguracja „{0}†nie jest obsÅ‚ugiwana przez COM generowany przez źródÅ‚o. JeÅ›li okreÅ›lona konfiguracja jest wymagana, użyj zamiast niej `ComImport`. The '{0}' configuration is not supported by source-generated P/Invokes. If the specified configuration is required, use a regular 'DllImport' instead. - The '{0}' configuration is not supported by source-generated P/Invokes. If the specified configuration is required, use a regular 'DllImport' instead. + Konfiguracja „{0}†nie jest obsÅ‚ugiwana przez funkcjÄ™ P/Invokes generowanÄ… przez źródÅ‚o. JeÅ›li okreÅ›lona konfiguracja jest wymagana, użyj zamiast tego zwykÅ‚ego elementu „DllImportâ€. The specified marshalling configuration is not supported by source-generated COM. {0}. - The specified marshalling configuration is not supported by source-generated COM. {0}. + OkreÅ›lona konfiguracja skierowania nie jest obsÅ‚ugiwana przez COM generowany źródÅ‚owo. {0}. The specified marshalling configuration is not supported by source-generated P/Invokes. {0}. - The specified marshalling configuration is not supported by source-generated P/Invokes. {0}. + OkreÅ›lona konfiguracja skierowania nie jest obsÅ‚ugiwana przez funkcjÄ™ P/Invokes generowanÄ… przez źródÅ‚o. {0}. The specified '{0}' configuration for parameter '{1}' is not supported by source-generated COM. If the specified configuration is required, use `ComImport` instead. - The specified '{0}' configuration for parameter '{1}' is not supported by source-generated COM. If the specified configuration is required, use `ComImport` instead. + OkreÅ›lona konfiguracja „{0}†dla parametru „{1}†nie jest obsÅ‚ugiwana przez COM generowany przez źródÅ‚o. JeÅ›li okreÅ›lona konfiguracja jest wymagana, użyj zamiast niej `ComImport`. The specified '{0}' configuration for parameter '{1}' is not supported by source-generated P/Invokes. If the specified configuration is required, use a regular 'DllImport' instead. - The specified '{0}' configuration for parameter '{1}' is not supported by source-generated P/Invokes. If the specified configuration is required, use a regular 'DllImport' instead. + OkreÅ›lona konfiguracja „{0}†dla parametru „{1}†nie jest obsÅ‚ugiwana przez funkcjÄ™ P/Invokes generowanÄ… przez źródÅ‚o. JeÅ›li okreÅ›lona konfiguracja jest wymagana, użyj zamiast tego zwykÅ‚ego elementu „DllImportâ€. The specified '{0}' configuration for the return value of method '{1}' is not supported by source-generated COM. If the specified configuration is required, use `ComImport` instead. - The specified '{0}' configuration for the return value of method '{1}' is not supported by source-generated COM. If the specified configuration is required, use `ComImport` instead. + OkreÅ›lona konfiguracja „{0}†dla wartoÅ›ci zwracanej metody „{1}†nie jest obsÅ‚ugiwana przez COM generowany przez źródÅ‚o. JeÅ›li okreÅ›lona konfiguracja jest wymagana, użyj zamiast niej `ComImport`. The specified '{0}' configuration for the return value of method '{1}' is not supported by source-generated P/Invokes. If the specified configuration is required, use a regular 'DllImport' instead. - The specified '{0}' configuration for the return value of method '{1}' is not supported by source-generated P/Invokes. If the specified configuration is required, use a regular 'DllImport' instead. + OkreÅ›lona konfiguracja „{0}†dla wartoÅ›ci zwracanej metody „{1}†nie jest obsÅ‚ugiwana przez funkcjÄ™ P/Invokes generowanÄ… przez źródÅ‚o. JeÅ›li okreÅ›lona konfiguracja jest wymagana, użyj zamiast tego zwykÅ‚ego elementu „DllImportâ€. The specified value '{0}' for '{1}' is not supported by source-generated COM. If the specified configuration is required, use `ComImport` instead. - The specified value '{0}' for '{1}' is not supported by source-generated COM. If the specified configuration is required, use `ComImport` instead. + OkreÅ›lona wartość „{0}†dla „{1}†nie jest obsÅ‚ugiwana przez COM generowany przez źródÅ‚o. JeÅ›li okreÅ›lona konfiguracja jest wymagana, użyj zamiast niej `ComImport`. The specified value '{0}' for '{1}' is not supported by source-generated P/Invokes. If the specified value is required, use a regular 'DllImport' instead. - The specified value '{0}' for '{1}' is not supported by source-generated P/Invokes. If the specified value is required, use a regular 'DllImport' instead. + OkreÅ›lona wartość „{0}†dla parametru „{1}†nie jest obsÅ‚ugiwana przez funkcjÄ™ P/Invokes generowanÄ… przez źródÅ‚o. JeÅ›li okreÅ›lona konfiguracja jest wymagana, użyj zamiast tego zwykÅ‚ego elementu „DllImportâ€. Specified configuration is not supported by source-generated COM. - Specified configuration is not supported by source-generated COM. + OkreÅ›lona konfiguracja nie jest obsÅ‚ugiwana przez COM wygenerowany przez źródÅ‚o. Specified configuration is not supported by source-generated P/Invokes. - Specified configuration is not supported by source-generated P/Invokes. + OkreÅ›lona konfiguracja nie jest obsÅ‚ugiwana przez funkcjÄ™ P/Invokes generowanÄ… przez źródÅ‚o. Only one of 'ConstantElementCount' or 'ElementCountInfo' may be used in a 'MarshalUsingAttribute' for a given 'ElementIndirectionDepth' - Only one of 'ConstantElementCount' or 'ElementCountInfo' may be used in a 'MarshalUsingAttribute' for a given 'ElementIndirectionDepth' + Tylko jedna z wartoÅ›ci „ConstantElementCount†lub element „ElementCountInfo†może być użyty w atrybucie „MarshalUsingAttribute†dla danego elementu „ElementIndirectionDepth†Containing type '{0}' has accessibility '{1}'. - Containing type '{0}' has accessibility '{1}'. + ZawierajÄ…cy typ „{0}†ma uÅ‚atwienia dostÄ™pu „{1}â€. Converting this interface to use 'GeneratedComInterfaceAttribute' may produce invalid code and may require additional work - Converting this interface to use 'GeneratedComInterfaceAttribute' may produce invalid code and may require additional work + Przekonwertowanie tego interfejsu w celu użycia atrybutu „GeneratedComInterfaceAttribute†może spowodować wygenerowanie nieprawidÅ‚owego kodu i może wymagać dodatkowej pracy Automatically converting a P/Invoke with 'PreserveSig' set to 'false' to a source-generated P/Invoke may produce invalid code - Automatically converting a P/Invoke with 'PreserveSig' set to 'false' to a source-generated P/Invoke may produce invalid code + Automatyczne konwertowanie funkcji P/Invoke z parametrem „PreserveSig†ustawionym na wartość „false†na wygenerowanÄ… przez źródÅ‚o funkcjÄ™ P/Invoke może spowodować utworzenie nieprawidÅ‚owego kodu Convert to 'GeneratedComInterface' and allow unsafe code - Convert to 'GeneratedComInterface' and allow unsafe code + Konwertuj na element „GeneratedComInterface†i zezwalaj na niebezpieczny kod Use 'GeneratedComInterfaceAttribute' instead of 'ComImportAttribute' to generate COM marshalling code at compile time - Use 'GeneratedComInterfaceAttribute' instead of 'ComImportAttribute' to generate COM marshalling code at compile time + Użyj atrybutu „GeneratedComInterfaceAttribute†zamiast „ComImportAttributeâ€, aby wygenerować kod marshallingu modelu COM w czasie kompilacji Converting this API to 'GeneratedComInterfaceAttribute' will require additional code to provide custom marshallers for some parameters. - Converting this API to 'GeneratedComInterfaceAttribute' will require additional code to provide custom marshallers for some parameters. + Przekonwertowanie tego interfejsu API na atrybut „GeneratedComInterfaceAttribute†bÄ™dzie wymagać dodatkowego kodu w celu udostÄ™pnienia niestandardowych organizatorów dla niektórych parametrów. Mark the type '{0}' with 'GeneratedComInterfaceAttribute' instead of 'ComImportAttribute' to generate COM marshalling code at compile time - Mark the type '{0}' with 'GeneratedComInterfaceAttribute' instead of 'ComImportAttribute' to generate COM marshalling code at compile time + Oznacz typ „{0}†atrybutem „GeneratedComInterfaceAttribute†zamiast „ComImportAttributeâ€, aby wygenerować kod marshallingu modelu COM w czasie kompilacji Convert to 'GeneratedComInterface' - Convert to 'GeneratedComInterface' + Konwertowanie na element „GeneratedComInterface†Convert to 'LibraryImport' - Convert to 'LibraryImport' + Konwertuj na element „LibraryImport†Convert to 'LibraryImport' and enable unsafe code - Convert to 'LibraryImport' and enable unsafe code + Konwertuj na element „LibraryImport†i włącz niebezpieczny kod Use 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time - Use 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time + Użyj elementu „LibraryImportAttribute†zamiast elementu „DllImportAttributeâ€, aby wygenerować kod skierowania funkcji P/Invoke w czasie kompilacji Converting this API to 'LibraryImport' will require additional code to provide custom marshallers for some parameters. - Converting this API to 'LibraryImport' will require additional code to provide custom marshallers for some parameters. + Przekonwertowanie tego interfejsu API na element „LibraryImport†bÄ™dzie wymagać dodatkowego kodu w celu udostÄ™pnienia niestandardowych poleceÅ„ dla niektórych parametrów. Mark the method '{0}' with 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time - Mark the method '{0}' with 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time + Oznacz metodÄ™ „{0}†za pomocÄ… elementu „LibraryImportAttribute†zamiast elementu „DllImportAttributeâ€, aby wygenerować kod skierowania funkcji P/Invoke w czasie kompilacji Use 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time - Use 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time + Użyj elementu „LibraryImportAttribute†zamiast elementu „DllImportAttributeâ€, aby wygenerować kod skierowania funkcji P/Invoke w czasie kompilacji Convert to 'LibraryImport' with '{0}' suffix - Convert to 'LibraryImport' with '{0}' suffix + Konwertuj na element „LibraryImport†z sufiksem „{0}†Convert to 'LibraryImport' with '{0}' suffix and enable unsafe code - Convert to 'LibraryImport' with '{0}' suffix and enable unsafe code + Konwertuj na element „LibraryImport†z sufiksem „{0}†i włącz niebezpieczny kod Marshaller type does not have the required shape - Marshaller type does not have the required shape + Typ marshallera nie ma wymaganego ksztaÅ‚tu This element cannot depend on '{0}' for collection size information without creating a dependency cycle - This element cannot depend on '{0}' for collection size information without creating a dependency cycle + Ten element nie może zależeć od elementu „{0}†dla informacji o rozmiarze kolekcji bez tworzenia cyklu zależnoÅ›ci Count information for a given element at a given indirection level can only be specified once - Count information for a given element at a given indirection level can only be specified once + Informacje o liczbie dla danego elementu na danym poziomie poÅ›rednim można podać tylko raz Multiple marshalling attributes per element per indirection level is unsupported, but duplicate information was provided for indirection level {0} - Multiple marshalling attributes per element per indirection level is unsupported, but duplicate information was provided for indirection level {0} + Wiele atrybutów skierowania na element na poziomie poÅ›rednim nie jest obsÅ‚ugiwanych, ale podano zduplikowane informacje dla poziomu poÅ›redniego {0} A marshaller for an element scenario cannot be stateful. - A marshaller for an element scenario cannot be stateful. + Marshaller dla scenariusza elementu nie może być stanowy. The specified marshaller type '{0}' is a stateful marshaller, but stateful marshallers are not allowed in the provided marshal mode '{1}' - The specified marshaller type '{0}' is a stateful marshaller, but stateful marshallers are not allowed in the provided marshal mode '{1}' + OkreÅ›lony typ marshallera „{0}†jest stanowym marshallerem, ale stanowe marshallery nie sÄ… dozwolone w podanym trybie marshalingu „{1}†The element type of the span returned by the first method must be the same type as the element type of the span returned by the second method. - The element type of the span returned by the first method must be the same type as the element type of the span returned by the second method. + Typ elementu zakresu zwracanego przez pierwszÄ… metodÄ™ musi być tego samego typu co typ elementu zakresu zwracanego przez drugÄ… metodÄ™. The element type of the span returned by '{0}' must be the same type as the element type of the span returned by '{1}'. - The element type of the span returned by '{0}' must be the same type as the element type of the span returned by '{1}'. + Typ elementu zakresu zwracanego przez „{0}†musi być tego samego typu co typ elementu zakresu zwracanego przez „{1}â€. An entry-point type for marshalling a given type must not be 'null'. - An entry-point type for marshalling a given type must not be 'null'. + Typ punktu wejÅ›cia do przeprowadzenia marshalingu danego typu nie może mieć wartoÅ›ci „nullâ€. The entry-point marshaller type for the type '{0}' must be not 'null' - The entry-point marshaller type for the type '{0}' must be not 'null' + Typ marshallera punktu wejÅ›cia dla typu „{0}†nie może mieć wartoÅ›ci „null†An entry-point type for marshalling a given type must have a 'System.Runtime.InteropServices.CustomMarshallerAttribute' that specifies this type as the managed type. - An entry-point type for marshalling a given type must have a 'System.Runtime.InteropServices.CustomMarshallerAttribute' that specifies this type as the managed type. + Typ punktu wejÅ›cia do przeprowadzenia marshalingu danego typu musi mieć atrybut „System.Runtime.InteropServices.CustomMarshaellerAttributeâ€, który okreÅ›la ten typ jako typ zarzÄ…dzany. The entry-point marshaller type '{0}' for the type '{1}' must be a type with at least one 'System.Runtime.InteropServices.CustomMarshallerAttribute' that specifies this type as the managed type - The entry-point marshaller type '{0}' for the type '{1}' must be a type with at least one 'System.Runtime.InteropServices.CustomMarshallerAttribute' that specifies this type as the managed type + Typ marshallera punktu wejÅ›cia „{0}†dla typu „{1}†musi być typem z co najmniej jednym atrybutem „System.Runtime.InteropServices.CustomMarshaellerAttributeâ€, który okreÅ›la ten typ jako typ zarzÄ…dzany Marshalling info was specified for 'ElementIndirectionDepth' {0}, but marshalling info was only needed for {1} level(s) of indirection - Marshalling info was specified for 'ElementIndirectionDepth' {0}, but marshalling info was only needed for {1} level(s) of indirection + Informacje dotyczÄ…ce skierowania zostaÅ‚y okreÅ›lone dla elementu „ElementIndirectionDepth†{0}, ale informacje dotyczÄ…ce skierowania byÅ‚y potrzebne tylko dla poziomów poÅ›rednich w liczbie {1} The first parameter of the first method must be the same type as the return types of the second method. - The first parameter of the first method must be the same type as the return types of the second method. + Pierwszy parametr pierwszej metody musi być tego samego typu co zwracane typy drugiej metody. The first parameter of '{0}' must be the same type as the return type of '{1}' - The first parameter of '{0}' must be the same type as the return type of '{1}' + Pierwszy parametr „{0}†musi być tego samego typu co zwracany typ „{1}†The first parameters of the two methods must be the same type. - The first parameters of the two methods must be the same type. + Pierwsze parametry obu tych metod muszÄ… być tego samego typu. The first parameter of '{0}' and '{1}' must be the same type - The first parameter of '{0}' and '{1}' must be the same type + Pierwszy parametr „{0}†i „{1}†musi być tego samego typu Overloading the 'FromUnmanaged' method is unuspported as some shapes are unable to distinguish between overloads. - Overloading the 'FromUnmanaged' method is unuspported as some shapes are unable to distinguish between overloads. + Przeciążenie metody „FromUnmanaged†nie jest obsÅ‚ugiwane, ponieważ niektóre ksztaÅ‚ty nie mogÄ… rozróżnić przeciążeÅ„. The type '{0}' overloads the 'FromUnmanaged' method, which is not supported in custom marshallers - The type '{0}' overloads the 'FromUnmanaged' method, which is not supported in custom marshallers + Typ „{0}†przeciąża metodÄ™ „ZNiezarzÄ…dzaneâ€, która nie jest obsÅ‚ugiwana w niestandardowych marshalerach The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' must match the base COM interface. - The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' must match the base COM interface. + Konfiguracja elementów „StringMarssourceing†i „StringMarsxtingCustomType†musi być zgodna z podstawowym interfejsem COM. The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. - The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. + Typ marshallera musi być zamkniÄ™tym typem ogólnym lub mieć takÄ… samÄ… liczbÄ™ parametrów ogólnych jak typ zarzÄ…dzany, aby emitowany kod mógÅ‚ używać okreÅ›lonego wystÄ…pienia. The marshaller type '{0}' for managed type '{1}' must be a closed generic type, have the same arity as the managed type if it is a value marshaller, or have one additional generic parameter if it is a collection marshaller. - The marshaller type '{0}' for managed type '{1}' must be a closed generic type, have the same arity as the managed type if it is a value marshaller, or have one additional generic parameter if it is a collection marshaller. + Typ marshallera „{0}†dla typu zarzÄ…dzanego „{1}†musi być zamkniÄ™tym typem ogólnym, mieć takÄ… samÄ… argumentacjÄ™ jak typ zarzÄ…dzany, jeÅ›li jest to marshaller wartoÅ›ci lub mieć jeden dodatkowy parametr ogólny, jeÅ›li jest to marshaller kolekcji. The return type of 'GetPinnableReference' (after accounting for 'ref') must be blittable. - The return type of 'GetPinnableReference' (after accounting for 'ref') must be blittable. + Zwracany typ elementu „GetPinnableReference†(po uwzglÄ™dnieniu wartoÅ›ci „refâ€) musi być kopiowalny. The dereferenced type of the return type of the 'GetPinnableReference' method must be blittable - The dereferenced type of the return type of the 'GetPinnableReference' method must be blittable + Typ, do którego nie można usunąć odwoÅ‚ania, zwracanego typu metody „GetPinnableReference†musi być kopiowalny The provided graph has cycles and cannot be topologically sorted. - The provided graph has cycles and cannot be topologically sorted. + Podany wykres zawiera cykle i nie można go posortować topologicznie. The type '{0}' will be treated as a struct in the native signature, not as a native HRESULT. To treat this as an HRESULT, add '[return:MarshalAs(UnmanagedType.Error)]' to the method. - The type '{0}' will be treated as a struct in the native signature, not as a native HRESULT. To treat this as an HRESULT, add '[return:MarshalAs(UnmanagedType.Error)]' to the method. + Typ „{0}†bÄ™dzie traktowany jako struktura w podpisie natywnym, a nie jako natywny wynik HRESULT. Aby traktować to jako HRESULT, dodaj element „[return:MarshalAs(UnmanagedType.Error)]†do metody. This type will be treated as a struct in the native signature, not as a native HRESULT - This type will be treated as a struct in the native signature, not as a native HRESULT + Ten typ bÄ™dzie traktowany jako struktura w podpisie natywnym, a nie jako natywny wynik HRESULT The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default. - The '[In]' attribute is only supported on array parameters. By-value parameters are considered read-only by default. + Atrybut „[In]†jest obsÅ‚ugiwany tylko w przypadku parametrów tablicy. Parametry wedÅ‚ug wartoÅ›ci sÄ… domyÅ›lnie uznawane za tylko do odczytu. The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only. - The '[In]' attribute is not supported unless the '[Out]' attribute is also used. Blittable arrays cannot be marshalled as '[In]' only. + Atrybut „[In]†nie jest obsÅ‚ugiwany, chyba że używany jest również atrybut „[Out]â€. Tablice kopiowalne nie mogÄ… być kierowane tylko jako „[In]â€. The '[In]' attribute is not necessary unless the '[Out]' attribute is also used. The behavior of the '[In]' attribute without the '[Out]' attribute is the same as the default behavior. - The '[In]' attribute is not necessary unless the '[Out]' attribute is also used. The behavior of the '[In]' attribute without the '[Out]' attribute is the same as the default behavior. + Atrybut „[In]†nie jest potrzebny, chyba że używany jest również atrybut „[Out]â€. Zachowanie atrybutu „[In]†bez atrybutu „[Out]†jest takie samo jak zachowanie domyÅ›lne. The '[In]' and '[Out]' attributes are unsupported on parameters passed by reference. Use the 'in', 'ref', or 'out' keywords instead. - The '[In]' and '[Out]' attributes are unsupported on parameters passed by reference. Use the 'in', 'ref', or 'out' keywords instead. + Atrybuty „[In]†i „[Out]†nie sÄ… obsÅ‚ugiwane w parametrach przekazywanych przez odwoÅ‚anie. Zamiast tego użyj słów kluczowych „inâ€, „ref†lub „outâ€. The provided '[In]' and '[Out]' attributes on this parameter are unsupported on this parameter. - The provided '[In]' and '[Out]' attributes on this parameter are unsupported on this parameter. + Podane atrybuty „[In]†i „[Out]†w tym parametrze nie sÄ… obsÅ‚ugiwane w tym parametrze. The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable. - The '[In]' and '[Out]' attributes are only supported on array parameters. Consider using the 'ref' keyword to make the parameter mutable. + Atrybuty „[In]†i „[Out]†sÄ… obsÅ‚ugiwane tylko w przypadku parametrów tablicy. Rozważ użycie sÅ‚owa kluczowego „refâ€, aby umożliwić modyfikowanie parametru. [In] and [Out] attributes - [In] and [Out] attributes + Atrybuty [In] i [Out] @@ -509,814 +509,814 @@ Events are not a concept in COM, so no interop code will be source generated for instance events on source-generated COM interfaces. - Events are not a concept in COM, so no interop code will be source generated for instance events on source-generated COM interfaces. + Zdarzenia nie sÄ… koncepcjÄ… w modelu COM, wiÄ™c żaden kod miÄ™dzyoperacyjny nie bÄ™dzie generowany dla zdarzeÅ„ wystÄ…pieÅ„ w interfejsach COM generowanych źródÅ‚owo. The instance event '{0}' is declared in the interface '{1}', which has the 'GeneratedComInterfaceAttribute' applied - The instance event '{0}' is declared in the interface '{1}', which has the 'GeneratedComInterfaceAttribute' applied + Zdarzenie wystÄ…pienia „{0}†jest zadeklarowane w interfejsie „{1}â€, w którym zastosowano atrybut „GeneratedComInterfaceAttribute†Declaring an instance event in a type with the 'GeneratedComInterfaceAttribute' is not supported - Declaring an instance event in a type with the 'GeneratedComInterfaceAttribute' is not supported + Deklarowanie zdarzenia wystÄ…pienia w typie z atrybutem „GeneratedComInterfaceAttribute†nie jest obsÅ‚ugiwane Properties are not a concept in COM, so no interop code will be source generated for instance properties on source-generated COM interfaces. - Properties are not a concept in COM, so no interop code will be source generated for instance properties on source-generated COM interfaces. + Te wÅ‚aÅ›ciwoÅ›ci nie sÄ… koncepcjÄ… w modelu COM, dlatego nie zostanie wygenerowany kod miÄ™dzyoperacyjny dla wÅ‚aÅ›ciwoÅ›ci wystÄ…pienia w interfejsach COM generowanych źródÅ‚owo. The instance property '{0}' is declared in the interface '{1}', which has the 'GeneratedComInterfaceAttribute' applied - The instance property '{0}' is declared in the interface '{1}', which has the 'GeneratedComInterfaceAttribute' applied + WÅ‚aÅ›ciwość wystÄ…pienia „{0}†jest zadeklarowana w interfejsie „{1}â€, do którego zastosowano atrybut „GeneratedComInterfaceAttribute†Declaring an instance property in a type with the 'GeneratedComInterfaceAttribute' is not supported - Declaring an instance property in a type with the 'GeneratedComInterfaceAttribute' is not supported + Deklarowanie wÅ‚aÅ›ciwoÅ›ci wystÄ…pienia w typie z atrybutem „GeneratedComInterfaceAttribute†nie jest obsÅ‚ugiwane Using 'GeneratedComInterfaceAttribute' and 'InterfaceTypeAttribute' is not supported with 'ComInterfaceType' value '{0}'. - Using 'GeneratedComInterfaceAttribute' and 'InterfaceTypeAttribute' is not supported with 'ComInterfaceType' value '{0}'. + Użycie atrybutów „GeneratedComInterfaceAttribute†i „InterfaceTypeAttribute†nie jest obsÅ‚ugiwane w przypadku wartoÅ›ci „ComInterfaceType†„{0}â€. 'GeneratedComInterfaceType' does not support the 'ComInterfaceType' value supplied to 'InterfaceTypeAttribute' on the same type. - 'GeneratedComInterfaceType' does not support the 'ComInterfaceType' value supplied to 'InterfaceTypeAttribute' on the same type. + Typ „GeneratedComInterfaceType†nie obsÅ‚uguje wartoÅ›ci „ComInterfaceType†dostarczonej do atrybutu „InterfaceTypeAttribute†w tym samym typie. Method '{0}' is contained in a type '{1}' that is not marked 'partial'. COM source generation will ignore method '{0}'. - Method '{0}' is contained in a type '{1}' that is not marked 'partial'. COM source generation will ignore method '{0}'. + Metoda „{0}†jest zawarta w typie „{1}â€, który nie jest oznaczony jako „częściowyâ€. Generowanie źródÅ‚a COM zignoruje metodÄ™ „{0}â€. Method '{0}' is contained in a type '{1}' that is not marked 'partial'. P/Invoke source generation will ignore method '{0}'. - Method '{0}' is contained in a type '{1}' that is not marked 'partial'. P/Invoke source generation will ignore method '{0}'. + Metoda „{0}†jest zawarta w typie „{1}â€, który nie jest oznaczony jako „częściowyâ€. Generowanie źródÅ‚a funkcji P/Invoke zignoruje metodÄ™ „{0}â€. Containing type of method with VirtualMethodIndexAttribute does not have a UnmanagedObjectUnwrapperAttribute. - Containing type of method with VirtualMethodIndexAttribute does not have a UnmanagedObjectUnwrapperAttribute. + Zawieranie typu metody z atrybutem VirtualMethodIndexAttribute nie ma atrybutu UnmanagedObjectUnwrapperAttribute. Methods on interfaces marked with 'GeneratedComInterfaceAttribute' should be non-generic. COM source generation will ignore methods that are generic. - Methods on interfaces marked with 'GeneratedComInterfaceAttribute' should be non-generic. COM source generation will ignore methods that are generic. + Metody w interfejsach oznaczone atrybutem „GeneratedComInterfaceAttribute†powinny być nie-ogólne. Generowanie źródÅ‚a COM zignoruje metody, które sÄ… ogólne. Methods marked with 'LibraryImportAttribute' should be 'static', 'partial', and non-generic. P/Invoke source generation will ignore methods that are non-'static', non-'partial', or generic. - Methods marked with 'LibraryImportAttribute' should be 'static', 'partial', and non-generic. P/Invoke source generation will ignore methods that are non-'static', non-'partial', or generic. + Metody oznaczone jako atrybut „LibraryImportAttribute†powinny być „statyczneâ€, „częściowe†i nieogólne. Generowanie źródÅ‚a funkcji P/Invoke zignoruje metody, które nie sÄ… „statyczneâ€, nie sÄ… „częściowe†lub ogólne. Method '{0}' should be non-generic when on interfaces marked with the 'GeneratedComInterfaceAttribute'. COM source generation will ignore method '{0}'. - Method '{0}' should be non-generic when on interfaces marked with the 'GeneratedComInterfaceAttribute'. COM source generation will ignore method '{0}'. + Metoda „{0}†powinna być nie-ogólna w interfejsach oznaczonych atrybutem „GeneratedComInterfaceAttributeâ€. Generowanie źródÅ‚a COM zignoruje metodÄ™ „{0}â€. Method '{0}' should be 'static', 'partial', and non-generic when marked with 'LibraryImportAttribute'. P/Invoke source generation will ignore method '{0}'. - Method '{0}' should be 'static', 'partial', and non-generic when marked with 'LibraryImportAttribute'. P/Invoke source generation will ignore method '{0}'. + Metoda „{0}†powinna być „statycznaâ€, „częściowa†i nieogólna, gdy jest oznaczona za pomocÄ… atrybutu „LibraryImportAttributeâ€. Generowanie źródÅ‚a funkcji P/Invoke zignoruje metodÄ™ „{0}â€. Invalid 'CustomMarshallerAttribute' usage - Invalid 'CustomMarshallerAttribute' usage + NieprawidÅ‚owe użycie atrybutu „CustomMarshallerAttribute†The configuration of 'ExceptionMarshalling' and 'ExceptionMarshallingCustomType' is invalid. - The configuration of 'ExceptionMarshalling' and 'ExceptionMarshallingCustomType' is invalid. + Konfiguracja elementów „ExceptionMarshalling†i „ExceptionMarshallingCustomType†jest nieprawidÅ‚owa. The configuration of 'ExceptionMarshalling' and 'ExceptionMarshallingCustomType' on method '{0}' is invalid. {1} - The configuration of 'ExceptionMarshalling' and 'ExceptionMarshallingCustomType' on method '{0}' is invalid. {1} + Konfiguracja elementów „ExceptionMarshalling†i „ExceptionMarshallingCustomType†w metodzie „{0}†jest nieprawidÅ‚owa. {1} {1} is a message containing additional details about what is not valid 'ExceptionMarshallingCustomType' must be specified when 'ExceptionMarshalling' is set to 'ExceptionMarshalling.Custom'. - 'ExceptionMarshallingCustomType' must be specified when 'ExceptionMarshalling' is set to 'ExceptionMarshalling.Custom'. + Element „ExceptionMarshallingCustomType†musi być okreÅ›lony kiedy „ExceptionMarshalling†jest ustawiony na „ExceptionMarshalling.Customâ€. 'ExceptionMarshalling' should be set to 'ExceptionMarshalling.Custom' when 'ExceptionMarshallingCustomType' is specified. - 'ExceptionMarshalling' should be set to 'ExceptionMarshalling.Custom' when 'ExceptionMarshallingCustomType' is specified. + Element „ExceptionMarshalling†powinien być ustawiony na „ExceptionMarshalling.Custom†kiedy typ „ExceptionMarshallingCustomType†jest okreÅ›lony. The provided value is not a known flag of the 'ExceptionMarshalling' enum. - The provided value is not a known flag of the 'ExceptionMarshalling' enum. + Podana wartość nie jest znanÄ… flagÄ… wyliczenia „'ExceptionMarshallingâ€. Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. - Classes with 'GeneratedComClassAttribute' must implement one or more interfaces with 'GeneratedComInterfaceAttribute', be marked partial, and be non-generic. + Klasy z atrybutem „GeneratedComClassAttribute†muszÄ… implementować co najmniej jeden interfejs z atrybutem „GeneratedComInterfaceAttributeâ€, być oznaczone jako częściowe i nie być ogólne. Class '{0}' with 'GeneratedComClassAttribute' or one of its containing types is not marked 'partial'. - Class '{0}' with 'GeneratedComClassAttribute' or one of its containing types is not marked 'partial'. + Klasa „{0}†z atrybutem „GeneratedComClassAttribute†lub jeden z jej typów zawierajÄ…cych nie jest oznaczony jako „częściowyâ€. Invalid 'GeneratedComClassAttribute' usage - Invalid 'GeneratedComClassAttribute' usage + NieprawidÅ‚owe użycie elementu „GeneratedComClassAttribute†Interfaces attributed with 'GeneratedComInterfaceAttribute' must have 'public' or 'internal' accessibility and be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. - Interfaces attributed with 'GeneratedComInterfaceAttribute' must have 'public' or 'internal' accessibility and be partial, non-generic, and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'. + Interfejsy z atrybutem „GeneratedComInterfaceAttribute†muszÄ… mieć uÅ‚atwienia dostÄ™pu „publiczny†lub „wewnÄ™trznyâ€, muszÄ… być częściowe, nie być ogóle, i muszÄ… okreÅ›lać identyfikator GUID z atrybutem „System.Runtime.InteropServices.GuidAttributeâ€. Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is generic. - Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is generic. + Interfejs „{0}†ma atrybut „GeneratedComInterfaceAttributeâ€, ale jest ogólny. Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is not accessible by generated code. The interface and all containing types must have accessibility 'internal' or 'public' for generated code to access it. {1} - Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is not accessible by generated code. The interface and all containing types must have accessibility 'internal' or 'public' for generated code to access it. {1} + Interfejs „{0}†ma atrybut „GeneratedComInterfaceAttributeâ€, ale nie jest dostÄ™pny za pomocÄ… wygenerowanego kodu. Interfejs i wszystkie zawierajÄ…ce go typy muszÄ… mieć uÅ‚atwienia dostÄ™pu „wewnÄ™trzny†lub „publicznyâ€, aby wygenerowany kod mógÅ‚ uzyskać do niego dostÄ™p. {1} {1} is details about which type/containing type is not accessible Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'. - Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'. + Interfejs „{0}†ma atrybut „GeneratedComInterfaceAttributeâ€, ale brakuje atrybutu „System.Runtime.InteropServices.GuidAttributeâ€. Invalid 'GeneratedComInterfaceAttribute' usage. - Invalid 'GeneratedComInterfaceAttribute' usage. + NieprawidÅ‚owe użycie atrybutu „GeneratedComInterfaceAttributeâ€. The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. - The interface '{0}' or one of its containing types is missing the 'partial' keyword. Code will not be generated for '{0}'. + W interfejsie „{0}†lub jednym z jego typów zawierajÄ…cych brakuje sÅ‚owa kluczowego „partialâ€. Kod nie zostanie wygenerowany dla „{0}â€. Invalid 'LibraryImportAttribute' usage - Invalid 'LibraryImportAttribute' usage + NieprawidÅ‚owe użycie atrybutu „LibraryImportAttribute†Specified managed type is invalid - Specified managed type is invalid + OkreÅ›lony typ zarzÄ…dzany jest nieprawidÅ‚owy Invalid 'MarshalMode' value. - Invalid 'MarshalMode' value. + NieprawidÅ‚owa wartość „MarshalModeâ€. Specified marshaller type is invalid - Specified marshaller type is invalid + OkreÅ›lony typ marshallera jest nieprawidÅ‚owy Invalid 'NativeMarshallingAttribute' usage - Invalid 'NativeMarshallingAttribute' usage + NieprawidÅ‚owe użycie atrybutu „NativeMarshallingAttribute†The specified 'ComInterfaceOptions' are invalid. - The specified 'ComInterfaceOptions' are invalid. + OkreÅ›lone opcje „ComInterfaceOptions†sÄ… nieprawidÅ‚owe. The specified 'ComInterfaceOptions' on '{0}' are invalid. {1} - The specified 'ComInterfaceOptions' on '{0}' are invalid. {1} + OkreÅ›lone opcje „ComInterfaceOptions†w „{0}†sÄ… nieprawidÅ‚owe. {1} Marshaller type has incompatible method signatures - Marshaller type has incompatible method signatures + Typ marshallera ma niezgodne sygnatury metody The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. - The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid. + Konfiguracja elementów „StringMarshalling†i „StringMarshallingCustomType†jest nieprawidÅ‚owa. The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' on interface '{0}' is invalid. {1} - The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' on interface '{0}' is invalid. {1} + Konfiguracja elementów „StringMarshalling†i „StringMarshallingCustomType†w interfejsie „{0}†jest nieprawidÅ‚owa. {1} {1} is a message containing additional details about what is not valid The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' on method '{0}' is invalid. {1} - The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' on method '{0}' is invalid. {1} + Konfiguracja elementów „StringMarshalling†i „StringMarshallingCustomType†w metodzie „{0}†jest nieprawidÅ‚owa. {1} {1} is a message containing additional details about what is not valid 'StringMarshallingCustomType' must be specified when 'StringMarshalling' is set to 'StringMarshalling.Custom'. - 'StringMarshallingCustomType' must be specified when 'StringMarshalling' is set to 'StringMarshalling.Custom'. + Element „StringMarshallingCustomType†należy okreÅ›lić, gdy element „StringMarshalling†ma wartość „StringMarshalling.Customâ€. 'StringMarshalling' should be set to 'StringMarshalling.Custom' when 'StringMarshallingCustomType' is specified. - 'StringMarshalling' should be set to 'StringMarshalling.Custom' when 'StringMarshallingCustomType' is specified. + Element „StringMarshalling†należy ustawić na wartość „StringMarshalling.Customâ€, gdy okreÅ›lono element „StringMarshallingCustomTypeâ€. The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' on interface '{0}' is invalid. {1} - The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' on interface '{0}' is invalid. {1} + Konfiguracja elementów „StringMarshalling†i „StringMarshallingCustomType†w interfejsie „{0}†jest nieprawidÅ‚owa. {1} The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' on method '{0}' is invalid. {1} - The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' on method '{0}' is invalid. {1} + Konfiguracja elementów „StringMarshalling†i „StringMarshallingCustomType†w metodzie „{0}†jest nieprawidÅ‚owa. {1} {1} is a message containing additional details about what is not valid Invalid 'VirtualMethodIndexAttribute' usage - Invalid 'VirtualMethodIndexAttribute' usage + NieprawidÅ‚owe użycie atrybutu „VirtualMethodIndexAttribute†The usage of 'LibraryImportAttribute' does not follow recommendations. {0} - The usage of 'LibraryImportAttribute' does not follow recommendations. {0} + Użycie atrybutu „LibraryImportAttribute†nie jest zgodne z zaleceniami. {0} The usage of 'LibraryImportAttribute' does not follow recommendations. - The usage of 'LibraryImportAttribute' does not follow recommendations. + Użycie atrybutu „LibraryImportAttribute†nie jest zgodne z zaleceniami. The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'. - The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination'. + Typ elementu „ReadOnlySpan†zwracany przez element „GetManagedValuesSource†musi być taki sam jak typ elementu zwracany przez element „GetManagedValuesDestinationâ€. The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination' - The element type of the 'ReadOnlySpan' returned by 'GetManagedValuesSource' must be the same as the element type returned by 'GetManagedValuesDestination' + Typ elementu „ReadOnlySpan†zwracany przez element „GetManagedValuesSource†musi być taki sam jak typ elementu zwracany przez element „GetManagedValuesDestination†A 'LinearCollection'-kind native type that supports the 'CallerAllocatedBuffer' feature must provide a three-parameter constructor taking the managed type as the first parameter, a 'Span<byte>' as the second parameter, and the native size of the element as the third parameter - A 'LinearCollection'-kind native type that supports the 'CallerAllocatedBuffer' feature must provide a three-parameter constructor taking the managed type as the first parameter, a 'Span<byte>' as the second parameter, and the native size of the element as the third parameter + Typ natywny rodzaju „LinearCollectionâ€, który obsÅ‚uguje funkcjÄ™ „CallerAllocatedBufferâ€, musi zapewniać konstruktora z trzema parametrami, przyjmujÄ…cego typ zarzÄ…dzany jako pierwszy parametr, wartość „Span<byte>†jako drugi parametr i natywny rozmiar elementu jako trzeci parametr The type '{0}' specifies that it supports 'In' marshalling with the 'CallerAllocatedBuffer' feature for '{1}' but does not provide a three-parameter constructor that takes a '{1}' , a 'Span<byte>', and an 'int' - The type '{0}' specifies that it supports 'In' marshalling with the 'CallerAllocatedBuffer' feature for '{1}' but does not provide a three-parameter constructor that takes a '{1}' , a 'Span<byte>', and an 'int' + Typ „{0}†okreÅ›la, że obsÅ‚uguje funkcjÄ™ skierowania „In†z funkcjÄ… „CallerAllocatedBuffer†dla elementu „{1}â€, ale nie udostÄ™pnia konstruktora z trzema parametrami, który przyjmuje wartość „{1}â€, \"Span<byte>\" i „int†A contiguous collection marshaller that supports marshalling from managed to unmanaged must provide a 'GetManagedValuesSource' that returns a 'ReadOnlySpan<>' and a 'GetUnmanagedValuesDestination' method that returns a 'Span<>'. - A contiguous collection marshaller that supports marshalling from managed to unmanaged must provide a 'GetManagedValuesSource' that returns a 'ReadOnlySpan<>' and a 'GetUnmanagedValuesDestination' method that returns a 'Span<>'. + Organizator zwartej kolekcji, który obsÅ‚uguje przeprowadzanie marshalingu z zarzÄ…dzanych do niezarzÄ…dzanych, musi zapewniać metodÄ™ „GetManagedValuesSourceâ€, która zwraca wartość „ReadOnlySpan<>†oraz metodÄ™ „GetUnmanagedValuesDestinationâ€, która zwraca wartość „Span<>â€. The type '{0}' specifies that it supports the '{1}' marshal mode, but it does not provide a 'GetManagedValuesSource' that returns a 'ReadOnlySpan<>' and a 'GetUnmanagedValuesDestination' method that returns a 'Span<>' - The type '{0}' specifies that it supports the '{1}' marshal mode, but it does not provide a 'GetManagedValuesSource' that returns a 'ReadOnlySpan<>' and a 'GetUnmanagedValuesDestination' method that returns a 'Span<>' + Typ „{0}†okreÅ›la, że obsÅ‚uguje tryb przeprowadzenia marshalingu „{1}â€, ale nie zapewnia metody „GetManagedValuesSourceâ€, która zwraca wartość „ReadOnlySpan<>†ani metody „GetNativeValuesDestinationâ€, która zwraca wartość „Span<>†A contiguous collection marshaller that supports marshalling from unmanaged to managed must provide a 'GetManagedValuesDestination' that takes an 'int' and returns a 'Span<>' and a 'GetUnmanagedValuesSource' method that takes an 'int' and returns a 'ReadOnlySpan<>'. - A contiguous collection marshaller that supports marshalling from unmanaged to managed must provide a 'GetManagedValuesDestination' that takes an 'int' and returns a 'Span<>' and a 'GetUnmanagedValuesSource' method that takes an 'int' and returns a 'ReadOnlySpan<>'. + Organizator zwartej kolekcji, który obsÅ‚uguje przeprowadzanie marshalingu z niezarzÄ…dzanych do zarzÄ…dzanych, musi zapewniać metodÄ™ „GetManagedValuesDestinationâ€, która przyjmuje wartość „int†i zwraca wartość „Span<>â€, oraz metodÄ™ „GetUnmanagedValuesSourceâ€, która przyjmuje wartość „int†i zwraca wartość „ReadOnlySpan<>â€. The type '{0}' specifies that it supports the '{1}' marshal mode, but it does not provide a 'GetManagedValuesDestination' that takes an 'int' and returns a 'Span<>' and a 'GetUnmanagedValuesSource' method that takes an 'int' and returns a 'ReadOnlySpan<>' - The type '{0}' specifies that it supports the '{1}' marshal mode, but it does not provide a 'GetManagedValuesDestination' that takes an 'int' and returns a 'Span<>' and a 'GetUnmanagedValuesSource' method that takes an 'int' and returns a 'ReadOnlySpan<>' + Typ „{0}†okreÅ›la, że obsÅ‚uguje tryb przeprowadzania marshalingu „{1}â€, ale nie zapewnia metody „GetManagedValuesDestinationâ€, która przyjmuje wartość „int†i zwraca wartość „Span<>â€, oraz metodÄ™ „GetUnmanagedValuesSourceâ€, która przyjmuje wartość „int†i zwraca wartość „ReadOnlySpan<>†The specified parameter needs to be marshalled from managed to unmanaged, but the marshaller type '{0}' does not support it. - The specified parameter needs to be marshalled from managed to unmanaged, but the marshaller type '{0}' does not support it. + OkreÅ›lony parametr musi być kierowany z zarzÄ…dzanego do niezarzÄ…dzanego, ale typ marszaÅ‚ka „{0}†go nie obsÅ‚uguje. The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the generator can determine which methods are available on the specific marshaller types. - The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the generator can determine which methods are available on the specific marshaller types. + Typ marshallera musi być zamkniÄ™tym typem ogólnym lub mieć takÄ… samÄ… liczbÄ™ parametrów ogólnych jak typ zarzÄ…dzany, aby generator mógÅ‚ okreÅ›lić, które metody sÄ… dostÄ™pne na okreÅ›lonych typach marshallerów. The managed type '{0}' for entry-point marshaller type '{1}' must be a closed generic type, have the same arity as the managed type if it is a value marshaller, or have one additional generic parameter if it is a collection marshaller. - The managed type '{0}' for entry-point marshaller type '{1}' must be a closed generic type, have the same arity as the managed type if it is a value marshaller, or have one additional generic parameter if it is a collection marshaller. + Typ zarzÄ…dzany „{0}†dla typu marshaller punktu wejÅ›cia „{1}†musi być zamkniÄ™tym typem ogólnym, mieć takÄ… samÄ… argumentacjÄ™ jak typ zarzÄ…dzany, jeÅ›li jest to marshaller wartoÅ›ci lub mieć jeden dodatkowy parametr ogólny, jeÅ›li jest to marshaller kolekcji. The managed type for a custom marshaller must be non-null. - The managed type for a custom marshaller must be non-null. + Typ zarzÄ…dzany dla niestandardowego marshallera musi mieć wartość innÄ… niż null. The managed type for the entry-point marshaller type '{0}' must not be 'null' - The managed type for the entry-point marshaller type '{0}' must not be 'null' + Typ zarzÄ…dzany dla typu marshaller punktu wejÅ›cia „{0}†nie może mieć wartoÅ›ci „null†The specified 'MarshalAsAttribute' configuration for parameter '{1}' is not supported by source-generated COM. If the specified configuration is required, use `ComImport` instead. - The specified 'MarshalAsAttribute' configuration for parameter '{1}' is not supported by source-generated COM. If the specified configuration is required, use `ComImport` instead. + OkreÅ›lona konfiguracja atrybutu „MarshalAsAttribute†dla parametru „{1}†nie jest obsÅ‚ugiwana przez COM generowany przez źródÅ‚o. JeÅ›li okreÅ›lona konfiguracja jest wymagana, użyj zamiast niej polecenia `ComImport`. The specified 'MarshalAsAttribute' configuration for parameter '{1}' is not supported by source-generated P/Invokes. If the specified configuration is required, use a regular 'DllImport' instead. - The specified 'MarshalAsAttribute' configuration for parameter '{1}' is not supported by source-generated P/Invokes. If the specified configuration is required, use a regular 'DllImport' instead. + OkreÅ›lona konfiguracja atrybutu „MarshalAsAttribute†dla parametru „{1}†nie jest obsÅ‚ugiwana przez generowane źródÅ‚owo P/Invokes. JeÅ›li okreÅ›lona konfiguracja jest wymagana, należy zamiast niej użyć zwykÅ‚ego elementu „DllImportâ€. The specified 'MarshalAsAttribute' configuration for the return value of method '{1}' is not supported by source-generated COM. If the specified configuration is required, use `ComImport` instead. - The specified 'MarshalAsAttribute' configuration for the return value of method '{1}' is not supported by source-generated COM. If the specified configuration is required, use `ComImport` instead. + OkreÅ›lona konfiguracja atrybutu „MarshalAsAttribute†dla wartoÅ›ci zwracanej metody „{1}†nie jest obsÅ‚ugiwana przez COM generowany przez źródÅ‚o. JeÅ›li okreÅ›lona konfiguracja jest wymagana, użyj zamiast niej polecenia `ComImport`. The specified 'MarshalAsAttribute' configuration for the return value of method '{1}' is not supported by source-generated P/Invokes. If the specified configuration is required, use a regular 'DllImport' instead. - The specified 'MarshalAsAttribute' configuration for the return value of method '{1}' is not supported by source-generated P/Invokes. If the specified configuration is required, use a regular 'DllImport' instead. + OkreÅ›lona konfiguracja atrybutu „MarshalAsAttribute†dla wartoÅ›ci zwracanej metody „{1}†nie jest obsÅ‚ugiwana przez generowane źródÅ‚owo P/Invokes. JeÅ›li okreÅ›lona konfiguracja jest wymagana, należy zamiast niej użyć zwykÅ‚ego elementu „DllImportâ€. The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. - The 'marshalMode' argument of 'CustomMarshallerAttribute' must be a valid enum value of 'MarshalMode'. + Argument „marshalMode†atrybutu „CustomMarshaellerAttribute†musi być prawidÅ‚owÄ… wartoÅ›ciÄ… wyliczenia argumentu „MarshalModeâ€. The marshaller entry point type '{0}' for managed type '{1}' must have an arity of one greater than the managed type. - The marshaller entry point type '{0}' for managed type '{1}' must have an arity of one greater than the managed type. + Typ punktu wejÅ›cia marshallera „{0}†dla typu zarzÄ…dzanego „{1}†musi mieć liczbÄ™ argumentów o jeden wiÄ™kszÄ… niż typ zarzÄ…dzany. All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. - All marshallers for values that are passed as the unmanaged return value must have the same unmanaged type. + Wszystkie elementy organizujÄ…ce dla wartoÅ›ci przekazywanych jako niezarzÄ…dzana wartość zwracana muszÄ… mieć ten sam typ niezarzÄ…dzany. The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. - The marshaller type must be a closed generic or have the same number of generic parameters as the managed type so the emitted code can use a specific instantiation. + Typ marshallera musi być zamkniÄ™tym typem ogólnym lub mieć takÄ… samÄ… liczbÄ™ parametrów ogólnych jak typ zarzÄ…dzany, aby emitowany kod mógÅ‚ używać okreÅ›lonego wystÄ…pienia. The marshaller type '{0}' pointed to by the entry-point marshaller type '{1}' must be a closed generic type or have the same arity as the managed type - The marshaller type '{0}' pointed to by the entry-point marshaller type '{1}' must be a closed generic type or have the same arity as the managed type + Typ marshallera „{0}†wskazywanego przez typ marshallera punktu wejÅ›cia „{1}†musi być zamkniÄ™tym typem ogólnym lub mieć takÄ… samÄ… argumentacjÄ™ jak typ zarzÄ…dzany The 'marshallerType' parameter in the 'System.Runtime.InteropServices.Marshalling.CustomMarshallerAttribute' cannot be 'null'. - The 'marshallerType' parameter in the 'System.Runtime.InteropServices.Marshalling.CustomMarshallerAttribute' cannot be 'null'. + Parametr „marshallerType†w atrybucie „System.Runtime.InteropServices.Marshalling.CustomMarshaellerAttribute†nie może mieć wartoÅ›ci „nullâ€. The 'marshallerType' parameter in the 'System.Runtime.InteropServices.Marshalling.CustomMarshallerAttribute' cannot be 'null' - The 'marshallerType' parameter in the 'System.Runtime.InteropServices.Marshalling.CustomMarshallerAttribute' cannot be 'null' + Parametr „marshallerType†w atrybucie „System.Runtime.InteropServices.Marshalling.CustomMarshaellerAttribute†nie może mieć wartoÅ›ci „null†The marshaller type '{0}' for managed type '{1}' must be a static class or a struct. - The marshaller type '{0}' for managed type '{1}' must be a static class or a struct. + Typ marshallera „{0}†dla typu zarzÄ…dzanego „{1}†musi być statyczny. A marshaller type must either be a stateless static class or a stateful value type. A non-static class is not allowed. - A marshaller type must either be a stateless static class or a stateful value type. A non-static class is not allowed. + Typ organizatora musi być bezstanowÄ… klasÄ… statycznÄ… lub stanowym typem wartoÅ›ci. Klasa niestatyczna jest niedozwolona. The type '{0}' must be a static class or a value type - The type '{0}' must be a static class or a value type + Typ „{0}†musi być klasÄ… statycznÄ… lub typem wartoÅ›ci A type with a 'System.Runtime.InteropServices.CustomMarshallerAttribute' must specify a non-'null' managed type - A type with a 'System.Runtime.InteropServices.CustomMarshallerAttribute' must specify a non-'null' managed type + Typ z atrybutem „System.Runtime.InteropServices.CustomMarshaellerAttribute†musi okreÅ›lać typ zarzÄ…dzany inny niż „null†The type '{0}' does not specify a managed type in the 'System.Runtime.InteropServices.CustomMarshallerAttribute' applied to the type - The type '{0}' does not specify a managed type in the 'System.Runtime.InteropServices.CustomMarshallerAttribute' applied to the type + Typ „{0}†nie okreÅ›la typu zarzÄ…dzanego w atrybucie „System.Runtime.InteropServices.CustomTypeMarshallerAttribute†zastosowanym do typu Marshalling bool without explicit marshalling information is not supported. Specify either 'MarshalUsingAttribute' or 'MarshalAsAttribute'. - Marshalling bool without explicit marshalling information is not supported. Specify either 'MarshalUsingAttribute' or 'MarshalAsAttribute'. + Skierowanie wartoÅ›ci logicznej bez wyraźnych informacji o skierowaniu nie jest obsÅ‚ugiwane. OkreÅ›l atrybut „MarshalUsingAttribute†lub atrybut „MarshalAsAttributeâ€. Marshalling char with 'StringMarshalling.{0}' is not supported. Instead, manually convert the char type to the desired byte representation and pass to the source-generated P/Invoke. - Marshalling char with 'StringMarshalling.{0}' is not supported. Instead, manually convert the char type to the desired byte representation and pass to the source-generated P/Invoke. + Znak marshallingu o wartoÅ›ci „StringMarshalling.{0}†nie jest obsÅ‚ugiwany. Zamiast tego rÄ™cznie przekonwertuj typ znaków na żądanÄ… reprezentacjÄ™ bajtów i przekaż do wygenerowanego źródÅ‚a funkcji P/Invoke. Marshalling char with 'StringMarshalling.Custom' is not supported. To use a custom type marshaller, specify 'MarshalUsingAttribute'. - Marshalling char with 'StringMarshalling.Custom' is not supported. To use a custom type marshaller, specify 'MarshalUsingAttribute'. + Znak marshallingu o wartoÅ›ci „StringMarshalling.Custom†nie jest obsÅ‚ugiwany. Aby użyć marshallera typu niestandardowego, okreÅ›l atrybut „MarshalUsingAttributeâ€. Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'. - Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'. + Kierowanie ciÄ…gu lub znaku bez jawnych informacji o kierowaniu nie jest obsÅ‚ugiwane. OkreÅ›l „{0}.StringMarshallingâ€, „{0}.StringMarshallingCustomTypeâ€, „MarshalUsingAttribute†lub „MarshalAsAttributeâ€. All methods must be declared in the same partial definition of a 'GeneratedComInterface'-attributed interface type to ensure reliable calculation for virtual method table offsets. - All methods must be declared in the same partial definition of a 'GeneratedComInterface'-attributed interface type to ensure reliable calculation for virtual method table offsets. + Wszystkie metody muszÄ… być zadeklarowane w tej samej częściowej definicji przypisanego typu interfejsu „GeneratedComInterface†w celu zapewnienia niezawodnego obliczania przesunięć tabeli metod wirtualnych. The method '{0}' is declared on a different partial definition of the interface '{1}' than the definition that has the 'GeneratedComInterface' attribute - The method '{0}' is declared on a different partial definition of the interface '{1}' than the definition that has the 'GeneratedComInterface' attribute + Metoda „{0}†jest zadeklarowana w innej częściowej definicji interfejsu „{1}†niż definicja, która ma atrybut „GeneratedComInterface†Method is declared in different partial declaration than the 'GeneratedComInterface' attribute. - Method is declared in different partial declaration than the 'GeneratedComInterface' attribute. + Metoda jest zadeklarowana w innej deklaracji częściowej niż atrybut „GeneratedComInterfaceâ€. A 'GeneratedComInterfaceAttribute'-attributed interface can only derive from at most one other 'GeneratedComInterfaceAttribute'-attributed interface. - A 'GeneratedComInterfaceAttribute'-attributed interface can only derive from at most one other 'GeneratedComInterfaceAttribute'-attributed interface. + Interfejs z atrybutem „GeneratedComInterfaceAttribute†może pochodzić tylko z co najwyżej jednego interfejsu z atrybutem „GeneratedComInterfaceAttributeâ€. Interface '{0}' is derived from two or more interfaces attributed with 'GeneratedComInterfaceAttribute'. - Interface '{0}' is derived from two or more interfaces attributed with 'GeneratedComInterfaceAttribute'. + Interfejs „{0}†pochodzi z co najmniej dwóch interfejsów z atrybutem „GeneratedComInterfaceAttributeâ€. Specified interface derives from two or more 'GeneratedComInterfaceAttribute'-attributed interfaces. - Specified interface derives from two or more 'GeneratedComInterfaceAttribute'-attributed interfaces. + OkreÅ›lony interfejs pochodzi z co najmniej dwóch interfejsów z atrybutem „GeneratedComInterfaceAttributeâ€. Either 'ComInterfaceOptions.ManagedObjectWrapper' or 'ComInterfaceOptions.ComObjectWrapper' must be specified. - Either 'ComInterfaceOptions.ManagedObjectWrapper' or 'ComInterfaceOptions.ComObjectWrapper' must be specified. + Należy okreÅ›lić element „ComInterfaceOptions.ManagedObjectWrapper†lub „ComInterfaceOptions.ComObjectWrapperâ€. The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable. - The '[Out]' attribute is only supported on array parameters. Consider using 'out' or 'ref' keywords to make the parameter mutable. + Atrybut „[Out]†jest obsÅ‚ugiwany tylko w przypadku parametrów tablicy. Rozważ użycie słów kluczowych „out†lub „refâ€, aby umożliwić modyfikowanie parametru. A 'Value' or 'LinearCollection'-kind native type that supports marshalling in the 'Out' direction must provide a 'ToManaged' method that returns the managed type. - A 'Value' or 'LinearCollection'-kind native type that supports marshalling in the 'Out' direction must provide a 'ToManaged' method that returns the managed type. + Typ natywny rodzaju „Value†lub „LinearCollectionâ€, który obsÅ‚uguje skierowanie w kierunku „Outâ€, musi zapewniać metodÄ™ „ToManagedâ€, która zwraca typ zarzÄ…dzany. The type '{0}' specifies it supports marshalling in the 'Out' direction, but it does not provide a 'ToManaged' method that returns the managed type - The type '{0}' specifies it supports marshalling in the 'Out' direction, but it does not provide a 'ToManaged' method that returns the managed type + Typ „{0}†okreÅ›la, że obsÅ‚uguje skierowanie w kierunku „Outâ€, ale nie zapewnia metody „ToManagedâ€, która zwraca typ zarzÄ…dzany It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters. - It is recommended to use explicit '[In]' and '[Out]' attributes on array parameters. + Zaleca siÄ™ używanie jawnych atrybutów „[In]†i „[Out]†w parametrach tablicy. 'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '<AllowUnsafeBlocks>true</AllowUnsafeBlocks>'. - 'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '<AllowUnsafeBlocks>true</AllowUnsafeBlocks>'. + Atrybut „GeneratedComInterfaceAttribute†i „GeneratedComClassAttribute†wymagajÄ… niebezpiecznego kodu. Projekt musi zostać zaktualizowany za pomocÄ… polecenia „<AllowUnsafeBlocks>true</AllowUnsafeBlocks>â€. LibraryImportAttribute requires unsafe code. Project must be updated with '<AllowUnsafeBlocks>true</AllowUnsafeBlocks>'. - LibraryImportAttribute requires unsafe code. Project must be updated with '<AllowUnsafeBlocks>true</AllowUnsafeBlocks>'. + Element LibraryImportAttribute wymaga niebezpiecznego kodu. Projekt musi zostać zaktualizowany za pomocÄ… „<AllowUnsafeBlocks>true</AllowUnsafeBlocks>â€. 'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '<AllowUnsafeBlocks>true</AllowUnsafeBlocks>'. - 'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. Project must be updated with '<AllowUnsafeBlocks>true</AllowUnsafeBlocks>'. + Atrybut „GeneratedComInterfaceAttribute†i „GeneratedComClassAttribute†wymagajÄ… niebezpiecznego kodu. Projekt musi zostać zaktualizowany za pomocÄ… polecenia „<AllowUnsafeBlocks>true</AllowUnsafeBlocks>â€. LibraryImportAttribute requires unsafe code. Project must be updated with '<AllowUnsafeBlocks>true</AllowUnsafeBlocks>'. - LibraryImportAttribute requires unsafe code. Project must be updated with '<AllowUnsafeBlocks>true</AllowUnsafeBlocks>'. + Element LibraryImportAttribute wymaga niebezpiecznego kodu. Projekt musi zostać zaktualizowany za pomocÄ… „<AllowUnsafeBlocks>true</AllowUnsafeBlocks>â€. 'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. - 'GeneratedComInterfaceAttribute' and 'GeneratedComClassAttribute' require unsafe code. + Atrybuty „GeneratedComInterfaceAttribute†i „GeneratedComClassAttribute†wymagajÄ… niebezpiecznego kodu. LibraryImportAttribute requires unsafe code. - LibraryImportAttribute requires unsafe code. + Element LibraryImportAttribute wymaga niebezpiecznego kodu. The return type the two method must be the expected type. - The return type the two method must be the expected type. + Zwracany typ obu tych metod musi być oczekiwanym typem. The return type of '{0}' must be '{1}' - The return type of '{0}' must be '{1}' + Zwracany typ „{0}†musi być „{1}†The return types of the two methods must be the same type. - The return types of the two methods must be the same type. + Zwracane typy obu tych metod muszÄ… być tego samego typu. The return type of '{0}' must be the same type as the return type of '{1}' - The return type of '{0}' must be the same type as the return type of '{1}' + Zwracany typ „{0}†musi być tego samego typu co zwracany typ „{1}†COM Interop APIs on 'System.Runtime.InteropServices.Marshal' do not support source-generated COM and will fail at runtime - COM Interop APIs on 'System.Runtime.InteropServices.Marshal' do not support source-generated COM and will fail at runtime + Interfejsy API usÅ‚ugi miÄ™dzyoperacyjnej modelu COM w elemencie „System.Runtime.InteropServices.Marshal†nie obsÅ‚ugujÄ… generowanego przez źródÅ‚o modelu COM i nie bÄ™dÄ… dziaÅ‚ać w Å›rodowisku uruchomieniowym The method '{0}' only supports runtime-based COM interop and will not work with type '{1}' - The method '{0}' only supports runtime-based COM interop and will not work with type '{1}' + Metoda „{0}†obsÅ‚uguje tylko usÅ‚ugÄ™ miÄ™dzyoperacyjnÄ… modelu COM opartÄ… na Å›rodowisku uruchomieniowym i nie bÄ™dzie dziaÅ‚ać z typem „{1}†COM Interop APIs on 'System.Runtime.InteropServices.Marshal' do not support source-generated COM - COM Interop APIs on 'System.Runtime.InteropServices.Marshal' do not support source-generated COM + Interfejsy API usÅ‚ugi miÄ™dzyoperacyjnej modelu COM w elemencie „System.Runtime.InteropServices.Marshal†nie obsÅ‚ugujÄ… generowanego przez źródÅ‚o modelu COM Runtime marshalling must be disabled in this project by applying the 'System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute' to the assembly to enable marshalling this type. - Runtime marshalling must be disabled in this project by applying the 'System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute' to the assembly to enable marshalling this type. + Marshalling Å›rodowiska uruchomieniowego musi być wyłączony w tym projekcie przez zastosowanie do zestawu atrybutu „System.Runtime.InteropServices.DisableRuntimeMarshallingAttributeâ€, aby umożliwić marshalling tego typu. The size of parameter '{0}' that is marshalled to the callee must be defined when the method is called, but count parameter '{1}' is an 'out' parameter. - The size of parameter '{0}' that is marshalled to the callee must be defined when the method is called, but count parameter '{1}' is an 'out' parameter. + Rozmiar parametru „{0}â€, który jest kierowany do obiektu wywoÅ‚ujÄ…cego, musi być zdefiniowany podczas wywoÅ‚ywania metody, ale parametr ILE.LICZB „{1}†jest parametrem „outâ€. The size of parameter '{0}' that is marshalled to the callee must be defined when the method is called, but the return value is used as the size of the collection. - The size of parameter '{0}' that is marshalled to the callee must be defined when the method is called, but the return value is used as the size of the collection. + Rozmiar parametru „{0}â€, który jest kierowany do obiektu wywoÅ‚ujÄ…cego, musi być zdefiniowany podczas wywoÅ‚ywania metody, ale wartość zwracana jest używana jako rozmiar kolekcji. The size of a collection that is marshalled to the callee must be defined when the method is called. - The size of a collection that is marshalled to the callee must be defined when the method is called. + Rozmiar kolekcji kierowanej do obiektu wywoÅ‚ujÄ…cego musi być zdefiniowany podczas wywoÅ‚ywania metody. A stateful marshaller must have a zero-parameter void-returning instance method named 'Free'. - A stateful marshaller must have a zero-parameter void-returning instance method named 'Free'. + Stanowy marshaller musi mieć metodÄ™ wystÄ…pienia zwracajÄ…cÄ… wartość nieważnÄ… o parametrze 0 o nazwie „Freeâ€. The type '{0}' is a stateful marshaller and does not have a zero-parameter void-returning instance method named 'Free' - The type '{0}' is a stateful marshaller and does not have a zero-parameter void-returning instance method named 'Free' + Typ „{0}†jest stanowym marshallerem i nie ma metody wystÄ…pienia zwracajÄ…cego wartość nieważnÄ… o parametrze 0 o nazwie „Free†A stateful marshaller that supports marshalling from managed to unmanaged must provide a 'FromManaged' instance method that takes the managed value as a parameter and returns 'void'. - A stateful marshaller that supports marshalling from managed to unmanaged must provide a 'FromManaged' instance method that takes the managed value as a parameter and returns 'void'. + Stanowu marshaller obsÅ‚ugujÄ…cy kierowanie z zarzÄ…dzanego do niezarzÄ…dzanego musi udostÄ™pniać metodÄ™ wystÄ…pienia „ZNiezarzÄ…dzaneâ€, która przyjmuje wartość zarzÄ…dzanÄ… jako parametr i zwraca wartość „nieważne†The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a one-parameter instance method named 'FromManaged' that takes a '{2}' as a parameter and returns 'void' - The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a one-parameter instance method named 'FromManaged' that takes a '{2}' as a parameter and returns 'void' + Typ „{0}†okreÅ›la, że obsÅ‚uguje tryb marshalingu „{1}†dla „{2}â€, ale nie udostÄ™pnia metody wystÄ…pienia z jednym parametrem o nazwie „ZNiezarzÄ…dzaneâ€, która przyjmuje jako parametr „{2}†i zwraca wartość „nieważne†A stateful marshaller that supports marshalling from unmanaged to managed must provide a 'FromUnmanaged' instance method that takes the unmanaged value as a parameter and returns 'void'. - A stateful marshaller that supports marshalling from unmanaged to managed must provide a 'FromUnmanaged' instance method that takes the unmanaged value as a parameter and returns 'void'. + Stanowy marshaller obsÅ‚ugujÄ…cy kierowanie z niezarzÄ…dzanego do zarzÄ…dzanego musi udostÄ™pniać metodÄ™ wystÄ…pienia „ZNiezarzÄ…dzaneâ€, która przyjmuje wartość niezarzÄ…dzanÄ… jako parametr i zwraca wartość „nieważneâ€. The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a one-parameter instance method named 'FromUnmanaged' that takes the 'unmanaged' value as a parameter and returns 'void' - The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a one-parameter instance method named 'FromUnmanaged' that takes the 'unmanaged' value as a parameter and returns 'void' + Typ „{0}†okreÅ›la, że obsÅ‚uguje tryb marshalingu „{1}†dla elementu „{2}â€, ale nie udostÄ™pnia metody wystÄ…pienia jednego parametru o nazwie „ZNiezarzÄ…dzaneâ€, która przyjmuje wartość „niezarzÄ…dzane†jako parametr i zwraca wartość „nieważne†A stateful marshaller that supports marshalling from unmanaged to managed must provide a 'ToManaged' instance method that takes no parameters and returns the managed type. - A stateful marshaller that supports marshalling from unmanaged to managed must provide a 'ToManaged' instance method that takes no parameters and returns the managed type. + Marshaller stanu obsÅ‚ugujÄ…cy kierowanie z niezarzÄ…dzanego do zarzÄ…dzanego musi udostÄ™pniać metodÄ™ wystÄ…pienia „DoZarzÄ…dzaneâ€, która nie przyjmuje parametrów i zwraca typ zarzÄ…dzany. The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a zero-parameter instance method named 'ToManaged' that returns '{2}' - The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a zero-parameter instance method named 'ToManaged' that returns '{2}' + Typ „{0}†okreÅ›la, że obsÅ‚uguje tryb marshalingu „{1}†dla elementu „{2}â€, ale nie udostÄ™pnia metody wystÄ…pienia o wartoÅ›ci zero parametrów o nazwie „DoZarzÄ…dzaneâ€, która zwraca wartość „{2}†A stateful marshaller that supports marshalling from managed to unmanaged must provide a 'ToUnmanaged' instance method that takes no parameters and returns the 'unmanaged' type. - A stateful marshaller that supports marshalling from managed to unmanaged must provide a 'ToUnmanaged' instance method that takes no parameters and returns the 'unmanaged' type. + Stanowy marshaller obsÅ‚ugujÄ…cy kierowanie z zarzÄ…dzanego do niezarzÄ…dzanego musi udostÄ™pniać metodÄ™ wystÄ…pienia „DoNiezarzÄ…dzaneâ€, która nie przyjmuje parametrów i zwraca typ „niezarzÄ…dzaneâ€. The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a zero-parameter instance method named 'ToUnmanaged' that returns the 'unmanaged' type for the marshaller - The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but it does not provide a zero-parameter instance method named 'ToUnmanaged' that returns the 'unmanaged' type for the marshaller + Typ „{0}†okreÅ›la, że obsÅ‚uguje tryb marshalingu „{1}†dla elementu „{2}â€, ale nie udostÄ™pnia metody wystÄ…pienia o wartoÅ›ci zero parametrów o nazwie „DoNiezarzÄ…dzaneâ€, która zwraca typ „niezarzÄ…dzane†dla marshalera When the 'Managed to Unmanaged with Caller-Allocated Buffer' shape is used by providing an 'AllocateContainerForUnmanagedElements' method that takes a 'Span<T>' on the marshaller type, the type must provide a static 'BufferSize' property to provide the number of elements in the caller-allocated buffer. - When the 'Managed to Unmanaged with Caller-Allocated Buffer' shape is used by providing an 'AllocateContainerForUnmanagedElements' method that takes a 'Span<T>' on the marshaller type, the type must provide a static 'BufferSize' property to provide the number of elements in the caller-allocated buffer. + Gdy ksztaÅ‚t „ZarzÄ…dzane do niezarzÄ…dzanych za pomocÄ… buforu przydzielonego przez wywoÅ‚ujÄ…cego†jest używany poprzez zapewnienie metody „AllocateContainerForUnmanagedElementsâ€, która przyjmuje wartość „Span< T>†w przypadku typu organizatora, typ musi zapewniać statycznÄ… wÅ‚aÅ›ciwość „BufferSizeâ€, aby okreÅ›lić liczbÄ™ elementów w buforze przydzielonym przez wywoÅ‚ujÄ…cego. The marshaller type '{0}' must have a static read-only 'int' 'BufferSize' property to specify the size of the caller-allocated buffer because it has an 'AllocateContainerForUnmanagedElements' method that takes a caller-allocated 'Span<{1}>' - The marshaller type '{0}' must have a static read-only 'int' 'BufferSize' property to specify the size of the caller-allocated buffer because it has an 'AllocateContainerForUnmanagedElements' method that takes a caller-allocated 'Span<{1}>' + Typ organizatora „{0}†musi mieć statycznÄ… wÅ‚aÅ›ciwość „BufferSize†„int†tylko do odczytu, aby okreÅ›lić rozmiar buforu przydzielonego przez wywoÅ‚ujÄ…cego, ponieważ ma metodÄ™ „AllocateContainerForUnmanagedElementsâ€, która przyjmuje przydzielonÄ… przez wywoÅ‚ujÄ…cego wartość „Span<{1}>†A contiguous collection marshaller that supports marshalling from managed to unmanaged must provide a 'GetManagedValuesSource' that takes the managed value as a parameter and returns a 'ReadOnlySpan<>' and a 'GetUnmanagedValuesDestination' method that takes the unmanaged value as a parameter and returns a 'Span<>' - A contiguous collection marshaller that supports marshalling from managed to unmanaged must provide a 'GetManagedValuesSource' that takes the managed value as a parameter and returns a 'ReadOnlySpan<>' and a 'GetUnmanagedValuesDestination' method that takes the unmanaged value as a parameter and returns a 'Span<>' + Organizator zwartej kolekcji, który obsÅ‚uguje przeprowadzanie marshalingu z niezarzÄ…dzanych do zarzÄ…dzanych, musi zapewniać metodÄ™ „GetManagedValuesSourceâ€, która przyjmuje zarzÄ…dzanÄ… wartość jako parametr i zwraca wartość „ReadOnlySpan<>â€, oraz metodÄ™ „GetUnmanagedValuesDestinationâ€, która przyjmuje niezarzÄ…dzanÄ… wartość jako parametr i zwraca wartość „Span<>â€. The type '{0}' specifies that it supports the '{1}' marshal mode, but it does not provide a 'GetManagedValuesSource' that takes '{2}' as a parameter and returns a 'ReadOnlySpan<>' and a 'GetUnmanagedValuesDestination' method that takes the unmanaged value as a parameter and returns a 'Span<>' - The type '{0}' specifies that it supports the '{1}' marshal mode, but it does not provide a 'GetManagedValuesSource' that takes '{2}' as a parameter and returns a 'ReadOnlySpan<>' and a 'GetUnmanagedValuesDestination' method that takes the unmanaged value as a parameter and returns a 'Span<>' + Typ „{0}†okreÅ›la, że obsÅ‚uguje tryb przeprowadzania marshalingu „{1}â€, ale nie zapewnia metody „GetManagedValuesSourceâ€, która przyjmuje wartość „{2}†jako parametr i zwraca wartość „ReadOnlySpan<>â€, oraz metodÄ™ „GetUnmanagedValuesDestinationâ€, która przyjmuje niezarzÄ…dzanÄ… wartość jako parametr i zwraca wartość „Span<>†A contiguous collection marshaller that supports marshalling from unmanaged to managed must provide a 'GetManagedValuesDestination' that takes the managed value and returns a 'Span<>' and a 'GetUnmanagedValuesSource' method that takes the unmanaged value and an 'int' and returns a 'ReadOnlySpan<>'. - A contiguous collection marshaller that supports marshalling from unmanaged to managed must provide a 'GetManagedValuesDestination' that takes the managed value and returns a 'Span<>' and a 'GetUnmanagedValuesSource' method that takes the unmanaged value and an 'int' and returns a 'ReadOnlySpan<>'. + Organizator zwartej kolekcji, który obsÅ‚uguje przeprowadzanie marshalingu z niezarzÄ…dzanych do zarzÄ…dzanych, musi zapewniać metodÄ™ „GetManagedValuesDestinationâ€, która przyjmuje zarzÄ…dzanÄ… wartość i zwraca wartość „Span<>â€, oraz metodÄ™ „GetUnmanagedValuesSourceâ€, która przyjmuje niezarzÄ…dzanÄ… wartość i wartość „int†oraz zwraca wartość „ReadOnlySpan<>â€. The type '{0}' specifies that it supports the '{1}' marshal mode, but it does not provide a 'GetManagedValuesDestination' that takes '{2}' and returns a 'Span<>' and a 'GetUnmanagedValuesSource' method that takes the unmanaged value and an 'int' and returns a 'ReadOnlySpan<>' - The type '{0}' specifies that it supports the '{1}' marshal mode, but it does not provide a 'GetManagedValuesDestination' that takes '{2}' and returns a 'Span<>' and a 'GetUnmanagedValuesSource' method that takes the unmanaged value and an 'int' and returns a 'ReadOnlySpan<>' + Typ „{0}†okreÅ›la, że obsÅ‚uguje tryb przeprowadzania marshalingu „{1}â€, ale nie zapewnia metody „GetManagedValuesDestinationâ€, która przyjmuje wartość „{2}†i zwraca wartość „Span<>â€, oraz metodÄ™ „GetUnmanagedValuesSourceâ€, która przyjmuje wartość niezarzÄ…dzanÄ… i „int†oraz zwraca wartość „ReadOnlySpan<>†A stateless contiguous collection marshaller that supports marshalling from managed to unmanaged must provide an 'AllocateContainerForManagedElements' method taking the unmanaged type as the first parameter and the number of elements as an 'int' parameter - A stateless contiguous collection marshaller that supports marshalling from managed to unmanaged must provide an 'AllocateContainerForManagedElements' method taking the unmanaged type as the first parameter and the number of elements as an 'int' parameter + Bezstanowy organizator zwartej kolekcji, który obsÅ‚uguje przeprowadzanie marshalingu z zarzÄ…dzanych do niezarzÄ…dzanych, musi zapewniać metodÄ™ „AllocateContainerForManagedElementsâ€, przyjmujÄ…c typ niezarzÄ…dzany jako pierwszy parametr oraz liczbÄ™ elementów jako parametr „int†The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but does not provide a two-parameter 'AllocateContainerForManagedElements' method that takes the unmanaged type as the first parameter and an 'int' as the second parameter - The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but does not provide a two-parameter 'AllocateContainerForManagedElements' method that takes the unmanaged type as the first parameter and an 'int' as the second parameter + Typ „{0}†okreÅ›la, że obsÅ‚uguje tryb przeprowadzania marshalingu „{1}†dla „{2}â€, ale nie zapewnia metody „AllocateContainerForManagedElements†z dwoma parametrami, która przyjmuje typ niezarzÄ…dzany jako pierwszy parametr i wartość „int†jako drugi parametr A stateless contiguous collection marshaller that supports marshalling from managed to unmanaged must provide an 'AllocateContainerForUnmanagedElements' method taking the managed type as the first parameter and providing the number of elements as an 'out int' parameter - A stateless contiguous collection marshaller that supports marshalling from managed to unmanaged must provide an 'AllocateContainerForUnmanagedElements' method taking the managed type as the first parameter and providing the number of elements as an 'out int' parameter + Bezstanowy organizator zwartej kolekcji, który obsÅ‚uguje przeprowadzanie marshalingu z zarzÄ…dzanych do niezarzÄ…dzanych, musi zapewniać metodÄ™ „AllocateContainerForUnmanagedElementsâ€, przyjmujÄ…c typ zarzÄ…dzany jako pierwszy parametr oraz okreÅ›lajÄ…c liczbÄ™ elementów jako parametr „out int†The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but does not provide a two-parameter 'AllocateContainerForUnmanagedElements' method that takes a '{2}' as the first parameter and an 'out int' as the second parameter - The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but does not provide a two-parameter 'AllocateContainerForUnmanagedElements' method that takes a '{2}' as the first parameter and an 'out int' as the second parameter + Typ „{0}†okreÅ›la, że obsÅ‚uguje tryb przeprowadzania marshalingu „{1}†dla „{2}â€, ale nie zapewnia metody „AllocateContainerForUnmanagedElements†z dwoma parametrami, która przyjmuje wartość „{2}†jako pierwszy parametr i wartość „out int†jako drugi parametr A stateless value marshaller that supports marshalling from unmanaged to managed must provide a 'ConvertToManaged' method that takes the unmanaged type as a parameter and returns the the managed type. - A stateless value marshaller that supports marshalling from unmanaged to managed must provide a 'ConvertToManaged' method that takes the unmanaged type as a parameter and returns the the managed type. + Bezstanowy organizator wartoÅ›ci, który obsÅ‚uguje przeprowadzanie marshalingu z zarzÄ…dzanych do niezarzÄ…dzanych, musi zapewniać metodÄ™ „ConvertToManagedâ€, która przyjmuje typ niezarzÄ…dzany jako parametr i zwraca typ zarzÄ…dzany. The type '{0}' specifies it supports the '{1}' marshal mode, but it does not provide a 'ConvertToManaged' method that takes the unmanaged type as a parameter and returns '{2}' - The type '{0}' specifies it supports the '{1}' marshal mode, but it does not provide a 'ConvertToManaged' method that takes the unmanaged type as a parameter and returns '{2}' + Typ „{0}†okreÅ›la, że obsÅ‚uguje tryb przeprowadzania marshalingu „{1}â€, ale nie zapewnia metody „ConvertToManagedâ€, która przyjmuje typ niezarzÄ…dzany jako parametr i zwraca wartość „{2}†A stateless value marshaller that supports marshalling from managed to unmanaged must provide a one-parameter 'ConvertToUnmanaged' method that takes the managed value as the parameter and returns a value of the 'unmanaged' type. - A stateless value marshaller that supports marshalling from managed to unmanaged must provide a one-parameter 'ConvertToUnmanaged' method that takes the managed value as the parameter and returns a value of the 'unmanaged' type. + Bezstanowy organizator wartoÅ›ci, który obsÅ‚uguje przeprowadzanie marshalingu z zarzÄ…dzanych do niezarzÄ…dzanych, musi zapewniać metodÄ™ „ConvertToUnmanaged†z jednym parametrem, która przyjmuje wartość zarzÄ…dzanÄ… jako parametr i zwraca wartość typu „niezarzÄ…dzanyâ€. The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but does not provide a one-parameter 'ConvertToUnmanaged' method that takes a '{2}' as a parameter and returns a value of an 'unmanaged' type - The type '{0}' specifies that it supports the '{1}' marshal mode for '{2}' but does not provide a one-parameter 'ConvertToUnmanaged' method that takes a '{2}' as a parameter and returns a value of an 'unmanaged' type + Typ „{0}†okreÅ›la, że obsÅ‚uguje tryb przeprowadzania marshalingu „{1}†dla „{2}â€, ale nie zapewnia metody „ConvertToUnmanaged†z jednym parametrem, która przyjmuje wartość „{2}†jako parametr i zwraca wartość typu „niezarzÄ…dzany†The type '{0}' specified as 'GeneratedComInterfaceAttribute.StringMarshallingCustomType' is not accessible by generated code. The type must have at least 'internal' accessibility. {1} - The type '{0}' specified as 'GeneratedComInterfaceAttribute.StringMarshallingCustomType' is not accessible by generated code. The type must have at least 'internal' accessibility. {1} + Typ „{0}†okreÅ›lony jako „GeneratedComInterfaceAttribute.StringMarshallingCustomType†jest niedostÄ™pny za pomocÄ… wygenerowanego kodu. Typ musi mieć co najmniej uÅ‚atwienia dostÄ™pu „wewnÄ™trznyâ€. {1} {1} is details about which type/containing type is not accessible The return type of 'ToUnmanaged' and the parameter type of 'FromUnmanaged' must be the same. - The return type of 'ToUnmanaged' and the parameter type of 'FromUnmanaged' must be the same. + Zwracany typ elementu „ToUnmanaged†i typ parametru elementu „FromUnmanaged†muszÄ… być takie same. The return type of 'ToUnmanaged' and the parameter type of 'FromUnmanaged' must be the same - The return type of 'ToUnmanaged' and the parameter type of 'FromUnmanaged' must be the same + Zwracany typ elementu „ToUnmanaged†i typ parametru elementu „FromUnmanaged†muszÄ… być takie same The return type of 'ConvertToUnmanaged' and the parameter type of 'ConvertToManaged' must be the same. - The return type of 'ConvertToUnmanaged' and the parameter type of 'ConvertToManaged' must be the same. + Zwracany typ elementu „ConvertToUnmanaged†i typ parametru elementu „ConvertToManaged†muszÄ… być takie same. The return type of 'ConvertToUnmanaged' and the parameter type of 'ConvertToManaged' must be the same - The return type of 'ConvertToUnmanaged' and the parameter type of 'ConvertToManaged' must be the same + Zwracany typ elementu „ConvertToUnmanaged†i typ parametru elementu „ConvertToManaged†muszÄ… być takie same '{0}' has accessibility '{1}'. - '{0}' has accessibility '{1}'. + „{0}†ma uÅ‚atwienia dostÄ™pu „{1}â€. The unmanaged type for a custom marshaller must be a C# unmanaged type. - The unmanaged type for a custom marshaller must be a C# unmanaged type. + Typ niezarzÄ…dzany dla niestandardowego organizatora musi być niezarzÄ…dzanym typem jÄ™zyka C#. The return type of '{0}' must be unmanaged - The return type of '{0}' must be unmanaged + Zwracany typ „{0}†musi być niezarzÄ…dzany 'void*' must be castable to the type so the pinned result of the static 'GetPinnableReference' method can be passed to the native context after being pinned. - 'void*' must be castable to the type so the pinned result of the static 'GetPinnableReference' method can be passed to the native context after being pinned. + Element „void*†musi być rzutowany na typ, aby przypiÄ™ty wynik statycznej metody „GetPinnableReference†mógÅ‚ zostać przekazany do kontekstu macierzystego po przypiÄ™ciu. 'void*' must be castable to the type '{0}' because the managed type '{1}' has a static 'GetPinnableReference' method - 'void*' must be castable to the type '{0}' because the managed type '{1}' has a static 'GetPinnableReference' method + Element „void*†musi być rzutowany na typ „{0}â€, ponieważ typ zarzÄ…dzany „{1}†ma statycznÄ… metodÄ™ „GetPinnableReference†For types that are not supported by source-generated COM, the resulting function pointer will rely on the underlying runtime to marshal the specified type. - For types that are not supported by source-generated COM, the resulting function pointer will rely on the underlying runtime to marshal the specified type. + W przypadku typów, które nie sÄ… obsÅ‚ugiwane przez COM wygenerowany przez źródÅ‚o, wynikowy wskaźnik funkcji bÄ™dzie polegaÅ‚ na bazowym Å›rodowisku uruchomieniowym w celu skierowania okreÅ›lonego typu. For types that are not supported by source-generated P/Invokes, the resulting P/Invoke will rely on the underlying runtime to marshal the specified type. - For types that are not supported by source-generated P/Invokes, the resulting P/Invoke will rely on the underlying runtime to marshal the specified type. + W przypadku typów, które nie sÄ… obsÅ‚ugiwane przez funkcjÄ™ P/Invokes generowanÄ… przez źródÅ‚o, wynikowa funkcja P/Invoke bÄ™dzie polegać na bazowym Å›rodowisku uruchomieniowym, aby skierować okreÅ›lony typ. The type '{0}' is not supported by source-generated COM. The generated source will not handle marshalling of parameter '{1}'. - The type '{0}' is not supported by source-generated COM. The generated source will not handle marshalling of parameter '{1}'. + Typ „{0}†nie jest obsÅ‚ugiwany przez COM generowany przez źródÅ‚o. Wygenerowane źródÅ‚o nie bÄ™dzie obsÅ‚ugiwać skierowania parametru „{1}â€. The type '{0}' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter '{1}'. - The type '{0}' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of parameter '{1}'. + Typ „{0}†nie jest obsÅ‚ugiwany przez funkcjÄ™ P/Invokes generowanÄ… przez źródÅ‚o. Wygenerowane źródÅ‚o nie obsÅ‚uguje skierowania parametru „{1}â€. {0} The generated source will not handle marshalling of parameter '{1}'. - {0} The generated source will not handle marshalling of parameter '{1}'. + {0} Wygenerowane źródÅ‚o nie obsÅ‚uguje skierowania parametru „{1}â€. {0} is a message containing additional details about what is not supported {1} is the name of the parameter The type '{0}' is not supported by source-generated COM. The generated source will not handle marshalling of the return value of method '{1}'. - The type '{0}' is not supported by source-generated COM. The generated source will not handle marshalling of the return value of method '{1}'. + Typ „{0}†nie jest obsÅ‚ugiwany przez COM generowany przez źródÅ‚o. Wygenerowane źródÅ‚o nie bÄ™dzie obsÅ‚ugiwać skierowania wartoÅ›ci zwracanej przez metodÄ™ „{1}â€. The type '{0}' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of the return value of method '{1}'. - The type '{0}' is not supported by source-generated P/Invokes. The generated source will not handle marshalling of the return value of method '{1}'. + Typ „{0}†nie jest obsÅ‚ugiwany przez funkcjÄ™ P/Invokes generowanÄ… przez źródÅ‚o. Wygenerowane źródÅ‚o nie obsÅ‚uguje skierowania wartoÅ›ci zwracanej przez metodÄ™ „{1}â€. {0} The generated source will not handle marshalling of the return value of method '{1}'. - {0} The generated source will not handle marshalling of the return value of method '{1}'. + {0}Wygenerowane źródÅ‚o nie obsÅ‚uguje skierowania wartoÅ›ci zwracanej przez metodÄ™ „{1}â€. {0} is a message containing additional details about what is not supported {1} is the name of the method Specified type is not supported by source-generated P/Invokes - Specified type is not supported by source-generated P/Invokes + OkreÅ›lony typ nie jest obsÅ‚ugiwany przez funkcjÄ™ P/Invokes generowanÄ… przez źródÅ‚o Specified type is not supported by source-generated COM - Specified type is not supported by source-generated COM + OkreÅ›lony typ nie jest obsÅ‚ugiwany przez źródÅ‚owy COM The specified parameter needs to be marshalled from unmanaged to managed, but the marshaller type '{0}' does not support it. - The specified parameter needs to be marshalled from unmanaged to managed, but the marshaller type '{0}' does not support it. + OkreÅ›lony parametr musi być kierowany z niezarzÄ…dzanego do zarzÄ…dzanego, ale typ marszaÅ‚ka „{0}†go nie obsÅ‚uguje. Unnecesssary marshalling info was provided. This marshalling information can be removed without any change in behavior to the application. - Unnecesssary marshalling info was provided. This marshalling information can be removed without any change in behavior to the application. + Niepotrzebne informacje o marshallingu zostaÅ‚y przekazane. Te informacje o marshallingu można usunąć bez żadnych zmian w zachowaniu aplikacji. Unnecessary marshalling info was provided and can be removed. - Unnecessary marshalling info was provided and can be removed. + Niepotrzebne informacje o marshallingu zostaÅ‚y przekazane i można je usunąć. Unnecessary marshalling info '{0}' was provided for parameter '{1}'. {2} - Unnecessary marshalling info '{0}' was provided for parameter '{1}'. {2} + Niepotrzebne informacje o marshallingu „{0}†zostaÅ‚y przekazane dla parametru „{1}â€. {2} Unnecessary marshalling info '{0}' was provided for the return type of method '{1}'. {2} - Unnecessary marshalling info '{0}' was provided for the return type of method '{1}'. {2} + Niepotrzebne informacje o marshallingu „{0}†zostaÅ‚y przekazane dla zwracanego typu metody „{1}â€. {2} A 'Value'-kind native type that supports the 'CallerAllocatedBuffer' feature must provide a two-parameter constructor taking the managed type and a 'Span' of an 'unmanaged' type as parameters - A 'Value'-kind native type that supports the 'CallerAllocatedBuffer' feature must provide a two-parameter constructor taking the managed type and a 'Span' of an 'unmanaged' type as parameters + Typ natywny rodzaju „Valueâ€, który obsÅ‚uguje funkcjÄ™ „CallerAllocatedBuffer†musi zapewniać konstruktora z dwoma parametrami przyjmujÄ…cego typ zarzÄ…dzany i wartość „Span†typu „unmanaged†jako parametry The type '{0}' specifies that it supports 'In' marshalling with the 'CallerAllocatedBuffer' feature for '{1}' but does not provide a two-parameter constructor that takes a '{1}' and 'Span' of an 'unmanaged' type as parameters - The type '{0}' specifies that it supports 'In' marshalling with the 'CallerAllocatedBuffer' feature for '{1}' but does not provide a two-parameter constructor that takes a '{1}' and 'Span' of an 'unmanaged' type as parameters + Typ „{0}†okreÅ›la, że obsÅ‚uguje marshalling „In†z funkcjÄ… „CallerAllocatedBuffer†dla elementu „{1}â€, ale nie zapewnia konstruktora z dwoma parametrami, który przyjmuje wartośći „{1}â€â€Span†typu „unmanaged†jako parametry A 'Value'-kind native type must provide a one-parameter constructor taking the managed type as a parameter - A 'Value'-kind native type must provide a one-parameter constructor taking the managed type as a parameter + Typ natywny rodzaju „Value†musi zapewniać konstruktora z jednym parametrem przyjmujÄ…cego typ zarzÄ…dzany jako parametr The type '{0}' specifies that it supports 'In' marshalling of '{1}' but does not provide a one-parameter constructor that takes a '{1}' as a parameter - The type '{0}' specifies that it supports 'In' marshalling of '{1}' but does not provide a one-parameter constructor that takes a '{1}' as a parameter + Typ „{0}†okreÅ›la, że obsÅ‚uguje skierowanie „In†z elementu „{1}â€, ale nie zapewnia konstruktora z jednym parametrem, który przyjmuje element „{1}†jako parametr From 81af315e31b4113b5a6db886a4216ac4d806a3ab Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 18:44:46 -0700 Subject: [PATCH 039/748] [release/9.0] Add NativeRuntimeEventSource metadata to NativeAot CoreLib (#106713) * Add NativeRuntimeEventSource metadata to NativeAot CoreLib This is necessary to allow consumers to parse the payload. Delete unnecessary runtimeflavor argument of genRuntimeEventSources.py script. Fixes #105556 * Exclude unused keywords and events --- .../System.Private.CoreLib.csproj | 11 +-- .../src/System.Private.CoreLib.csproj | 31 ++++++- src/coreclr/scripts/genRuntimeEventSources.py | 92 ++++++++++++++----- ...ntSource.Threading.NativeSinks.Internal.cs | 11 --- .../System.Private.CoreLib.csproj | 8 +- src/tests/issues.targets | 3 - 6 files changed, 104 insertions(+), 52 deletions(-) diff --git a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj index 5ac4d2d78b58ec..e77a87c6665714 100644 --- a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -302,11 +302,6 @@ - - - - - @@ -317,15 +312,15 @@ - - src\System\Diagnostics\Eventing\Generated\NativeRuntimeEventSource.CoreCLR.cs + + src\System\Diagnostics\Eventing\NativeRuntimeEventSource.Generated.cs - + <_PythonWarningParameter>-Wall <_PythonWarningParameter Condition="'$(MSBuildTreatWarningsAsErrors)' == 'true'">$(_PythonWarningParameter) -Werror diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj index 8cb3c82645e695..fc97632716fd2a 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -571,8 +571,35 @@ + - - + + + + + src\System\Diagnostics\Eventing\NativeRuntimeEventSource.Generated.cs + + + + + + + + <_PythonWarningParameter>-Wall + <_PythonWarningParameter Condition="'$(MSBuildTreatWarningsAsErrors)' == 'true'">$(_PythonWarningParameter) -Werror + <_EventingSourceFileDirectory>%(EventingSourceFile.RootDir)%(EventingSourceFile.Directory) + <_EventingSourceFileDirectory Condition="HasTrailingSlash('$(_EventingSourceFileDirectory)')">$(_EventingSourceFileDirectory.TrimEnd('\')) + + + + + + + + diff --git a/src/coreclr/scripts/genRuntimeEventSources.py b/src/coreclr/scripts/genRuntimeEventSources.py index 5fcfbc0476f119..ed13eeec7238ea 100644 --- a/src/coreclr/scripts/genRuntimeEventSources.py +++ b/src/coreclr/scripts/genRuntimeEventSources.py @@ -5,8 +5,7 @@ import os import xml.dom.minidom as DOM -from utilities import open_for_update -from genEventing import RuntimeFlavor +from utilities import open_for_update, parseInclusionList import argparse import sys @@ -24,12 +23,8 @@ ######################################################################## # START CONFIGURATION ######################################################################## -coreCLRManifestsToGenerate = { - "Microsoft-Windows-DotNETRuntime" : "NativeRuntimeEventSource.CoreCLR.cs" -} - -monoManifestsToGenerate = { - "Microsoft-Windows-DotNETRuntime" : "NativeRuntimeEventSource.Mono.cs" +manifestsToGenerate = { + "Microsoft-Windows-DotNETRuntime" : "NativeRuntimeEventSource.Generated.cs" } providerNameToClassNameMap = { @@ -77,11 +72,22 @@ def writeOutput(outputFile, str): def getCSharpTypeFromManifestType(manifestType): return manifestTypeToCSharpTypeMap[manifestType] -def getManifestsToGenerate(runtimeFlavor): - if runtimeFlavor.coreclr: - return coreCLRManifestsToGenerate - elif runtimeFlavor.mono: - return monoManifestsToGenerate +def getManifestsToGenerate(): + return manifestsToGenerate + +def includeEvent(inclusionList, providerName, eventName): + if len(inclusionList) == 0: + return True + if providerName in inclusionList and eventName in inclusionList[providerName]: + return True + elif providerName in inclusionList and "*" in inclusionList[providerName]: + return True + elif "*" in inclusionList and eventName in inclusionList["*"]: + return True + elif "*" in inclusionList and "*" in inclusionList["*"]: + return True + else: + return False def generateEvent(eventNode, providerNode, outputFile, stringTable): @@ -174,7 +180,9 @@ def generateEvent(eventNode, providerNode, outputFile, stringTable): writeOutput(outputFile, "}\n\n") -def generateEvents(providerNode, outputFile, stringTable): +def generateEvents(providerNode, outputFile, stringTable, inclusion_list): + + providerName = providerNode.getAttribute("name") # Get the events element. for node in providerNode.getElementsByTagName("events"): @@ -188,6 +196,10 @@ def generateEvents(providerNode, outputFile, stringTable): # key = eventID, value = version eventList = dict() for eventNode in eventNodes: + eventName = eventNode.getAttribute('symbol') + if not includeEvent(inclusion_list, providerName, eventName): + continue + eventID = eventNode.getAttribute("value") eventVersion = eventNode.getAttribute("version") eventList[eventID] = eventVersion @@ -195,6 +207,10 @@ def generateEvents(providerNode, outputFile, stringTable): # Iterate over each event node and process it. # Only emit events for the latest version of the event, otherwise EventSource initialization will fail. for eventNode in eventNodes: + eventName = eventNode.getAttribute('symbol') + if not includeEvent(inclusion_list, providerName, eventName): + continue + eventID = eventNode.getAttribute("value") eventVersion = eventNode.getAttribute("version") if eventID in eventList and eventList[eventID] == eventVersion: @@ -305,7 +321,29 @@ def generateEnumTypeMap(providerNode): return typeMap -def generateKeywordsClass(providerNode, outputFile): +def generateKeywordsClass(providerNode, outputFile, inclusion_list): + + providerName = providerNode.getAttribute("name") + + # Get the events element. + for node in providerNode.getElementsByTagName("events"): + eventsNode = node + break + + # Get the list of event nodes. + eventNodes = eventsNode.getElementsByTagName("event") + + # Build the list of used keywords + keywordSet = set() + for eventNode in eventNodes: + eventName = eventNode.getAttribute('symbol') + if not includeEvent(inclusion_list, providerName, eventName): + continue + + # Not all events have keywords specified, and some have multiple keywords specified. + keywords = eventNode.getAttribute("keywords") + if keywords: + keywordSet = keywordSet.union(keywords.split()) # Find the keywords element. for node in providerNode.getElementsByTagName("keywords"): @@ -317,7 +355,11 @@ def generateKeywordsClass(providerNode, outputFile): increaseTabLevel() for keywordNode in keywordsNode.getElementsByTagName("keyword"): - writeOutput(outputFile, "public const EventKeywords " + keywordNode.getAttribute("name") + " = (EventKeywords)" + keywordNode.getAttribute("mask") + ";\n") + keywordName = keywordNode.getAttribute("name") + if keywordName not in keywordSet: + continue; + + writeOutput(outputFile, "public const EventKeywords " + keywordName + " = (EventKeywords)" + keywordNode.getAttribute("mask") + ";\n") decreaseTabLevel() writeOutput(outputFile, "}\n\n") @@ -338,7 +380,7 @@ def loadStringTable(manifest): return stringTable -def generateEventSources(manifestFullPath, intermediatesDirFullPath, runtimeFlavor): +def generateEventSources(manifestFullPath, intermediatesDirFullPath, inclusion_list): # Open the manifest for reading. manifest = DOM.parse(manifestFullPath) @@ -347,7 +389,7 @@ def generateEventSources(manifestFullPath, intermediatesDirFullPath, runtimeFlav stringTable = loadStringTable(manifest) # Iterate over each provider that we want to generate an EventSource for. - for providerName, outputFileName in getManifestsToGenerate(runtimeFlavor).items(): + for providerName, outputFileName in getManifestsToGenerate().items(): for node in manifest.getElementsByTagName("provider"): if node.getAttribute("name") == providerName: providerNode = node @@ -379,7 +421,7 @@ def generateEventSources(manifestFullPath, intermediatesDirFullPath, runtimeFlav increaseTabLevel() # Write the keywords class. - generateKeywordsClass(providerNode, outputFile) + generateKeywordsClass(providerNode, outputFile, inclusion_list) #### Disable enums until they are needed #### # Generate the enum type map. @@ -394,7 +436,7 @@ def generateEventSources(manifestFullPath, intermediatesDirFullPath, runtimeFlav #### Disable enums until they are needed #### # Generate events. - generateEvents(providerNode, outputFile, stringTable) + generateEvents(providerNode, outputFile, stringTable, inclusion_list) # Write the class footer. decreaseTabLevel() @@ -413,8 +455,8 @@ def main(argv): help='full path to manifest containing the description of events') required.add_argument('--intermediate', type=str, required=True, help='full path to eventprovider intermediate directory') - required.add_argument('--runtimeflavor', type=str,default="CoreCLR", - help='runtime flavor') + required.add_argument('--inc', type=str,default="", + help='full path to inclusion list') args, unknown = parser.parse_known_args(argv) if unknown: print('Unknown argument(s): ', ', '.join(unknown)) @@ -422,7 +464,7 @@ def main(argv): manifestFullPath = args.man intermediatesDirFullPath = args.intermediate - runtimeFlavor = RuntimeFlavor(args.runtimeflavor) + inclusion_filename = args.inc # Ensure the intermediates directory exists. try: @@ -431,8 +473,10 @@ def main(argv): if not os.path.isdir(intermediatesDirFullPath): raise + inclusion_list = parseInclusionList(inclusion_filename) + # Generate event sources. - generateEventSources(manifestFullPath, intermediatesDirFullPath, runtimeFlavor) + generateEventSources(manifestFullPath, intermediatesDirFullPath, inclusion_list) return 0 if __name__ == '__main__': diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/NativeRuntimeEventSource.Threading.NativeSinks.Internal.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/NativeRuntimeEventSource.Threading.NativeSinks.Internal.cs index 7e9368dd3e929d..660d65b367e86a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/NativeRuntimeEventSource.Threading.NativeSinks.Internal.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/NativeRuntimeEventSource.Threading.NativeSinks.Internal.cs @@ -10,17 +10,6 @@ namespace System.Diagnostics.Tracing // It contains the runtime specific interop to native event sinks. internal sealed partial class NativeRuntimeEventSource : EventSource { -#if NATIVEAOT - // We don't have these keywords defined from the genRuntimeEventSources.py, so we need to manually define them here. - public static partial class Keywords - { - public const EventKeywords ContentionKeyword = (EventKeywords)0x4000; - public const EventKeywords ThreadingKeyword = (EventKeywords)0x10000; - public const EventKeywords ThreadTransferKeyword = (EventKeywords)0x80000000; - public const EventKeywords WaitHandleKeyword = (EventKeywords)0x40000000000; - } -#endif - [NonEvent] [LibraryImport(RuntimeHelpers.QCall, EntryPoint = "NativeRuntimeEventSource_LogContentionLockCreated")] private static partial void LogContentionLockCreated(nint LockID, nint AssociatedObjectID, ushort ClrInstanceID); diff --git a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj index 20fa27df32e89c..d7983bef487860 100644 --- a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -315,8 +315,8 @@ - - src\System\Diagnostics\Eventing\Generated\NativeRuntimeEventSource.Mono.cs + + src\System\Diagnostics\Eventing\NativeRuntimeEventSource.Generated.cs @@ -327,7 +327,7 @@ DependsOnTargets="FindPython" BeforeTargets="BeforeCompile"> - + <_PythonWarningParameter>-Wall <_PythonWarningParameter Condition="'$(MSBuildTreatWarningsAsErrors)' == 'true'">$(_PythonWarningParameter) -Werror @@ -335,7 +335,7 @@ <_EventingSourceFileDirectory Condition="HasTrailingSlash('$(_EventingSourceFileDirectory)')">$(_EventingSourceFileDirectory.TrimEnd('\')) - + diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 078ca36547d116..0440ee51964ac0 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -686,9 +686,6 @@ - - https://github.com/dotnet/runtime/issues/105556 - https://github.com/dotnet/runtime/issues/102544 From 562efd6824762dd0c1826cc99e006ad34a7e9e85 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Thu, 22 Aug 2024 16:41:30 +0200 Subject: [PATCH 040/748] [release/9.0] Fix compilation of runtime with Xcode 16 (#106800) * Add missing .alt_entry to CoreCLR *_FakeProlog methods * Use .alt_entry on Apple platforms --- .../nativeaot/Runtime/unix/unixasmmacrosamd64.inc | 5 +++++ .../nativeaot/Runtime/unix/unixasmmacrosarm64.inc | 5 ++++- src/coreclr/pal/inc/unixasmmacrosarm64.inc | 5 +++++ src/coreclr/vm/arm64/asmhelpers.S | 14 ++++++++++---- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc index e37614b660c32f..b1a437d8b57ead 100644 --- a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc +++ b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc @@ -33,7 +33,12 @@ C_FUNC(\Name): .endm .macro ALTERNATE_ENTRY Name +#if defined(__APPLE__) + .alt_entry C_FUNC(\Name) + .private_extern C_FUNC(\Name) +#else .global C_FUNC(\Name) +#endif C_FUNC(\Name): .endm diff --git a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosarm64.inc b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosarm64.inc index fc19d451640f43..a02a770aa3b0af 100644 --- a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosarm64.inc +++ b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosarm64.inc @@ -24,8 +24,11 @@ C_FUNC(\Name): .endm .macro ALTERNATE_ENTRY Name +#if defined(__APPLE__) + .alt_entry C_FUNC(\Name) + .private_extern C_FUNC(\Name) +#else .global C_FUNC(\Name) -#if !defined(__APPLE__) .hidden C_FUNC(\Name) #endif C_FUNC(\Name): diff --git a/src/coreclr/pal/inc/unixasmmacrosarm64.inc b/src/coreclr/pal/inc/unixasmmacrosarm64.inc index 976cc825f2eb40..4997e18b39858a 100644 --- a/src/coreclr/pal/inc/unixasmmacrosarm64.inc +++ b/src/coreclr/pal/inc/unixasmmacrosarm64.inc @@ -17,7 +17,12 @@ .endm .macro PATCH_LABEL Name +#if defined(__APPLE__) + .alt_entry C_FUNC(\Name) + .private_extern C_FUNC(\Name) +#else .global C_FUNC(\Name) +#endif C_FUNC(\Name): .endm diff --git a/src/coreclr/vm/arm64/asmhelpers.S b/src/coreclr/vm/arm64/asmhelpers.S index ebfefd693f0744..48c91e65a098de 100644 --- a/src/coreclr/vm/arm64/asmhelpers.S +++ b/src/coreclr/vm/arm64/asmhelpers.S @@ -176,8 +176,7 @@ NESTED_END ThePreStub, _TEXT LEAF_ENTRY ThePreStubPatch, _TEXT nop -.globl C_FUNC(ThePreStubPatchLabel) -C_FUNC(ThePreStubPatchLabel): +PATCH_LABEL ThePreStubPatchLabel ret lr LEAF_END ThePreStubPatch, _TEXT @@ -607,8 +606,12 @@ NESTED_END ResolveWorkerAsmStub, _TEXT #ifdef FEATURE_READYTORUN NESTED_ENTRY DelayLoad_MethodCall_FakeProlog, _TEXT, NoHandler -C_FUNC(DelayLoad_MethodCall): +#if defined(__APPLE__) + .alt_entry C_FUNC(DelayLoad_MethodCall) +#endif .global C_FUNC(DelayLoad_MethodCall) +C_FUNC(DelayLoad_MethodCall): + PROLOG_WITH_TRANSITION_BLOCK add x0, sp, #__PWTB_TransitionBlock // pTransitionBlock @@ -627,8 +630,11 @@ NESTED_END DelayLoad_MethodCall_FakeProlog, _TEXT .macro DynamicHelper frameFlags, suffix NESTED_ENTRY DelayLoad_Helper\suffix\()_FakeProlog, _TEXT, NoHandler -C_FUNC(DelayLoad_Helper\suffix): +#if defined(__APPLE__) + .alt_entry C_FUNC(DelayLoad_Helper\suffix) +#endif .global C_FUNC(DelayLoad_Helper\suffix) +C_FUNC(DelayLoad_Helper\suffix): PROLOG_WITH_TRANSITION_BLOCK From f284a3135be257e3afc4bcbd66173e9734753361 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:54:53 -0700 Subject: [PATCH 041/748] [release/9.0] Fix embedded broadcasts for MaybeIMM instructions (#106802) * Fix embedded broadcasts for MaybeIMM instructions * Update gentree.cpp * Update Runtime_106355.cs --------- Co-authored-by: EgorBo Co-authored-by: Jeff Schwartz --- src/coreclr/jit/gentree.cpp | 7 ++++ .../JitBlue/Runtime_106355/Runtime_106355.cs | 33 +++++++++++++++++++ .../Runtime_106355/Runtime_106355.csproj | 8 +++++ 3 files changed, 48 insertions(+) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106355/Runtime_106355.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106355/Runtime_106355.csproj diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 50adf99687d371..fe3f01aba62b21 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -27008,6 +27008,13 @@ bool GenTreeHWIntrinsic::OperIsEmbBroadcastCompatible() const NamedIntrinsic intrinsicId = GetHWIntrinsicId(); var_types simdBaseType = GetSimdBaseType(); + // MaybeImm intrinsics support embedded broadcasts only for their IMM variants (e.g. PSLLQ) + if (HWIntrinsicInfo::MaybeImm(intrinsicId) && + !HWIntrinsicInfo::isImmOp(intrinsicId, GetOperandArray()[GetOperandCount() - 1])) + { + return false; + } + switch (intrinsicId) { case NI_AVX512F_ConvertToVector256Int32: diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106355/Runtime_106355.cs b/src/tests/JIT/Regression/JitBlue/Runtime_106355/Runtime_106355.cs new file mode 100644 index 00000000000000..f6febf776b9683 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106355/Runtime_106355.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. + +// Generated by Fuzzlyn v2.2 on 2024-08-13 16:48:33 +// Run on X64 Windows +// Seed: 4942966914089696094-vectort,vector128,vector256,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86avx512fx64,x86bmi1,x86bmi1x64,x86bmi2,x86bmi2x64,x86fma,x86lzcnt,x86lzcntx64,x86pclmulqdq,x86popcnt,x86popcntx64,x86sse,x86ssex64,x86sse2,x86sse2x64,x86sse3,x86sse41,x86sse41x64,x86sse42,x86sse42x64,x86ssse3,x86x86base +// Reduced from 83.3 KiB to 0.4 KiB in 00:12:10 +// Exits with error: +// Fatal error. System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception. +// at Program.Main(Fuzzlyn.ExecutionServer.IRuntime) +// at Fuzzlyn.ExecutionServer.Program.g__RunAndGetResultAsync|1_0(Byte[], <>c__DisplayClass1_0 ByRef) +// at Fuzzlyn.ExecutionServer.Program.RunPairAsync(System.Runtime.Loader.AssemblyLoadContext, Fuzzlyn.ExecutionServer.ProgramPair) +// at Fuzzlyn.ExecutionServer.Program+<>c__DisplayClass0_0.
b__0() +// +using System.Runtime.CompilerServices; +using System.Runtime.Intrinsics; +using System.Runtime.Intrinsics.X86; +using Xunit; + +public class Runtime_106355 +{ + private static ulong s_3; + private static Vector128 s_5; + + [Fact] + public static void TestEntrypoint() + { + if (Sse2.IsSupported) + { + s_5 = Sse2.ShiftLeftLogical(s_5, Vector128.Create(s_3)); + } + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106355/Runtime_106355.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_106355/Runtime_106355.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106355/Runtime_106355.csproj @@ -0,0 +1,8 @@ + + + True + + + + + From 0423237e0ad8ce51b73fc7f603b0364424b06b56 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:16:47 -0500 Subject: [PATCH 042/748] Update dependencies from https://github.com/dotnet/emsdk build 20240821.3 (#106813) Microsoft.SourceBuild.Intermediate.emsdk , Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport From Version 9.0.0-rc.1.24420.5 -> To Version 9.0.0-rc.2.24421.3 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 9 ++++----- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 32b54b804e3e0a..6a52b449b19bc4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -64,15 +64,14 @@ c667bfea9cdbc5b5493e49e7ddc8dd635a217891 - + https://github.com/dotnet/emsdk - 9945277ad92ce1d53d6a7a578f9f5bd2af858ddd + 099439b38815c2f6a7821d54dfdc4a3fa16537d1 - - + https://github.com/dotnet/emsdk - 9945277ad92ce1d53d6a7a578f9f5bd2af858ddd + 099439b38815c2f6a7821d54dfdc4a3fa16537d1 diff --git a/eng/Versions.props b/eng/Versions.props index 0663bdef3e627f..61dfb0e5ab4617 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -239,7 +239,7 @@ Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-9_0_100_Transport --> - 9.0.0-rc.1.24420.5 + 9.0.0-rc.2.24421.3 $(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion) 1.1.87-gba258badda From 92707ee15e13e8dc9a7864592ceb67f05b3edc5d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:18:28 -0500 Subject: [PATCH 043/748] Update dependencies from https://github.com/dotnet/roslyn build 20240821.9 (#106814) Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset From Version 4.12.0-2.24420.10 -> To Version 4.12.0-2.24421.9 Co-authored-by: dotnet-maestro[bot] Co-authored-by: Larry Ewing --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6a52b449b19bc4..03ac7dd8ed2da5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -356,17 +356,17 @@ https://github.com/dotnet/runtime-assets 6d82d2732e240983f23ebe53d3cfb8fcd3b3ec0d - + https://github.com/dotnet/roslyn - c63e7b69c8a24803129f63b382c0ab1558112cf6 + 08a167c19e5e04742b0922bdb1ea8046e9364f4b - + https://github.com/dotnet/roslyn - c63e7b69c8a24803129f63b382c0ab1558112cf6 + 08a167c19e5e04742b0922bdb1ea8046e9364f4b - + https://github.com/dotnet/roslyn - c63e7b69c8a24803129f63b382c0ab1558112cf6 + 08a167c19e5e04742b0922bdb1ea8046e9364f4b https://github.com/dotnet/roslyn-analyzers @@ -377,9 +377,9 @@ fdb9965ce68c1f4e1c0ff301488adf9caa958615 - + https://github.com/dotnet/roslyn - c63e7b69c8a24803129f63b382c0ab1558112cf6 + 08a167c19e5e04742b0922bdb1ea8046e9364f4b diff --git a/eng/Versions.props b/eng/Versions.props index 61dfb0e5ab4617..e2122edebcc7a1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -42,9 +42,9 @@ Any tools that contribute to the design-time experience should use the MicrosoftCodeAnalysisVersion_LatestVS property above to ensure they do not break the local dev experience. --> - 4.12.0-2.24420.10 - 4.12.0-2.24420.10 - 4.12.0-2.24420.10 + 4.12.0-2.24421.9 + 4.12.0-2.24421.9 + 4.12.0-2.24421.9 - + https://github.com/dotnet/emsdk 099439b38815c2f6a7821d54dfdc4a3fa16537d1 @@ -88,87 +88,87 @@ - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec https://github.com/dotnet/runtime-assets @@ -328,9 +328,9 @@ https://github.com/dotnet/xharness 9794254fa909ff5adc46326e9b54009793f61dcd - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + c28c6307d0600513219bcd9ab028c0fedbe591ec https://dev.azure.com/dnceng/internal/_git/dotnet-optimization diff --git a/eng/Versions.props b/eng/Versions.props index e2122edebcc7a1..91a91c7f539e23 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -83,22 +83,22 @@ 9.0.100-rc.1.24409.1 - 9.0.0-beta.24420.6 - 9.0.0-beta.24420.6 - 9.0.0-beta.24420.6 - 9.0.0-beta.24420.6 - 2.9.0-beta.24420.6 - 9.0.0-beta.24420.6 - 2.9.0-beta.24420.6 - 9.0.0-beta.24420.6 - 9.0.0-beta.24420.6 - 9.0.0-beta.24420.6 - 9.0.0-beta.24420.6 - 9.0.0-beta.24420.6 - 9.0.0-beta.24420.6 - 9.0.0-beta.24420.6 - 9.0.0-beta.24420.6 - 9.0.0-beta.24420.6 + 9.0.0-beta.24421.7 + 9.0.0-beta.24421.7 + 9.0.0-beta.24421.7 + 9.0.0-beta.24421.7 + 2.9.0-beta.24421.7 + 9.0.0-beta.24421.7 + 2.9.0-beta.24421.7 + 9.0.0-beta.24421.7 + 9.0.0-beta.24421.7 + 9.0.0-beta.24421.7 + 9.0.0-beta.24421.7 + 9.0.0-beta.24421.7 + 9.0.0-beta.24421.7 + 9.0.0-beta.24421.7 + 9.0.0-beta.24421.7 + 9.0.0-beta.24421.7 1.4.0 diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index 2b0a5c9e6655e6..5db4ad71ee2f3e 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -157,7 +157,7 @@ if ($dotnet31Source -ne $null) { 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 } -$dotnetVersions = @('5','6','7','8') +$dotnetVersions = @('5','6','7','8','9') foreach ($dotnetVersion in $dotnetVersions) { $feedPrefix = "dotnet" + $dotnetVersion; diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index b493479a1daf03..4604b61b0323ae 100644 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -99,7 +99,7 @@ if [ "$?" == "0" ]; then PackageSources+=('dotnet3.1-internal-transport') fi -DotNetVersions=('5' '6' '7' '8') +DotNetVersions=('5' '6' '7' '8' '9') for DotNetVersion in ${DotNetVersions[@]} ; do FeedPrefix="dotnet${DotNetVersion}"; diff --git a/global.json b/global.json index c4a1f222a0aaae..8a60777bc71358 100644 --- a/global.json +++ b/global.json @@ -8,9 +8,9 @@ "dotnet": "9.0.100-preview.7.24407.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24420.6", - "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.24420.6", - "Microsoft.DotNet.SharedFramework.Sdk": "9.0.0-beta.24420.6", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24421.7", + "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.24421.7", + "Microsoft.DotNet.SharedFramework.Sdk": "9.0.0-beta.24421.7", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0", "Microsoft.NET.Sdk.IL": "9.0.0-rc.1.24410.5" From 0e5e90a62e7a7c67251f173a09f8d39a11bceff5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:29:15 -0700 Subject: [PATCH 048/748] pal init: InitializeFlushProcessWriteBuffers() before first thread to improve start time (#106836) InitializeFlushProcessWriteBuffers() initializes expedited membarrier() syscall on Linux, which is much slower when called in a multi-thread process. Move this init earlier to improve dotnet process start time. A detailed explanation can be found in issue 106722. Fixes https://github.com/dotnet/runtime/issues/106722 Co-authored-by: Haris Okanovic --- src/coreclr/pal/inc/pal.h | 4 +++- src/coreclr/pal/src/init/pal.cpp | 15 ++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/coreclr/pal/inc/pal.h b/src/coreclr/pal/inc/pal.h index 77b641a5059232..e4a520c1dcf5c9 100644 --- a/src/coreclr/pal/inc/pal.h +++ b/src/coreclr/pal/inc/pal.h @@ -191,6 +191,7 @@ PAL_IsDebuggerPresent(); #define PAL_INITIALIZE_ENSURE_STACK_SIZE 0x20 #define PAL_INITIALIZE_REGISTER_SIGNALS 0x40 #define PAL_INITIALIZE_REGISTER_ACTIVATION_SIGNAL 0x80 +#define PAL_INITIALIZE_FLUSH_PROCESS_WRITE_BUFFERS 0x100 // PAL_Initialize() flags #define PAL_INITIALIZE (PAL_INITIALIZE_SYNC_THREAD | \ @@ -206,7 +207,8 @@ PAL_IsDebuggerPresent(); PAL_INITIALIZE_DEBUGGER_EXCEPTIONS | \ PAL_INITIALIZE_ENSURE_STACK_SIZE | \ PAL_INITIALIZE_REGISTER_SIGNALS | \ - PAL_INITIALIZE_REGISTER_ACTIVATION_SIGNAL) + PAL_INITIALIZE_REGISTER_ACTIVATION_SIGNAL | \ + PAL_INITIALIZE_FLUSH_PROCESS_WRITE_BUFFERS) typedef DWORD (PALAPI_NOEXPORT *PTHREAD_START_ROUTINE)(LPVOID lpThreadParameter); typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE; diff --git a/src/coreclr/pal/src/init/pal.cpp b/src/coreclr/pal/src/init/pal.cpp index 7a8fc556724c1f..a51feb390b44ca 100644 --- a/src/coreclr/pal/src/init/pal.cpp +++ b/src/coreclr/pal/src/init/pal.cpp @@ -382,6 +382,16 @@ Initialize( goto CLEANUP0a; } + if (flags & PAL_INITIALIZE_FLUSH_PROCESS_WRITE_BUFFERS) + { + // Initialize before first thread is created for faster load on Linux + if (!InitializeFlushProcessWriteBuffers()) + { + palError = ERROR_PALINIT_INITIALIZE_FLUSH_PROCESS_WRITE_BUFFERS; + goto CLEANUP0a; + } + } + // The gSharedFilesPath is allocated dynamically so its destructor does not get // called unexpectedly during cleanup gSharedFilesPath = InternalNew(); @@ -787,11 +797,6 @@ PAL_InitializeCoreCLR(const char *szExePath, BOOL runningInExe) return ERROR_PALINIT_PROCABORT_INITIALIZE; } - if (!InitializeFlushProcessWriteBuffers()) - { - return ERROR_PALINIT_INITIALIZE_FLUSH_PROCESS_WRITE_BUFFERS; - } - return ERROR_SUCCESS; } From e90526faa3cb109bbc011c6fefa81b94cd36e6b6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:29:43 -0700 Subject: [PATCH 049/748] Avoid signed overflow in DBG_FlushInstructionCache (#106823) On ARM32 Linux we can have an infinite loop because of integer overflow. For example, if DBG_FlushInstructionCache is called with the following parameters & locals: dwSize = 28 pageSize = 4096 begin = lpBaseAddress = 0x7ffff000 end = begin + dwSize = 0x7ffff01c ALIGN_UP(0x7ffff000, 4096) returns 0x80000000 which is actually a negative number because INT_PTR is just int32_t (on ARM32). And here we are getting an infinite loop because "begin" will never be greater or equal than "end". So, this issue is related to all addresses between INT32_MAX - PAGE_SIZE and INT32_MAX because ALIGN_UP returns the address of the next page which will be greater or equal to INT32_MAX Signed-off-by: Andrei Lalaev Co-authored-by: Andrei Lalaev --- src/coreclr/pal/src/thread/context.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/pal/src/thread/context.cpp b/src/coreclr/pal/src/thread/context.cpp index 2abec3970f1e02..5154ee3c8800f3 100644 --- a/src/coreclr/pal/src/thread/context.cpp +++ b/src/coreclr/pal/src/thread/context.cpp @@ -2068,12 +2068,12 @@ DBG_FlushInstructionCache( // As a workaround, we call __builtin___clear_cache on each page separately. const SIZE_T pageSize = GetVirtualPageSize(); - INT_PTR begin = (INT_PTR)lpBaseAddress; - const INT_PTR end = begin + dwSize; + UINT_PTR begin = (UINT_PTR)lpBaseAddress; + const UINT_PTR end = begin + dwSize; while (begin < end) { - INT_PTR endOrNextPageBegin = ALIGN_UP(begin + 1, pageSize); + UINT_PTR endOrNextPageBegin = ALIGN_UP(begin + 1, pageSize); if (endOrNextPageBegin > end) endOrNextPageBegin = end; From f7b94caddeb75f42a4a670f7505f72588f7e9f41 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 19:44:15 -0500 Subject: [PATCH 050/748] Update dependencies from https://github.com/dotnet/source-build-externals build 20240821.1 (#106812) Microsoft.SourceBuild.Intermediate.source-build-externals From Version 9.0.0-alpha.1.24420.1 -> To Version 9.0.0-alpha.1.24421.1 Co-authored-by: dotnet-maestro[bot] Co-authored-by: Larry Ewing --- eng/Version.Details.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d32f35df171c58..ba3644db0e0012 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -81,9 +81,9 @@ - + https://github.com/dotnet/source-build-externals - ee22054b44ec9615dc3481c4decc1b007a83a2b0 + 457ff6ef4705a0aa8de628a1f2a15474a05b7150 From 4bd35a1fae90abe9894e8f22802c94a84bd8b21e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 08:37:47 -0700 Subject: [PATCH 051/748] [release/9.0] Fix trimming for DiagnosticSource (#106842) * Fix trimming for DiagnosticSource Recent changes to EventSource startup caused the IL trimmer to include portions of the DiagnosticSource assembly. Adding the IsMeterSupported feature check wasn't sufficient because EventSource also roots all of its methods via a DynamicallyAccessedMembers attribute. To ensure that the new methods can be removed when needed I refactored them into a separate EventSourceInitHelper class that won't be rooted by the existing DAM attribute. When EventSouce.IsSupported is false I'd expect the entire EventSourceInitHelper class to be unreachable. If only EventSource.IsMeterSupported is false then I'd expect PreregisterEventProviders and GetMetricsEventSource() to be unreachable but the rest of the class will remain. Hopefully this really fixes #106265 this time. * PR feedback --------- Co-authored-by: Noah Falk Co-authored-by: Jeff Schwartz --- .../System/Diagnostics/Tracing/EventSource.cs | 167 +++++++++--------- 1 file changed, 86 insertions(+), 81 deletions(-) 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 e765a1df9209f5..48ad57547327c2 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 @@ -224,6 +224,65 @@ internal sealed class EventSourceAutoGenerateAttribute : Attribute [DynamicallyAccessedMembers(ManifestMemberTypes)] public partial class EventSource : IDisposable { + // private instance state + private string m_name = null!; // My friendly name (privided in ctor) + internal int m_id; // A small integer that is unique to this instance. + private Guid m_guid; // GUID representing the ETW eventSource to the OS. + internal volatile EventMetadata[]? m_eventData; // None per-event data + private volatile byte[]? m_rawManifest; // Bytes to send out representing the event schema + + private EventHandler? m_eventCommandExecuted; + + private readonly EventSourceSettings m_config; // configuration information + + private bool m_eventSourceDisposed; // has Dispose been called. + + // Enabling bits + private bool m_eventSourceEnabled; // am I enabled (any of my events are enabled for any dispatcher) + internal EventLevel m_level; // highest level enabled by any output dispatcher + internal EventKeywords m_matchAnyKeyword; // the logical OR of all levels enabled by any output dispatcher (zero is a special case) meaning 'all keywords' + + // Dispatching state + internal volatile EventDispatcher? m_Dispatchers; // Linked list of code:EventDispatchers we write the data to (we also do ETW specially) + private volatile OverrideEventProvider m_etwProvider = null!; // This hooks up ETW commands to our 'OnEventCommand' callback +#if FEATURE_PERFTRACING + private object? m_createEventLock; + private IntPtr m_writeEventStringEventHandle = IntPtr.Zero; + private volatile OverrideEventProvider m_eventPipeProvider = null!; +#endif + private bool m_completelyInited; // The EventSource constructor has returned without exception. + private Exception? m_constructionException; // If there was an exception construction, this is it + private byte m_outOfBandMessageCount; // The number of out of band messages sent (we throttle them + private EventCommandEventArgs? m_deferredCommands; // If we get commands before we are fully we store them here and run the when we are fully inited. + + private string[]? m_traits; // Used to implement GetTraits + + [ThreadStatic] + private static byte m_EventSourceExceptionRecurenceCount; // current recursion count inside ThrowEventSourceException + + internal volatile ulong[]? m_channelData; + + // We use a single instance of ActivityTracker for all EventSources instances to allow correlation between multiple event providers. + // We have m_activityTracker field simply because instance field is more efficient than static field fetch. + private ActivityTracker m_activityTracker = null!; + internal const string ActivityStartSuffix = "Start"; + internal const string ActivityStopSuffix = "Stop"; + + // This switch controls an opt-in, off-by-default mechanism for allowing multiple EventSources to have the same + // name and by extension GUID. This is not considered a mainline scenario and is explicitly intended as a release + // valve for users that make heavy use of AssemblyLoadContext and experience exceptions from EventSource. + // This does not solve any issues that might arise from this configuration. For instance: + // + // * If multiple manifest-mode EventSources have the same name/GUID, it is ambiguous which manifest should be used by an ETW parser. + // This can result in events being incorrectly parse. The data will still be there, but EventTrace (or other libraries) won't + // know how to parse it. + // * Potential issues in parsing self-describing EventSources that use the same name/GUID, event name, and payload type from the same AssemblyLoadContext + // but have different event IDs set. + // + // Most users should not turn this on. + internal const string DuplicateSourceNamesSwitch = "System.Diagnostics.Tracing.EventSource.AllowDuplicateSourceNames"; + private static readonly bool AllowDuplicateSourceNames = AppContext.TryGetSwitch(DuplicateSourceNamesSwitch, out bool isEnabled) ? isEnabled : false; + internal static bool IsSupported { get; } = InitializeIsSupported(); @@ -1608,7 +1667,7 @@ private unsafe void Initialize(Guid eventSourceGuid, string eventSourceName, str // Register the provider with ETW Func eventSourceFactory = () => this; - OverrideEventProvider? etwProvider = TryGetPreregisteredEtwProvider(eventSourceGuid); + OverrideEventProvider? etwProvider = EventSourceInitHelper.TryGetPreregisteredEtwProvider(eventSourceGuid); if(etwProvider == null) { etwProvider = new OverrideEventProvider(eventSourceFactory, EventProviderType.ETW); @@ -1632,7 +1691,7 @@ private unsafe void Initialize(Guid eventSourceGuid, string eventSourceName, str #if FEATURE_PERFTRACING // Register the provider with EventPipe - OverrideEventProvider? eventPipeProvider = TryGetPreregisteredEventPipeProvider(eventSourceName); + OverrideEventProvider? eventPipeProvider = EventSourceInitHelper.TryGetPreregisteredEventPipeProvider(eventSourceName); if (eventPipeProvider == null) { eventPipeProvider = new OverrideEventProvider(eventSourceFactory, EventProviderType.EventPipe); @@ -2407,7 +2466,7 @@ internal static EventOpcode GetOpcodeWithDefault(EventOpcode opcode, string? eve /// /// This class lets us hook the 'OnEventCommand' from the eventSource. /// - private sealed class OverrideEventProvider : EventProvider + internal sealed class OverrideEventProvider : EventProvider { public OverrideEventProvider(Func eventSourceFactory, EventProviderType providerType) : base(providerType) @@ -3840,11 +3899,24 @@ internal static void InitializeDefaultEventSources() { const string name = "System.Diagnostics.Metrics"; Guid id = new Guid("20752bc4-c151-50f5-f27b-df92d8af5a61"); - PreregisterEventProviders(id, name, GetMetricsEventSource); + EventSourceInitHelper.PreregisterEventProviders(id, name, EventSourceInitHelper.GetMetricsEventSource); } } +#endregion + } + + // This type is logically just more static EventSource functionality but it needs to be a separate class + // to ensure that the IL linker can remove unused methods in it. Methods defined within the EventSource type + // are never removed because EventSource has the potential to reflect over its own members. + internal static class EventSourceInitHelper + { + private static List> s_preregisteredEventSourceFactories = new List>(); + private static readonly Dictionary s_preregisteredEtwProviders = new Dictionary(); +#if FEATURE_PERFTRACING + private static readonly Dictionary s_preregisteredEventPipeProviders = new Dictionary(); +#endif - private static EventSource? GetMetricsEventSource() + internal static EventSource? GetMetricsEventSource() { Type? metricsEventSourceType = Type.GetType( "System.Diagnostics.Metrics.MetricsEventSource, System.Diagnostics.DiagnosticSource", @@ -3864,7 +3936,7 @@ internal static void InitializeDefaultEventSources() // Pre-registration creates and registers an EventProvider prior to the EventSource being constructed. // If a tracing session is started using the provider then the EventSource will be constructed on demand. - private static unsafe void PreregisterEventProviders(Guid id, string name, Func eventSourceFactory) + internal static unsafe void PreregisterEventProviders(Guid id, string name, Func eventSourceFactory) { // NOTE: Pre-registration has some minor limitations and variations to normal EventSource behavior: // 1. Instead of delivering OnEventCommand callbacks during the EventSource constructor it may deliver them after @@ -3882,7 +3954,7 @@ private static unsafe void PreregisterEventProviders(Guid id, string name, Func< { s_preregisteredEventSourceFactories.Add(eventSourceFactory); - OverrideEventProvider etwProvider = new OverrideEventProvider(eventSourceFactory, EventProviderType.ETW); + EventSource.OverrideEventProvider etwProvider = new EventSource.OverrideEventProvider(eventSourceFactory, EventProviderType.ETW); etwProvider.Register(id, name); #if TARGET_WINDOWS byte[] providerMetadata = Statics.MetadataForString(name, 0, 0, 0); @@ -3900,7 +3972,7 @@ private static unsafe void PreregisterEventProviders(Guid id, string name, Func< } #if FEATURE_PERFTRACING - OverrideEventProvider eventPipeProvider = new OverrideEventProvider(eventSourceFactory, EventProviderType.EventPipe); + EventSource.OverrideEventProvider eventPipeProvider = new EventSource.OverrideEventProvider(eventSourceFactory, EventProviderType.EventPipe); eventPipeProvider.Register(id, name); lock (s_preregisteredEventPipeProviders) { @@ -3928,7 +4000,7 @@ internal static void EnsurePreregisteredEventSourcesExist() // the list as long as we still guarantee they get initialized in the near future and reported to the // same EventListener.OnEventSourceCreated() callback. Func[] factories; - lock(s_preregisteredEventSourceFactories) + lock (s_preregisteredEventSourceFactories) { factories = s_preregisteredEventSourceFactories.ToArray(); s_preregisteredEventSourceFactories.Clear(); @@ -3939,92 +4011,25 @@ internal static void EnsurePreregisteredEventSourcesExist() } } - private static List> s_preregisteredEventSourceFactories = new List>(); - - private static OverrideEventProvider? TryGetPreregisteredEtwProvider(Guid id) + internal static EventSource.OverrideEventProvider? TryGetPreregisteredEtwProvider(Guid id) { lock (s_preregisteredEtwProviders) { - s_preregisteredEtwProviders.Remove(id, out OverrideEventProvider? provider); + s_preregisteredEtwProviders.Remove(id, out EventSource.OverrideEventProvider? provider); return provider; } } - private static readonly Dictionary s_preregisteredEtwProviders = new Dictionary(); - #if FEATURE_PERFTRACING - private static OverrideEventProvider? TryGetPreregisteredEventPipeProvider(string name) + internal static EventSource.OverrideEventProvider? TryGetPreregisteredEventPipeProvider(string name) { lock (s_preregisteredEventPipeProviders) { - s_preregisteredEventPipeProviders.Remove(name, out OverrideEventProvider? provider); + s_preregisteredEventPipeProviders.Remove(name, out EventSource.OverrideEventProvider? provider); return provider; } } - - private static readonly Dictionary s_preregisteredEventPipeProviders = new Dictionary(); #endif - - // private instance state - private string m_name = null!; // My friendly name (privided in ctor) - internal int m_id; // A small integer that is unique to this instance. - private Guid m_guid; // GUID representing the ETW eventSource to the OS. - internal volatile EventMetadata[]? m_eventData; // None per-event data - private volatile byte[]? m_rawManifest; // Bytes to send out representing the event schema - - private EventHandler? m_eventCommandExecuted; - - private readonly EventSourceSettings m_config; // configuration information - - private bool m_eventSourceDisposed; // has Dispose been called. - - // Enabling bits - private bool m_eventSourceEnabled; // am I enabled (any of my events are enabled for any dispatcher) - internal EventLevel m_level; // highest level enabled by any output dispatcher - internal EventKeywords m_matchAnyKeyword; // the logical OR of all levels enabled by any output dispatcher (zero is a special case) meaning 'all keywords' - - // Dispatching state - internal volatile EventDispatcher? m_Dispatchers; // Linked list of code:EventDispatchers we write the data to (we also do ETW specially) - private volatile OverrideEventProvider m_etwProvider = null!; // This hooks up ETW commands to our 'OnEventCommand' callback -#if FEATURE_PERFTRACING - private object? m_createEventLock; - private IntPtr m_writeEventStringEventHandle = IntPtr.Zero; - private volatile OverrideEventProvider m_eventPipeProvider = null!; -#endif - private bool m_completelyInited; // The EventSource constructor has returned without exception. - private Exception? m_constructionException; // If there was an exception construction, this is it - private byte m_outOfBandMessageCount; // The number of out of band messages sent (we throttle them - private EventCommandEventArgs? m_deferredCommands; // If we get commands before we are fully we store them here and run the when we are fully inited. - - private string[]? m_traits; // Used to implement GetTraits - - [ThreadStatic] - private static byte m_EventSourceExceptionRecurenceCount; // current recursion count inside ThrowEventSourceException - - internal volatile ulong[]? m_channelData; - - // We use a single instance of ActivityTracker for all EventSources instances to allow correlation between multiple event providers. - // We have m_activityTracker field simply because instance field is more efficient than static field fetch. - private ActivityTracker m_activityTracker = null!; - internal const string ActivityStartSuffix = "Start"; - internal const string ActivityStopSuffix = "Stop"; - - // This switch controls an opt-in, off-by-default mechanism for allowing multiple EventSources to have the same - // name and by extension GUID. This is not considered a mainline scenario and is explicitly intended as a release - // valve for users that make heavy use of AssemblyLoadContext and experience exceptions from EventSource. - // This does not solve any issues that might arise from this configuration. For instance: - // - // * If multiple manifest-mode EventSources have the same name/GUID, it is ambiguous which manifest should be used by an ETW parser. - // This can result in events being incorrectly parse. The data will still be there, but EventTrace (or other libraries) won't - // know how to parse it. - // * Potential issues in parsing self-describing EventSources that use the same name/GUID, event name, and payload type from the same AssemblyLoadContext - // but have different event IDs set. - // - // Most users should not turn this on. - internal const string DuplicateSourceNamesSwitch = "System.Diagnostics.Tracing.EventSource.AllowDuplicateSourceNames"; - private static readonly bool AllowDuplicateSourceNames = AppContext.TryGetSwitch(DuplicateSourceNamesSwitch, out bool isEnabled) ? isEnabled : false; - -#endregion } /// @@ -4585,7 +4590,7 @@ private void CallBackForExistingEventSources(bool addToListenersList, EventHandl { // Pre-registered EventSources may not have been constructed yet but we need to do so now to ensure they are // reported to the EventListener. - EventSource.EnsurePreregisteredEventSourcesExist(); + EventSourceInitHelper.EnsurePreregisteredEventSourcesExist(); lock (EventListenersLock) { From 5ec43e0996c6d8882d5cba4dd6beeb698dd3e791 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:53:35 -0700 Subject: [PATCH 052/748] [release/9.0] Fix stack overflow in the configuration source gen (#106668) * Fix StackOverFlow in the Logging source gen * Address the feedback * Avoid static field --------- Co-authored-by: Tarek Mahmoud Sayed Co-authored-by: Larry Ewing --- .../ConfigurationBindingGenerator.Parser.cs | 56 ++++++++++--- .../gen/Specs/BindingHelperInfo.cs | 9 ++- .../ConfigurationBinderTests.TestClasses.cs | 9 +++ .../tests/Common/ConfigurationBinderTests.cs | 81 +++++++++++++++++++ 4 files changed, 141 insertions(+), 14 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/ConfigurationBindingGenerator.Parser.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/ConfigurationBindingGenerator.Parser.cs index 0982628197ea65..dc940d2cb07875 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/ConfigurationBindingGenerator.Parser.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/ConfigurationBindingGenerator.Parser.cs @@ -552,7 +552,9 @@ private bool IsAssignableTo(ITypeSymbol source, ITypeSymbol dest) return conversion.IsReference && conversion.IsImplicit; } - private bool IsUnsupportedType(ITypeSymbol type) + private HashSet? _visitedTypes = new(SymbolEqualityComparer.Default); + + private bool IsUnsupportedType(ITypeSymbol type, HashSet? visitedTypes = null) { if (type.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T) { @@ -569,25 +571,55 @@ private bool IsUnsupportedType(ITypeSymbol type) return true; } - if (type is IArrayTypeSymbol arrayTypeSymbol) + if (visitedTypes?.Contains(type) is true) { - return arrayTypeSymbol.Rank > 1 || IsUnsupportedType(arrayTypeSymbol.ElementType); + // avoid infinite recursion in nested types like + // public record RecursiveType + // { + // public TreeElement? Tree { get; set; } + // } + // public sealed class TreeElement : Dictionary; + // + // return false for the second call. The type will continue be checked in the first call anyway. + return false; } - if (IsCollection(type)) + IArrayTypeSymbol? arrayTypeSymbol = type as IArrayTypeSymbol; + if (arrayTypeSymbol is null) { - INamedTypeSymbol collectionType = (INamedTypeSymbol)type; - - if (IsCandidateDictionary(collectionType, out ITypeSymbol? keyType, out ITypeSymbol? elementType)) - { - return IsUnsupportedType(keyType) || IsUnsupportedType(elementType); - } - else if (TryGetElementType(collectionType, out elementType)) + if (!IsCollection(type)) { - return IsUnsupportedType(elementType); + return false; } } + if (visitedTypes is null) + { + visitedTypes = _visitedTypes; + visitedTypes.Clear(); + } + + visitedTypes.Add(type); + + if (arrayTypeSymbol is not null) + { + return arrayTypeSymbol.Rank > 1 || IsUnsupportedType(arrayTypeSymbol.ElementType, visitedTypes); + } + + Debug.Assert(IsCollection(type)); + + INamedTypeSymbol collectionType = (INamedTypeSymbol)type; + + if (IsCandidateDictionary(collectionType, out ITypeSymbol? keyType, out ITypeSymbol? elementType)) + { + return IsUnsupportedType(keyType, visitedTypes) || IsUnsupportedType(elementType, visitedTypes); + } + + if (TryGetElementType(collectionType, out elementType)) + { + return IsUnsupportedType(elementType, visitedTypes); + } + return false; } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Specs/BindingHelperInfo.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Specs/BindingHelperInfo.cs index dfa3c5f1690487..5cdc40e011517d 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Specs/BindingHelperInfo.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Specs/BindingHelperInfo.cs @@ -131,6 +131,9 @@ bool TryRegisterCore() } case DictionarySpec dictionarySpec: { + // Base case to avoid stack overflow for recursive object graphs. + _seenTransitiveTypes.Add(typeRef, true); + bool shouldRegister = _typeIndex.CanBindTo(typeRef) && TryRegisterTransitiveTypesForMethodGen(dictionarySpec.KeyTypeRef) && TryRegisterTransitiveTypesForMethodGen(dictionarySpec.ElementTypeRef) && @@ -145,6 +148,9 @@ bool TryRegisterCore() } case CollectionSpec collectionSpec: { + // Base case to avoid stack overflow for recursive object graphs. + _seenTransitiveTypes.Add(typeRef, true); + if (_typeIndex.GetTypeSpec(collectionSpec.ElementTypeRef) is ComplexTypeSpec) { _namespaces.Add("System.Linq"); @@ -157,8 +163,7 @@ bool TryRegisterCore() { // Base case to avoid stack overflow for recursive object graphs. // Register all object types for gen; we need to throw runtime exceptions in some cases. - bool shouldRegister = true; - _seenTransitiveTypes.Add(typeRef, shouldRegister); + _seenTransitiveTypes.Add(typeRef, true); // List is used in generated code as a temp holder for formatting // an error for config properties that don't map to object properties. diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.TestClasses.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.TestClasses.cs index 28209c1c5deb7b..74de2804741042 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.TestClasses.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.TestClasses.cs @@ -189,6 +189,15 @@ public string Color } } + public sealed class TreeElement : Dictionary; + + public record TypeWithRecursionThroughCollections + { + public TreeElement? Tree { get; set; } + public TreeElement?[]? Flat { get; set; } + public List? List { get; set; } + } + public record RecordWithArrayParameter(string[] Array); public readonly record struct ReadonlyRecordStructTypeOptions(string Color, int Length); diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs index 6ce085d5ec9cde..9e95c80643ed20 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs @@ -1544,6 +1544,87 @@ public void CanBindOnParametersAndProperties_RecordWithArrayConstructorParameter Assert.Equal(new string[] { "a", "b", "c" }, options.Array); } + /// + /// Test binding to recursive types using Dictionary or Collections. + /// This ensure no stack overflow will occur during the compilation through the source gen or at runtime. + /// + [Fact] + public void BindToRecursiveTypesTest() + { + string jsonConfig = @"{ + ""Tree"": { + ""Branch1"": { + ""Leaf1"": {}, + ""Leaf2"": {} + }, + ""Branch2"": { + ""Leaf3"": {} + } + }, + ""Flat"": [ + { + ""Element1"": { + ""SubElement1"": {} + } + }, + { + ""Element2"": { + ""SubElement2"": {} + } + }, + { + ""Element3"": {} + } + ], + ""List"": [ + { + ""Item1"": { + ""NestedItem1"": {} + } + }, + { + ""Item2"": {} + }, + ] + }"; + + var configuration = new ConfigurationBuilder() + .AddJsonStream(new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(jsonConfig))) + .Build(); + + var instance = new TypeWithRecursionThroughCollections(); + configuration.Bind(instance); + + // Validate the dictionary + Assert.NotNull(instance.Tree); + Assert.Equal(2, instance.Tree.Count); + Assert.NotNull(instance.Tree["Branch1"]); + Assert.Equal(2, instance.Tree["Branch1"].Count); + Assert.Equal(["Leaf1", "Leaf2"], instance.Tree["Branch1"].Keys); + Assert.Equal(["Leaf3"], instance.Tree["Branch2"].Keys); + + // Validate the array + Assert.NotNull(instance.Flat); + Assert.Equal(3, instance.Flat.Length); + Assert.Equal(["Element1"], instance.Flat[0].Keys); + Assert.Equal(["Element2"], instance.Flat[1].Keys); + Assert.Equal(["Element3"], instance.Flat[2].Keys); + Assert.Equal(1, instance.Flat[0].Values.Count); + Assert.Equal(["SubElement1"], instance.Flat[0].Values.ToArray()[0].Keys); + Assert.Equal(1, instance.Flat[1].Values.Count); + Assert.Equal(["SubElement2"], instance.Flat[1].Values.ToArray()[0].Keys); + Assert.Equal(1, instance.Flat[2].Values.Count); + + // Validate the List + Assert.NotNull(instance.Flat); + Assert.Equal(2, instance.List.Count); + Assert.Equal(["Item1"], instance.List[0].Keys); + Assert.Equal(["Item2"], instance.List[1].Keys); + Assert.Equal(1, instance.List[0].Values.Count); + Assert.Equal(["NestedItem1"], instance.List[0].Values.ToArray()[0].Keys); + Assert.Equal(1, instance.List[1].Values.Count); + } + [Fact] public void CanBindReadonlyRecordStructOptions() { From 0ee150e25e32f2b0ec64350211c7298bcf4d9338 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:36:29 -0700 Subject: [PATCH 053/748] [release/9.0] Ensure that constant folding of bitwise operations for float/double are bitwise (#106830) * Ensure that constant folding of bitwise operations for float/double are bitwise * Ensure that the new header only methods are marked `inline` to avoid duplicate definitions * Apply formatting patch --------- Co-authored-by: Tanner Gooding Co-authored-by: Jeff Schwartz --- src/coreclr/jit/simd.h | 111 ++++++++++++++---- .../JitBlue/Runtime_106610/Runtime_106610.cs | 43 +++++++ .../Runtime_106610/Runtime_106610.csproj | 8 ++ 3 files changed, 136 insertions(+), 26 deletions(-) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106610/Runtime_106610.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106610/Runtime_106610.csproj diff --git a/src/coreclr/jit/simd.h b/src/coreclr/jit/simd.h index 9aa1a36f682500..1a0748667b3a58 100644 --- a/src/coreclr/jit/simd.h +++ b/src/coreclr/jit/simd.h @@ -363,6 +363,11 @@ typedef simd64_t simd_t; typedef simd16_t simd_t; #endif +inline bool IsUnaryBitwiseOperation(genTreeOps oper) +{ + return (oper == GT_LZCNT) || (oper == GT_NOT); +} + template TBase EvaluateUnaryScalarSpecialized(genTreeOps oper, TBase arg0) { @@ -404,27 +409,35 @@ TBase EvaluateUnaryScalarSpecialized(genTreeOps oper, TBase arg0) template <> inline float EvaluateUnaryScalarSpecialized(genTreeOps oper, float arg0) { - if (oper == GT_NEG) + switch (oper) { - return -arg0; - } + case GT_NEG: + { + return -arg0; + } - uint32_t arg0Bits = BitOperations::SingleToUInt32Bits(arg0); - uint32_t resultBits = EvaluateUnaryScalarSpecialized(oper, arg0Bits); - return BitOperations::UInt32BitsToSingle(resultBits); + default: + { + unreached(); + } + } } template <> inline double EvaluateUnaryScalarSpecialized(genTreeOps oper, double arg0) { - if (oper == GT_NEG) + switch (oper) { - return -arg0; - } + case GT_NEG: + { + return -arg0; + } - uint64_t arg0Bits = BitOperations::DoubleToUInt64Bits(arg0); - uint64_t resultBits = EvaluateUnaryScalarSpecialized(oper, arg0Bits); - return BitOperations::UInt64BitsToDouble(resultBits); + default: + { + unreached(); + } + } } template @@ -600,13 +613,37 @@ void EvaluateUnarySimd(genTreeOps oper, bool scalar, var_types baseType, TSimd* { case TYP_FLOAT: { - EvaluateUnarySimd(oper, scalar, result, arg0); + // Some operations are bitwise and we want to ensure inputs like + // sNaN are preserved rather than being converted to a qNaN when + // the CPU encounters them. So we check for and handle that early + // prior to extracting the element out of the vector value. + + if (IsUnaryBitwiseOperation(oper)) + { + EvaluateUnarySimd(oper, scalar, result, arg0); + } + else + { + EvaluateUnarySimd(oper, scalar, result, arg0); + } break; } case TYP_DOUBLE: { - EvaluateUnarySimd(oper, scalar, result, arg0); + // Some operations are bitwise and we want to ensure inputs like + // sNaN are preserved rather than being converted to a qNaN when + // the CPU encounters them. So we check for and handle that early + // prior to extracting the element out of the vector value. + + if (IsUnaryBitwiseOperation(oper)) + { + EvaluateUnarySimd(oper, scalar, result, arg0); + } + else + { + EvaluateUnarySimd(oper, scalar, result, arg0); + } break; } @@ -665,6 +702,12 @@ void EvaluateUnarySimd(genTreeOps oper, bool scalar, var_types baseType, TSimd* } } +inline bool IsBinaryBitwiseOperation(genTreeOps oper) +{ + return (oper == GT_AND) || (oper == GT_AND_NOT) || (oper == GT_LSH) || (oper == GT_OR) || (oper == GT_ROL) || + (oper == GT_ROR) || (oper == GT_RSH) || (oper == GT_RSZ) || (oper == GT_XOR); +} + template TBase EvaluateBinaryScalarRSZ(TBase arg0, TBase arg1) { @@ -902,11 +945,7 @@ inline float EvaluateBinaryScalarSpecialized(genTreeOps oper, float arg0, default: { - uint32_t arg0Bits = BitOperations::SingleToUInt32Bits(arg0); - uint32_t arg1Bits = BitOperations::SingleToUInt32Bits(arg1); - - uint32_t resultBits = EvaluateBinaryScalarSpecialized(oper, arg0Bits, arg1Bits); - return BitOperations::UInt32BitsToSingle(resultBits); + unreached(); } } } @@ -948,11 +987,7 @@ inline double EvaluateBinaryScalarSpecialized(genTreeOps oper, double ar default: { - uint64_t arg0Bits = BitOperations::DoubleToUInt64Bits(arg0); - uint64_t arg1Bits = BitOperations::DoubleToUInt64Bits(arg1); - - uint64_t resultBits = EvaluateBinaryScalarSpecialized(oper, arg0Bits, arg1Bits); - return BitOperations::UInt64BitsToDouble(resultBits); + unreached(); } } } @@ -1188,13 +1223,37 @@ void EvaluateBinarySimd( { case TYP_FLOAT: { - EvaluateBinarySimd(oper, scalar, result, arg0, arg1); + // Some operations are bitwise and we want to ensure inputs like + // sNaN are preserved rather than being converted to a qNaN when + // the CPU encounters them. So we check for and handle that early + // prior to extracting the element out of the vector value. + + if (IsBinaryBitwiseOperation(oper)) + { + EvaluateBinarySimd(oper, scalar, result, arg0, arg1); + } + else + { + EvaluateBinarySimd(oper, scalar, result, arg0, arg1); + } break; } case TYP_DOUBLE: { - EvaluateBinarySimd(oper, scalar, result, arg0, arg1); + // Some operations are bitwise and we want to ensure inputs like + // sNaN are preserved rather than being converted to a qNaN when + // the CPU encounters them. So we check for and handle that early + // prior to extracting the element out of the vector value. + + if (IsBinaryBitwiseOperation(oper)) + { + EvaluateBinarySimd(oper, scalar, result, arg0, arg1); + } + else + { + EvaluateBinarySimd(oper, scalar, result, arg0, arg1); + } break; } diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106610/Runtime_106610.cs b/src/tests/JIT/Regression/JitBlue/Runtime_106610/Runtime_106610.cs new file mode 100644 index 00000000000000..506451c29e6400 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106610/Runtime_106610.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.Numerics; +using System.Runtime.Intrinsics; +using System.Runtime.Intrinsics.X86; +using Xunit; + +// Generated by Fuzzlyn v2.2 on 2024-08-17 17:40:06 +// Run on X86 Windows +// Seed: 1343518557351353159-vectort,vector128,vector256,vector512,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86avx512vbmi,x86avx512vbmivl,x86bmi1,x86bmi2,x86fma,x86lzcnt,x86pclmulqdq,x86popcnt,x86sse,x86sse2,x86sse3,x86sse41,x86sse42,x86ssse3,x86x86base +// Reduced from 171.2 KiB to 0.6 KiB in 00:06:37 +// Debug: Outputs <4292870144, 0, 0, 0, 0, 0, 0, 0> +// Release: Outputs <0, 0, 0, 0, 0, 0, 0, 0> + +public class C1 +{ + public Vector256 F5; + + public C1(Vector256 f5) + { + F5 = f5; + } +} + +public class Runtime_106610 +{ + [Fact] + public static void TestEntryPoint() + { + if (Avx512DQ.VL.IsSupported) + { + var vr4 = Vector256.Create(0); + var vr5 = Vector256.CreateScalar(1f); + var vr6 = Vector256.CreateScalar(-10f); + var vr7 = Avx.Or(vr5, vr6); + C1 vr8 = new C1(Avx512DQ.VL.Range(vr4, vr7, 0)); + Assert.Equal(Vector256.CreateScalar(4292870144), vr8.F5.AsUInt32()); + } + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106610/Runtime_106610.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_106610/Runtime_106610.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106610/Runtime_106610.csproj @@ -0,0 +1,8 @@ + + + True + + + + + From 37aa317a331f0b1aaf3cf9b4346f3a05e95a3454 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 14:13:34 -0700 Subject: [PATCH 054/748] Update dependencies from https://github.com/dotnet/emsdk build 20240822.4 (#106878) Microsoft.SourceBuild.Intermediate.emsdk , Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport From Version 9.0.0-rc.1.24420.5 -> To Version 9.0.0-rc.2.24422.4 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ba3644db0e0012..eb120c881924e0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -64,14 +64,14 @@ c667bfea9cdbc5b5493e49e7ddc8dd635a217891 - + https://github.com/dotnet/emsdk - 099439b38815c2f6a7821d54dfdc4a3fa16537d1 + 84d642485896a97e0e443be75345c6bb1469a338 - + https://github.com/dotnet/emsdk - 099439b38815c2f6a7821d54dfdc4a3fa16537d1 + 84d642485896a97e0e443be75345c6bb1469a338 diff --git a/eng/Versions.props b/eng/Versions.props index 91a91c7f539e23..6740feb993b6bd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -239,7 +239,7 @@ Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-9_0_100_Transport --> - 9.0.0-rc.2.24421.3 + 9.0.0-rc.2.24422.4 $(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion) 1.1.87-gba258badda From 6e017babbef5af31bcca79e05d1a553374f0c45f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2024 14:13:48 -0700 Subject: [PATCH 055/748] Update dependencies from https://github.com/dotnet/roslyn build 20240822.8 (#106879) Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset From Version 4.12.0-2.24421.9 -> To Version 4.12.0-2.24422.8 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index eb120c881924e0..763aca271d8f7c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -356,17 +356,17 @@ https://github.com/dotnet/runtime-assets 6d82d2732e240983f23ebe53d3cfb8fcd3b3ec0d - + https://github.com/dotnet/roslyn - 08a167c19e5e04742b0922bdb1ea8046e9364f4b + d30a570bb6c9b2f204db9e6ee65fc5316449fd4e - + https://github.com/dotnet/roslyn - 08a167c19e5e04742b0922bdb1ea8046e9364f4b + d30a570bb6c9b2f204db9e6ee65fc5316449fd4e - + https://github.com/dotnet/roslyn - 08a167c19e5e04742b0922bdb1ea8046e9364f4b + d30a570bb6c9b2f204db9e6ee65fc5316449fd4e https://github.com/dotnet/roslyn-analyzers @@ -377,9 +377,9 @@ fdb9965ce68c1f4e1c0ff301488adf9caa958615 - + https://github.com/dotnet/roslyn - 08a167c19e5e04742b0922bdb1ea8046e9364f4b + d30a570bb6c9b2f204db9e6ee65fc5316449fd4e diff --git a/eng/Versions.props b/eng/Versions.props index 6740feb993b6bd..2ba171e2f03a38 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -42,9 +42,9 @@ Any tools that contribute to the design-time experience should use the MicrosoftCodeAnalysisVersion_LatestVS property above to ensure they do not break the local dev experience. --> - 4.12.0-2.24421.9 - 4.12.0-2.24421.9 - 4.12.0-2.24421.9 + 4.12.0-2.24422.8 + 4.12.0-2.24422.8 + 4.12.0-2.24422.8 - <_ComponentResources Include="microsoft-net-runtime-mono-tooling" Title=".NET 8.0 Shared Mobile Build Tools" + <_ComponentResources Include="microsoft-net-runtime-mono-tooling" Title=".NET 9.0 Shared Mobile Build Tools" Description="Shared build tasks for mobile platform development."/> - <_ComponentResources Include="wasm-tools" Title=".NET 8.0 WebAssembly Build Tools" + <_ComponentResources Include="wasm-tools" Title=".NET 9.0 WebAssembly Build Tools" Description="Build tools for WebAssembly ahead-of-time (AoT) compilation and native linking."/> - <_ComponentResources Include="wasm-experimental" Title=".NET 8.0 WebAssembly Experimental Tools" + <_ComponentResources Include="wasm-experimental" Title=".NET 9.0 WebAssembly Experimental Tools" Description=".NET 8.0 WebAssembly experimental tooling"/> - <_ComponentResources Include="wasi-experimental" Title=".NET 8.0 Wasi Experimental" + <_ComponentResources Include="wasi-experimental" Title=".NET 9.0 Wasi Experimental" + Description=".NET 9.0 Experimental SDK and tooling for WASI"/> + <_ComponentResources Include="microsoft-net-runtime-android" Title=".NET 9.0 Android Build Tools" + Description="Build tools for Android compilation and native linking."/> + <_ComponentResources Include="microsoft-net-runtime-android-aot" Title=".NET 9.0 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 9.0 iOS Build Tools" + Description="Build tools for iOS compilation and native linking."/> + <_ComponentResources Include="microsoft-net-runtime-tvos" Title=".NET 9.0 tvOS Build Tools" + Description="Build tools for tvOS compilation and native linking."/> + <_ComponentResources Include="microsoft-net-runtime-maccatalyst" Title=".NET 9.0 Mac Catalyst Build Tools" + Description="Build tools for Mac Catalyst compilation and native linking."/> + <_ComponentResources Include="runtimes-ios" Title=".NET 9.0 iOS Runtimes" + Description=".NET 9.0 runtime components for iOS execution."/> + <_ComponentResources Include="runtimes-tvos" Title=".NET 9.0 tvOS Build Tools" + Description=".NET 9.0 runtime components for tvOS execution."/> + <_ComponentResources Include="runtimes-maccatalyst" Title=".NET 9.0 Mac Catalyst Build Tools" + Description=".NET 9.0 runtime components for Mac Catalyst execution."/> + <_ComponentResources Include="runtimes-windows" Title=".NET 9.0 Windows Runtimes" + Description=".NET 9.0 runtime components for Windows execution."/> + + <_ComponentResources Include="microsoft-net-runtime-mono-tooling-net8" Title=".NET 8.0 Shared Mobile Build Tools" + Description="Shared build tasks for mobile platform development."/> + <_ComponentResources Include="wasm-tools-net8" Title=".NET 8.0 WebAssembly Build Tools" + Description="Build tools for WebAssembly ahead-of-time (AoT) compilation and native linking."/> + <_ComponentResources Include="wasm-experimental-net8" Title=".NET 8.0 WebAssembly Experimental Tools" + Description=".NET 8.0 WebAssembly experimental tooling"/> + <_ComponentResources Include="wasi-experimental-net8" Title=".NET 8.0 Wasi Experimental" Description=".NET 8.0 Experimental SDK and tooling for WASI"/> - <_ComponentResources Include="microsoft-net-runtime-android" Title=".NET 8.0 Android Build Tools" + <_ComponentResources Include="microsoft-net-runtime-android-net8" Title=".NET 8.0 Android Build Tools" Description="Build tools for Android compilation and native linking."/> - <_ComponentResources Include="microsoft-net-runtime-android-aot" Title=".NET 8.0 Android Build Tools (AoT)" + <_ComponentResources Include="microsoft-net-runtime-android-aot-net8" Title=".NET 8.0 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 8.0 iOS Build Tools" + <_ComponentResources Include="microsoft-net-runtime-ios-net8" Title=".NET 8.0 iOS Build Tools" Description="Build tools for iOS compilation and native linking."/> - <_ComponentResources Include="microsoft-net-runtime-tvos" Title=".NET 8.0 tvOS Build Tools" + <_ComponentResources Include="microsoft-net-runtime-tvos-net8" Title=".NET 8.0 tvOS Build Tools" Description="Build tools for tvOS compilation and native linking."/> - <_ComponentResources Include="microsoft-net-runtime-maccatalyst" Title=".NET 8.0 Mac Catalyst Build Tools" + <_ComponentResources Include="microsoft-net-runtime-maccatalyst-net8" Title=".NET 8.0 Mac Catalyst Build Tools" Description="Build tools for Mac Catalyst compilation and native linking."/> - <_ComponentResources Include="runtimes-ios" Title=".NET 8.0 iOS Runtimes" + <_ComponentResources Include="runtimes-ios-net8" Title=".NET 8.0 iOS Runtimes" Description=".NET 8.0 runtime components for iOS execution."/> - <_ComponentResources Include="runtimes-tvos" Title=".NET 8.0 tvOS Build Tools" + <_ComponentResources Include="runtimes-tvos-net8" Title=".NET 8.0 tvOS Build Tools" Description=".NET 8.0 runtime components for tvOS execution."/> - <_ComponentResources Include="runtimes-maccatalyst" Title=".NET 8.0 Mac Catalyst Build Tools" + <_ComponentResources Include="runtimes-maccatalyst-net8" Title=".NET 8.0 Mac Catalyst Build Tools" Description=".NET 8.0 runtime components for Mac Catalyst execution."/> - <_ComponentResources Include="runtimes-windows" Title=".NET 8.0 Windows Runtimes" + <_ComponentResources Include="runtimes-windows-net8" Title=".NET 8.0 Windows Runtimes" Description=".NET 8.0 runtime components for Windows execution."/> <_ComponentResources Include="microsoft-net-runtime-mono-tooling-net7" Title=".NET 7.0 Shared Mobile Build Tools" From f5456c7804dfd2153cd5cda4054bcde50b153a66 Mon Sep 17 00:00:00 2001 From: Eric StJohn Date: Mon, 26 Aug 2024 16:08:03 -0700 Subject: [PATCH 064/748] Port fix for GetParts from .NETFramework Improve performance when getting parts from a package --- .../src/System/IO/Packaging/Package.cs | 62 ++++++++++++++++--- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/Package.cs b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/Package.cs index f2f92345d3f7e9..f05e360c17c652 100644 --- a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/Package.cs +++ b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/Package.cs @@ -401,32 +401,63 @@ public PackagePartCollection GetParts() PackUriHelper.ValidatedPartUri partUri; + var uriComparer = Comparer.Default; + + //Sorting the parts array which takes O(n log n) time. + Array.Sort(parts, Comparer.Create((partA, partB) => uriComparer.Compare((PackUriHelper.ValidatedPartUri)partA.Uri, (PackUriHelper.ValidatedPartUri)partB.Uri))); + //We need this dictionary to detect any collisions that might be present in the //list of parts that was given to us from the underlying physical layer, as more than one //partnames can be mapped to the same normalized part. //Note: We cannot use the _partList member variable, as that gets updated incrementally and so its //not possible to find the collisions using that list. //PackUriHelper.ValidatedPartUri implements the IComparable interface. - Dictionary seenPartUris = new Dictionary(parts.Length); + Dictionary> partDictionary = new Dictionary>(parts.Length); + List partIndex = new List(parts.Length); for (int i = 0; i < parts.Length; i++) { partUri = (PackUriHelper.ValidatedPartUri)parts[i].Uri; - if (seenPartUris.ContainsKey(partUri)) + string normalizedPartName = partUri.NormalizedPartUriString; + + if (partDictionary.ContainsKey(normalizedPartName)) + { throw new FileFormatException(SR.BadPackageFormat); + } else { - // Add the part to the list of URIs that we have already seen - seenPartUris.Add(partUri, parts[i]); + //since we will arive to this line of code after the parts are already sorted + string? precedingPartName = null; + + if (partIndex.Count > 0) + { + precedingPartName = (partIndex[partIndex.Count - 1]); + } + + // Add the part to the dictionary + partDictionary.Add(normalizedPartName, new KeyValuePair(partUri, parts[i])); - if (!_partList.ContainsKey(partUri)) + if (precedingPartName != null + && normalizedPartName.StartsWith(precedingPartName, StringComparison.Ordinal) + && normalizedPartName.Length > precedingPartName.Length + && normalizedPartName[precedingPartName.Length] == PackUriHelper.ForwardSlashChar) { - // Add the part to the _partList if there is no prefix collision - AddIfNoPrefixCollisionDetected(partUri, parts[i]); + //Removing the invalid entry from the _partList. + partDictionary.Remove(normalizedPartName); + + throw new InvalidOperationException(SR.PartNamePrefixExists); } + + //adding entry to partIndex to keep track of last element being added. + //since parts are already sorted, last element in partIndex list will point to preceeding element to the current. + partIndex.Add(partUri.NormalizedPartUriString); } } + + //copying parts from partdictionary to partlist + CopyPartDicitonaryToPartList(partDictionary, partIndex); + _partCollection = new PackagePartCollection(_partList); } return _partCollection; @@ -1173,6 +1204,23 @@ private PackageRelationshipCollection GetRelationshipsHelper(string? filterStrin return new PackageRelationshipCollection(_relationships, filterString); } + private void CopyPartDicitonaryToPartList(Dictionary> partDictionary, List partIndex) + { + //Clearing _partList before copying in new data. Reassigning the variable, assuming the previous object to be garbage collected. + //ideally addition to sortedlist takes O(n) but since we have sorted data and also we defined the size, it will take O(log n) per addition + //total time complexity for this function will be O(n log n) + _partList = new SortedList(partDictionary.Count); + + //Since partIndex is created from a sorted parts array we are sure that partIndex + //will have items in same order + foreach (var id in partIndex) + { + //retrieving object from partDictionary hashtable + var keyValue = partDictionary[id]; + _partList.Add(keyValue.Key, keyValue.Value); + } + } + #endregion Private Methods #region Private Members From a92301b89d02bd4474829126c8e4bd2c63280fd6 Mon Sep 17 00:00:00 2001 From: Aman Khalid Date: Tue, 27 Aug 2024 15:30:58 +0000 Subject: [PATCH 065/748] Merge #106765 (#107006) --- src/coreclr/jit/compiler.h | 3 +- src/coreclr/jit/hwintrinsic.cpp | 115 +++++++++++----- src/coreclr/jit/hwintrinsic.h | 10 ++ src/coreclr/jit/hwintrinsicarm64.cpp | 14 +- src/coreclr/jit/hwintrinsiclistarm64.h | 2 +- src/coreclr/jit/hwintrinsicxarch.cpp | 2 +- .../JitBlue/Runtime_106546/Runtime_106546.cs | 127 ++++++++++++++++++ .../Runtime_106546/Runtime_106546.csproj | 9 ++ 8 files changed, 241 insertions(+), 41 deletions(-) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106546/Runtime_106546.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106546/Runtime_106546.csproj diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index b748f3b81138a3..3343ab23273298 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -3446,7 +3446,6 @@ class Compiler GenTreeHWIntrinsic* gtNewScalarHWIntrinsicNode( var_types type, GenTree* op1, GenTree* op2, GenTree* op3, NamedIntrinsic hwIntrinsicID); CorInfoType getBaseJitTypeFromArgIfNeeded(NamedIntrinsic intrinsic, - CORINFO_CLASS_HANDLE clsHnd, CORINFO_SIG_INFO* sig, CorInfoType simdBaseJitType); @@ -4718,7 +4717,7 @@ class Compiler GenTree* getArgForHWIntrinsic(var_types argType, CORINFO_CLASS_HANDLE argClass); GenTree* impNonConstFallback(NamedIntrinsic intrinsic, var_types simdType, CorInfoType simdBaseJitType); GenTree* addRangeCheckIfNeeded( - NamedIntrinsic intrinsic, GenTree* immOp, bool mustExpand, int immLowerBound, int immUpperBound); + NamedIntrinsic intrinsic, GenTree* immOp, int immLowerBound, int immUpperBound); GenTree* addRangeCheckForHWIntrinsic(GenTree* immOp, int immLowerBound, int immUpperBound); void getHWIntrinsicImmOps(NamedIntrinsic intrinsic, diff --git a/src/coreclr/jit/hwintrinsic.cpp b/src/coreclr/jit/hwintrinsic.cpp index 9d3db42ec4c097..ca045d8bb7acfc 100644 --- a/src/coreclr/jit/hwintrinsic.cpp +++ b/src/coreclr/jit/hwintrinsic.cpp @@ -718,7 +718,6 @@ uint8_t TernaryLogicInfo::GetTernaryControlByte(const TernaryLogicInfo& info, ui // // Arguments: // intrinsic -- id of the intrinsic function. -// clsHnd -- class handle containing the intrinsic function. // method -- method handle of the intrinsic function. // sig -- signature of the intrinsic call. // simdBaseJitType -- Predetermined simdBaseJitType, could be CORINFO_TYPE_UNDEF @@ -726,10 +725,9 @@ uint8_t TernaryLogicInfo::GetTernaryControlByte(const TernaryLogicInfo& info, ui // Return Value: // The basetype of intrinsic of it can be fetched from 1st or 2nd argument, else return baseType unmodified. // -CorInfoType Compiler::getBaseJitTypeFromArgIfNeeded(NamedIntrinsic intrinsic, - CORINFO_CLASS_HANDLE clsHnd, - CORINFO_SIG_INFO* sig, - CorInfoType simdBaseJitType) +CorInfoType Compiler::getBaseJitTypeFromArgIfNeeded(NamedIntrinsic intrinsic, + CORINFO_SIG_INFO* sig, + CorInfoType simdBaseJitType) { if (HWIntrinsicInfo::BaseTypeFromSecondArg(intrinsic) || HWIntrinsicInfo::BaseTypeFromFirstArg(intrinsic)) { @@ -1332,7 +1330,6 @@ GenTree* Compiler::getArgForHWIntrinsic(var_types argType, CORINFO_CLASS_HANDLE // Arguments: // intrinsic -- intrinsic ID // immOp -- the immediate operand of the intrinsic -// mustExpand -- true if the compiler is compiling the fallback(GT_CALL) of this intrinsics // immLowerBound -- lower incl. bound for a value of the immediate operand (for a non-full-range imm-intrinsic) // immUpperBound -- upper incl. bound for a value of the immediate operand (for a non-full-range imm-intrinsic) // @@ -1340,21 +1337,19 @@ GenTree* Compiler::getArgForHWIntrinsic(var_types argType, CORINFO_CLASS_HANDLE // add a GT_BOUNDS_CHECK node for non-full-range imm-intrinsic, which would throw ArgumentOutOfRangeException // when the imm-argument is not in the valid range // -GenTree* Compiler::addRangeCheckIfNeeded( - NamedIntrinsic intrinsic, GenTree* immOp, bool mustExpand, int immLowerBound, int immUpperBound) +GenTree* Compiler::addRangeCheckIfNeeded(NamedIntrinsic intrinsic, GenTree* immOp, int immLowerBound, int immUpperBound) { assert(immOp != nullptr); // Full-range imm-intrinsics do not need the range-check // because the imm-parameter of the intrinsic method is a byte. // AVX2 Gather intrinsics no not need the range-check // because their imm-parameter have discrete valid values that are handle by managed code - if (mustExpand && HWIntrinsicInfo::isImmOp(intrinsic, immOp) + if (!immOp->IsCnsIntOrI() && HWIntrinsicInfo::isImmOp(intrinsic, immOp) #ifdef TARGET_XARCH && !HWIntrinsicInfo::isAVX2GatherIntrinsic(intrinsic) && !HWIntrinsicInfo::HasFullRangeImm(intrinsic) #endif ) { - assert(!immOp->IsCnsIntOrI()); assert(varTypeIsIntegral(immOp)); return addRangeCheckForHWIntrinsic(immOp, immLowerBound, immUpperBound); @@ -1596,7 +1591,6 @@ bool Compiler::CheckHWIntrinsicImmRange(NamedIntrinsic intrinsic, if (immOutOfRange) { - assert(!mustExpand); // The imm-HWintrinsics that do not accept all imm8 values may throw // ArgumentOutOfRangeException when the imm argument is not in the valid range, // unless the intrinsic can be transformed into one that does accept all imm8 values @@ -1764,7 +1758,8 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic, } } - simdBaseJitType = getBaseJitTypeFromArgIfNeeded(intrinsic, clsHnd, sig, simdBaseJitType); + simdBaseJitType = getBaseJitTypeFromArgIfNeeded(intrinsic, sig, simdBaseJitType); + unsigned simdSize = 0; if (simdBaseJitType == CORINFO_TYPE_UNDEF) { @@ -1783,7 +1778,7 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic, simdBaseJitType = getBaseJitTypeAndSizeOfSIMDType(clsHnd, &sizeBytes); -#if defined(TARGET_ARM64) +#ifdef TARGET_ARM64 if (simdBaseJitType == CORINFO_TYPE_UNDEF && HWIntrinsicInfo::HasScalarInputVariant(intrinsic)) { // Did not find a valid vector type. The intrinsic has alternate scalar version. Switch to that. @@ -1799,12 +1794,40 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic, assert(simdBaseJitType != CORINFO_TYPE_VALUECLASS); } else -#endif +#endif // TARGET_ARM64 { assert((category == HW_Category_Special) || (category == HW_Category_Helper) || (sizeBytes != 0)); } } } +#ifdef TARGET_ARM64 + else if ((simdBaseJitType == CORINFO_TYPE_VALUECLASS) && (HWIntrinsicInfo::BaseTypeFromValueTupleArg(intrinsic))) + { + // If HW_Flag_BaseTypeFromValueTupleArg is set, one of the base type position flags must be set. + // There is no point to using this flag if the SIMD size is known at compile-time. + assert(HWIntrinsicInfo::BaseTypeFromFirstArg(intrinsic) || HWIntrinsicInfo::BaseTypeFromSecondArg(intrinsic)); + assert(!HWIntrinsicInfo::tryLookupSimdSize(intrinsic, &simdSize)); + + CORINFO_ARG_LIST_HANDLE arg = sig->args; + + if (HWIntrinsicInfo::BaseTypeFromSecondArg(intrinsic)) + { + arg = info.compCompHnd->getArgNext(arg); + } + + CORINFO_CLASS_HANDLE argClass = info.compCompHnd->getArgClass(sig, arg); + INDEBUG(unsigned fieldCount = info.compCompHnd->getClassNumInstanceFields(argClass)); + assert(fieldCount > 1); + + CORINFO_CLASS_HANDLE classHnd; + CORINFO_FIELD_HANDLE fieldHandle = info.compCompHnd->getFieldInClass(argClass, 0); + CorInfoType fieldType = info.compCompHnd->getFieldType(fieldHandle, &classHnd); + assert(isIntrinsicType(classHnd)); + + simdBaseJitType = getBaseJitTypeAndSizeOfSIMDType(classHnd, &simdSize); + assert(simdSize > 0); + } +#endif // TARGET_ARM64 // Immediately return if the category is other than scalar/special and this is not a supported base type. if ((category != HW_Category_Special) && (category != HW_Category_Scalar) && !HWIntrinsicInfo::isScalarIsa(isa) && @@ -1827,7 +1850,9 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic, #endif // TARGET_XARCH } - const unsigned simdSize = HWIntrinsicInfo::lookupSimdSize(this, intrinsic, sig); + // We may have already determined simdSize for intrinsics that require special handling. + // If so, skip the lookup. + simdSize = (simdSize == 0) ? HWIntrinsicInfo::lookupSimdSize(this, intrinsic, sig) : simdSize; HWIntrinsicSignatureReader sigReader; sigReader.Read(info.compCompHnd, sig); @@ -1859,15 +1884,30 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic, { return impNonConstFallback(intrinsic, retType, simdBaseJitType); } - else if (!opts.OptimizationEnabled()) + else if (immOp2->IsCnsIntOrI()) { - // Only enable late stage rewriting if optimizations are enabled - // as we won't otherwise encounter a constant at the later point - return nullptr; + // If we know the immediate is out-of-range, + // convert the intrinsic into a user call (or throw if we must expand) + return impUnsupportedNamedIntrinsic(CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, method, sig, + mustExpand); } else { - setMethodHandle = true; + // The immediate is unknown, and we aren't using a fallback intrinsic. + // In this case, CheckHWIntrinsicImmRange should not return false for intrinsics that must expand. + assert(!mustExpand); + + if (opts.OptimizationEnabled()) + { + // Only enable late stage rewriting if optimizations are enabled + // as we won't otherwise encounter a constant at the later point + setMethodHandle = true; + } + else + { + // Just convert to a user call + return nullptr; + } } } } @@ -1896,15 +1936,30 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic, { return impNonConstFallback(intrinsic, retType, simdBaseJitType); } - else if (!opts.OptimizationEnabled()) + else if (immOp1->IsCnsIntOrI()) { - // Only enable late stage rewriting if optimizations are enabled - // as we won't otherwise encounter a constant at the later point - return nullptr; + // If we know the immediate is out-of-range, + // convert the intrinsic into a user call (or throw if we must expand) + return impUnsupportedNamedIntrinsic(CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, method, sig, + mustExpand); } else { - setMethodHandle = true; + // The immediate is unknown, and we aren't using a fallback intrinsic. + // In this case, CheckHWIntrinsicImmRange should not return false for intrinsics that must expand. + assert(!mustExpand); + + if (opts.OptimizationEnabled()) + { + // Only enable late stage rewriting if optimizations are enabled + // as we won't otherwise encounter a constant at the later point + setMethodHandle = true; + } + else + { + // Just convert to a user call + return nullptr; + } } } } @@ -1960,7 +2015,7 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic, { case 4: op4 = getArgForHWIntrinsic(sigReader.GetOp4Type(), sigReader.op4ClsHnd); - op4 = addRangeCheckIfNeeded(intrinsic, op4, mustExpand, immLowerBound, immUpperBound); + op4 = addRangeCheckIfNeeded(intrinsic, op4, immLowerBound, immUpperBound); op3 = getArgForHWIntrinsic(sigReader.GetOp3Type(), sigReader.op3ClsHnd); op2 = getArgForHWIntrinsic(sigReader.GetOp2Type(), sigReader.op2ClsHnd); op1 = getArgForHWIntrinsic(sigReader.GetOp1Type(), sigReader.op1ClsHnd); @@ -1974,7 +2029,7 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic, case 2: op2 = getArgForHWIntrinsic(sigReader.GetOp2Type(), sigReader.op2ClsHnd); - op2 = addRangeCheckIfNeeded(intrinsic, op2, mustExpand, immLowerBound, immUpperBound); + op2 = addRangeCheckIfNeeded(intrinsic, op2, immLowerBound, immUpperBound); op1 = getArgForHWIntrinsic(sigReader.GetOp1Type(), sigReader.op1ClsHnd); break; @@ -2144,7 +2199,7 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic, #ifdef TARGET_ARM64 if (intrinsic == NI_AdvSimd_LoadAndInsertScalar) { - op2 = addRangeCheckIfNeeded(intrinsic, op2, mustExpand, immLowerBound, immUpperBound); + op2 = addRangeCheckIfNeeded(intrinsic, op2, immLowerBound, immUpperBound); if (op1->OperIs(GT_CAST)) { @@ -2158,12 +2213,12 @@ GenTree* Compiler::impHWIntrinsic(NamedIntrinsic intrinsic, } else if ((intrinsic == NI_AdvSimd_Insert) || (intrinsic == NI_AdvSimd_InsertScalar)) { - op2 = addRangeCheckIfNeeded(intrinsic, op2, mustExpand, immLowerBound, immUpperBound); + op2 = addRangeCheckIfNeeded(intrinsic, op2, immLowerBound, immUpperBound); } else #endif { - op3 = addRangeCheckIfNeeded(intrinsic, op3, mustExpand, immLowerBound, immUpperBound); + op3 = addRangeCheckIfNeeded(intrinsic, op3, immLowerBound, immUpperBound); } retNode = isScalar ? gtNewScalarHWIntrinsicNode(nodeRetType, op1, op2, op3, intrinsic) diff --git a/src/coreclr/jit/hwintrinsic.h b/src/coreclr/jit/hwintrinsic.h index 15e942a4157089..8ee5b656e9d20f 100644 --- a/src/coreclr/jit/hwintrinsic.h +++ b/src/coreclr/jit/hwintrinsic.h @@ -246,6 +246,10 @@ enum HWIntrinsicFlag : unsigned int // (instead of merging). HW_Flag_ZeroingMaskedOperation = 0x8000000, + // The intrinsic has an overload where the base type is extracted from a ValueTuple of SIMD types + // (HW_Flag_BaseTypeFrom{First, Second}Arg must also be set to denote the position of the ValueTuple) + HW_Flag_BaseTypeFromValueTupleArg = 0x10000000, + #endif // TARGET_XARCH // The intrinsic is a FusedMultiplyAdd intrinsic @@ -1001,6 +1005,12 @@ struct HWIntrinsicInfo return (flags & HW_Flag_ZeroingMaskedOperation) != 0; } + static bool BaseTypeFromValueTupleArg(NamedIntrinsic id) + { + const HWIntrinsicFlag flags = lookupFlags(id); + return (flags & HW_Flag_BaseTypeFromValueTupleArg) != 0; + } + static NamedIntrinsic GetScalarInputVariant(NamedIntrinsic id) { assert(HasScalarInputVariant(id)); diff --git a/src/coreclr/jit/hwintrinsicarm64.cpp b/src/coreclr/jit/hwintrinsicarm64.cpp index b159e767a3d774..afe933da87c3fc 100644 --- a/src/coreclr/jit/hwintrinsicarm64.cpp +++ b/src/coreclr/jit/hwintrinsicarm64.cpp @@ -2466,7 +2466,7 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic, assert(HWIntrinsicInfo::isImmOp(intrinsic, op3)); HWIntrinsicInfo::lookupImmBounds(intrinsic, simdSize, simdBaseType, 1, &immLowerBound, &immUpperBound); - op3 = addRangeCheckIfNeeded(intrinsic, op3, (!op3->IsCnsIntOrI()), immLowerBound, immUpperBound); + op3 = addRangeCheckIfNeeded(intrinsic, op3, immLowerBound, immUpperBound); argType = JITtype2varType(strip(info.compCompHnd->getArgType(sig, arg1, &argClass))); op1 = getArgForHWIntrinsic(argType, argClass); @@ -2939,11 +2939,11 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic, assert(HWIntrinsicInfo::isImmOp(intrinsic, op2)); HWIntrinsicInfo::lookupImmBounds(intrinsic, simdSize, simdBaseType, 1, &immLowerBound, &immUpperBound); - op2 = addRangeCheckIfNeeded(intrinsic, op2, (!op2->IsCnsIntOrI()), immLowerBound, immUpperBound); + op2 = addRangeCheckIfNeeded(intrinsic, op2, immLowerBound, immUpperBound); assert(HWIntrinsicInfo::isImmOp(intrinsic, op3)); HWIntrinsicInfo::lookupImmBounds(intrinsic, simdSize, simdBaseType, 2, &immLowerBound, &immUpperBound); - op3 = addRangeCheckIfNeeded(intrinsic, op3, (!op3->IsCnsIntOrI()), immLowerBound, immUpperBound); + op3 = addRangeCheckIfNeeded(intrinsic, op3, immLowerBound, immUpperBound); retNode = isScalar ? gtNewScalarHWIntrinsicNode(retType, op1, op2, op3, intrinsic) : gtNewSimdHWIntrinsicNode(retType, op1, op2, op3, intrinsic, simdBaseJitType, simdSize); @@ -3010,7 +3010,7 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic, op3 = getArgForHWIntrinsic(argType, argClass); assert(HWIntrinsicInfo::isImmOp(intrinsic, op3)); - op3 = addRangeCheckIfNeeded(intrinsic, op3, mustExpand, immLowerBound, immUpperBound); + op3 = addRangeCheckIfNeeded(intrinsic, op3, immLowerBound, immUpperBound); argType = JITtype2varType(strip(info.compCompHnd->getArgType(sig, arg2, &argClass))); op2 = getArgForHWIntrinsic(argType, argClass); @@ -3040,7 +3040,7 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic, op4 = getArgForHWIntrinsic(argType, argClass); assert(HWIntrinsicInfo::isImmOp(intrinsic, op4)); - op4 = addRangeCheckIfNeeded(intrinsic, op4, mustExpand, immLowerBound, immUpperBound); + op4 = addRangeCheckIfNeeded(intrinsic, op4, immLowerBound, immUpperBound); argType = JITtype2varType(strip(info.compCompHnd->getArgType(sig, arg3, &argClass))); op3 = getArgForHWIntrinsic(argType, argClass); @@ -3108,12 +3108,12 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic, argType = JITtype2varType(strip(info.compCompHnd->getArgType(sig, arg5, &argClass))); GenTree* op5 = getArgForHWIntrinsic(argType, argClass); assert(HWIntrinsicInfo::isImmOp(intrinsic, op5)); - op5 = addRangeCheckIfNeeded(intrinsic, op5, mustExpand, imm1LowerBound, imm1UpperBound); + op5 = addRangeCheckIfNeeded(intrinsic, op5, imm1LowerBound, imm1UpperBound); argType = JITtype2varType(strip(info.compCompHnd->getArgType(sig, arg4, &argClass))); op4 = getArgForHWIntrinsic(argType, argClass); assert(HWIntrinsicInfo::isImmOp(intrinsic, op4)); - op4 = addRangeCheckIfNeeded(intrinsic, op4, mustExpand, imm2LowerBound, imm2UpperBound); + op4 = addRangeCheckIfNeeded(intrinsic, op4, imm2LowerBound, imm2UpperBound); argType = JITtype2varType(strip(info.compCompHnd->getArgType(sig, arg3, &argClass))); op3 = getArgForHWIntrinsic(argType, argClass); diff --git a/src/coreclr/jit/hwintrinsiclistarm64.h b/src/coreclr/jit/hwintrinsiclistarm64.h index c3649cb64beb55..5f25e123086f38 100644 --- a/src/coreclr/jit/hwintrinsiclistarm64.h +++ b/src/coreclr/jit/hwintrinsiclistarm64.h @@ -487,7 +487,7 @@ HARDWARE_INTRINSIC(AdvSimd, SignExtendWideningLower, HARDWARE_INTRINSIC(AdvSimd, SignExtendWideningUpper, 16, 1, {INS_sxtl2, INS_invalid, INS_sxtl2, INS_invalid, INS_sxtl2, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_BaseTypeFromFirstArg) HARDWARE_INTRINSIC(AdvSimd, SqrtScalar, 8, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_fsqrt, INS_fsqrt}, HW_Category_SIMD, HW_Flag_SIMDScalar) HARDWARE_INTRINSIC(AdvSimd, Store, 8, 2, {INS_st1_2regs, INS_st1_2regs, INS_st1_2regs, INS_st1_2regs, INS_st1_2regs, INS_st1_2regs, INS_invalid, INS_invalid, INS_st1_2regs, INS_invalid}, HW_Category_MemoryStore, HW_Flag_BaseTypeFromFirstArg|HW_Flag_SpecialImport|HW_Flag_SpecialCodeGen|HW_Flag_NeedsConsecutiveRegisters) -HARDWARE_INTRINSIC(AdvSimd, StoreSelectedScalar, 8, 3, {INS_st1, INS_st1, INS_st1, INS_st1, INS_st1, INS_st1, INS_st1, INS_st1, INS_st1, INS_st1}, HW_Category_MemoryStore, HW_Flag_BaseTypeFromFirstArg|HW_Flag_HasImmediateOperand|HW_Flag_SIMDScalar|HW_Flag_SpecialCodeGen|HW_Flag_SpecialImport|HW_Flag_NeedsConsecutiveRegisters) +HARDWARE_INTRINSIC(AdvSimd, StoreSelectedScalar, -1, 3, {INS_st1, INS_st1, INS_st1, INS_st1, INS_st1, INS_st1, INS_st1, INS_st1, INS_st1, INS_st1}, HW_Category_MemoryStore, HW_Flag_BaseTypeFromSecondArg|HW_Flag_BaseTypeFromValueTupleArg|HW_Flag_HasImmediateOperand|HW_Flag_SIMDScalar|HW_Flag_SpecialCodeGen|HW_Flag_SpecialImport|HW_Flag_NeedsConsecutiveRegisters) HARDWARE_INTRINSIC(AdvSimd, StoreVectorAndZip, 8, 2, {INS_st2, INS_st2, INS_st2, INS_st2, INS_st2, INS_st2, INS_st2, INS_st2, INS_st2, INS_st2}, HW_Category_MemoryStore, HW_Flag_BaseTypeFromFirstArg|HW_Flag_SpecialImport|HW_Flag_SpecialCodeGen|HW_Flag_NeedsConsecutiveRegisters) HARDWARE_INTRINSIC(AdvSimd, Subtract, -1, 2, {INS_sub, INS_sub, INS_sub, INS_sub, INS_sub, INS_sub, INS_sub, INS_sub, INS_fsub, INS_invalid}, HW_Category_SIMD, HW_Flag_NoFlag) HARDWARE_INTRINSIC(AdvSimd, SubtractHighNarrowingLower, 8, 2, {INS_subhn, INS_subhn, INS_subhn, INS_subhn, INS_subhn, INS_subhn, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_NoFlag) diff --git a/src/coreclr/jit/hwintrinsicxarch.cpp b/src/coreclr/jit/hwintrinsicxarch.cpp index 1a016f60fbe990..afc27d12fb7675 100644 --- a/src/coreclr/jit/hwintrinsicxarch.cpp +++ b/src/coreclr/jit/hwintrinsicxarch.cpp @@ -4800,7 +4800,7 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic, int immUpperBound = HWIntrinsicInfo::lookupImmUpperBound(intrinsic); op3 = impPopStack().val; - op3 = addRangeCheckIfNeeded(intrinsic, op3, mustExpand, immLowerBound, immUpperBound); + op3 = addRangeCheckIfNeeded(intrinsic, op3, immLowerBound, immUpperBound); op2 = impSIMDPopStack(); op1 = impSIMDPopStack(); diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106546/Runtime_106546.cs b/src/tests/JIT/Regression/JitBlue/Runtime_106546/Runtime_106546.cs new file mode 100644 index 00000000000000..a92d32daed0c61 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106546/Runtime_106546.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; +using System.Numerics; +using System.Runtime.Intrinsics; +using System.Runtime.Intrinsics.Arm; +using System.Runtime.Intrinsics.X86; +using Xunit; + +public class Runtime_106546 +{ + [Fact] + public static void TestDotProductThrows() + { + if (Dp.IsSupported) + { + Assert.Throws(() => new Runtime_106546().DotProduct()); + } + } + + [Fact] + public static void TestShiftRightThrows() + { + if (AdvSimd.IsSupported) + { + Assert.Throws(() => new Runtime_106546().ShiftRight()); + } + } + + [Fact] + public static void TestAvxGatherThrows() + { + if (Avx2.IsSupported) + { + Assert.Throws(() => new Runtime_106546().GatherVector128()); + Assert.Throws(() => new Runtime_106546().GatherVector256()); + Assert.Throws(() => new Runtime_106546().GatherMaskVector128()); + Assert.Throws(() => new Runtime_106546().GatherMaskVector256()); + } + } + + // Generated by Fuzzlyn v2.2 on 2024-08-17 15:13:27 + // Run on Arm64 MacOS + // Seed: 17566447992392941035-vectort,vector64,vector128,armadvsimd,armadvsimdarm64,armaes,armarmbase,armarmbasearm64,armcrc32,armcrc32arm64,armdp,armrdm,armrdmarm64,armsha1,armsha256 + // Reduced from 52.5 KiB to 0.7 KiB in 00:00:21 + // Debug: Throws 'System.ArgumentOutOfRangeException' + // Release: Runs successfully + private void DotProduct() + { + var vr4 = Vector64.Create(0); + var vr5 = Vector64.Create(0); + var vr6 = Vector64.Create(0); + var vr3 = Dp.DotProductBySelectedQuadruplet(vr4, vr5, vr6, 7); + Console.WriteLine(vr3); + } + + private struct S1 + { + public byte byte_1; + } + + // Found by Antigen + private void ShiftRight() + { + Vector64 floatVec = Vector64.Create(1f); + Vector64 doubleVec = Vector64.CreateScalar((double)82); + Vector64 intVec = Vector64.Create(1, 1); + Vector128 longVec = Vector128.AllBitsSet; + S1 s1 = new S1(); + + for (int i = 0; i < 3; i++) + { + Vector64.Shuffle(floatVec += Vector64.AsSingle(doubleVec), AdvSimd.ShiftRightLogicalNarrowingLower(longVec, s1.byte_1) & (intVec - intVec)* 15*4); + } + + Console.WriteLine(floatVec); + } + + private unsafe void GatherVector128() + { + Vector128 indices = Vector128.Create(0, 1, 2, 3); + int[] data = new int[]{1, 2, 3, 4}; + + fixed (int* ptr = data) + { + Console.WriteLine(Avx2.GatherVector128(ptr, indices, 0)); + } + } + + private unsafe void GatherVector256() + { + Vector256 indices = Vector256.Create(0L, 1L, 2L, 3L); + long[] data = new long[]{1L, 2L, 3L, 4L}; + + fixed (long* ptr = data) + { + Console.WriteLine(Avx2.GatherVector256(ptr, indices, 3)); + } + } + + private unsafe void GatherMaskVector128() + { + Vector128 source = Vector128.Zero; + Vector128 indices = Vector128.Create(0, 1, 2, 3); + Vector128 mask = Vector128.AllBitsSet; + int[] data = new int[]{1, 2, 3, 4}; + + fixed (int* ptr = data) + { + Console.WriteLine(Avx2.GatherMaskVector128(source, ptr, indices, mask, 5)); + } + } + + private unsafe void GatherMaskVector256() + { + Vector256 source = Vector256.Zero; + Vector256 indices = Vector256.Create(0L, 1L, 2L, 3L); + Vector256 mask = Vector256.AllBitsSet; + long[] data = new long[]{1L, 2L, 3L, 4L}; + + fixed (long* ptr = data) + { + Console.WriteLine(Avx2.GatherMaskVector256(source, ptr, indices, mask, 7)); + } + } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106546/Runtime_106546.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_106546/Runtime_106546.csproj new file mode 100644 index 00000000000000..6bb210527e0797 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106546/Runtime_106546.csproj @@ -0,0 +1,9 @@ + + + True + True + + + + + \ No newline at end of file From 980daff68044fbc93e09a64856fa92391f6060c6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:02:59 -0700 Subject: [PATCH 066/748] [release/9.0] Make GetPropertyCount public and fix its return value (#106576) * Make GetPropertyCount public and fix its return value * Change order of assignments to match array counterpart * Reuse local variable * Show that GetPropertyCount() and EnumerateObject().Count() are the same at every object node * Fix test to also check objects inside arrays Also added checks for `GetArrayLength` --------- Co-authored-by: etemi <40637181+etemi@users.noreply.github.com> --- .../System.Text.Json/ref/System.Text.Json.cs | 1 + .../Json/Document/JsonDocument.MetadataDb.cs | 2 +- .../System/Text/Json/Document/JsonDocument.cs | 27 +++++---- .../System/Text/Json/Document/JsonElement.cs | 2 +- .../JsonDocumentTests.cs | 56 +++++++++++++++++++ .../Serialization/Stream.ReadTests.cs | 3 + 6 files changed, 77 insertions(+), 14 deletions(-) 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 d1394f939f1a1d..a75a8bb9dd264d 100644 --- a/src/libraries/System.Text.Json/ref/System.Text.Json.cs +++ b/src/libraries/System.Text.Json/ref/System.Text.Json.cs @@ -66,6 +66,7 @@ public readonly partial struct JsonElement public System.Text.Json.JsonElement GetProperty(System.ReadOnlySpan utf8PropertyName) { throw null; } public System.Text.Json.JsonElement GetProperty(System.ReadOnlySpan propertyName) { throw null; } public System.Text.Json.JsonElement GetProperty(string propertyName) { throw null; } + public int GetPropertyCount() { throw null; } public string GetRawText() { throw null; } [System.CLSCompliantAttribute(false)] public sbyte GetSByte() { throw null; } diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.MetadataDb.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.MetadataDb.cs index a53df982c12eb4..dca61c889c89d8 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.MetadataDb.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocument.MetadataDb.cs @@ -68,7 +68,7 @@ public sealed partial class JsonDocument // * 31 bits for token offset // * Second int // * Top bit is unassigned / always clear - // * 31 bits for the token length (always 1, effectively unassigned) + // * 31 bits for the number of properties in this object // * Third int // * 4 bits JsonTokenType // * 28 bits for the number of rows until the next value (never 0) 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 ccf524fc40f3a4..7b3ffa246a90ca 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 @@ -950,7 +950,7 @@ private static void Parse( ref StackRowStack stack) { bool inArray = false; - int arrayItemsCount = 0; + int arrayItemsOrPropertyCount = 0; int numberOfRowsForMembers = 0; int numberOfRowsForValues = 0; @@ -972,13 +972,14 @@ private static void Parse( { if (inArray) { - arrayItemsCount++; + arrayItemsOrPropertyCount++; } numberOfRowsForValues++; database.Append(tokenType, tokenStart, DbRow.UnknownSize); - var row = new StackRow(numberOfRowsForMembers + 1); + var row = new StackRow(arrayItemsOrPropertyCount, numberOfRowsForMembers + 1); stack.Push(row); + arrayItemsOrPropertyCount = 0; numberOfRowsForMembers = 0; } else if (tokenType == JsonTokenType.EndObject) @@ -987,7 +988,7 @@ private static void Parse( numberOfRowsForValues++; numberOfRowsForMembers++; - database.SetLength(rowIndex, numberOfRowsForMembers); + database.SetLength(rowIndex, arrayItemsOrPropertyCount); int newRowIndex = database.Length; database.Append(tokenType, tokenStart, reader.ValueSpan.Length); @@ -995,20 +996,21 @@ private static void Parse( database.SetNumberOfRows(newRowIndex, numberOfRowsForMembers); StackRow row = stack.Pop(); - numberOfRowsForMembers += row.SizeOrLength; + arrayItemsOrPropertyCount = row.SizeOrLength; + numberOfRowsForMembers += row.NumberOfRows; } else if (tokenType == JsonTokenType.StartArray) { if (inArray) { - arrayItemsCount++; + arrayItemsOrPropertyCount++; } numberOfRowsForMembers++; database.Append(tokenType, tokenStart, DbRow.UnknownSize); - var row = new StackRow(arrayItemsCount, numberOfRowsForValues + 1); + var row = new StackRow(arrayItemsOrPropertyCount, numberOfRowsForValues + 1); stack.Push(row); - arrayItemsCount = 0; + arrayItemsOrPropertyCount = 0; numberOfRowsForValues = 0; } else if (tokenType == JsonTokenType.EndArray) @@ -1017,7 +1019,7 @@ private static void Parse( numberOfRowsForValues++; numberOfRowsForMembers++; - database.SetLength(rowIndex, arrayItemsCount); + database.SetLength(rowIndex, arrayItemsOrPropertyCount); database.SetNumberOfRows(rowIndex, numberOfRowsForValues); // If the array item count is (e.g.) 12 and the number of rows is (e.g.) 13 @@ -1030,7 +1032,7 @@ private static void Parse( // This check is similar to tracking the start array and painting it when // StartObject or StartArray is encountered, but avoids the mixed state // where "UnknownSize" implies "has complex children". - if (arrayItemsCount + 1 != numberOfRowsForValues) + if (arrayItemsOrPropertyCount + 1 != numberOfRowsForValues) { database.SetHasComplexChildren(rowIndex); } @@ -1040,13 +1042,14 @@ private static void Parse( database.SetNumberOfRows(newRowIndex, numberOfRowsForValues); StackRow row = stack.Pop(); - arrayItemsCount = row.SizeOrLength; + arrayItemsOrPropertyCount = row.SizeOrLength; numberOfRowsForValues += row.NumberOfRows; } else if (tokenType == JsonTokenType.PropertyName) { numberOfRowsForValues++; numberOfRowsForMembers++; + arrayItemsOrPropertyCount++; // Adding 1 to skip the start quote will never overflow Debug.Assert(tokenStart < int.MaxValue); @@ -1068,7 +1071,7 @@ private static void Parse( if (inArray) { - arrayItemsCount++; + arrayItemsOrPropertyCount++; } if (tokenType == JsonTokenType.String) diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonElement.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonElement.cs index da72d147abd350..e71c9ae3aa9fe9 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonElement.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonElement.cs @@ -96,7 +96,7 @@ public int GetArrayLength() /// /// The parent has been disposed. /// - internal int GetPropertyCount() + public int GetPropertyCount() { CheckValidInstance(); 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 518ab0f46e3cf5..8be93677470ec5 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 @@ -681,6 +681,7 @@ public static void ParseSimpleObject() string city = parsedObject.GetProperty("city").GetString(); int zip = parsedObject.GetProperty("zip").GetInt32(); + Assert.Equal(7, parsedObject.GetPropertyCount()); Assert.True(parsedObject.TryGetProperty("age", out JsonElement age2)); Assert.Equal(30, age2.GetInt32()); @@ -704,6 +705,7 @@ public static void ParseNestedJson() Assert.Equal(1, parsedObject.GetArrayLength()); JsonElement person = parsedObject[0]; + Assert.Equal(5, person.GetPropertyCount()); double age = person.GetProperty("age").GetDouble(); string first = person.GetProperty("first").GetString(); string last = person.GetProperty("last").GetString(); @@ -902,6 +904,7 @@ public static void ReadNumber_1Byte(sbyte value) Assert.Throws(() => root.GetDateTimeOffset()); Assert.Throws(() => root.GetGuid()); Assert.Throws(() => root.GetArrayLength()); + Assert.Throws(() => root.GetPropertyCount()); Assert.Throws(() => root.EnumerateArray()); Assert.Throws(() => root.EnumerateObject()); Assert.Throws(() => root.GetBoolean()); @@ -999,6 +1002,7 @@ public static void ReadNumber_2Bytes(short value) Assert.Throws(() => root.GetDateTimeOffset()); Assert.Throws(() => root.GetGuid()); Assert.Throws(() => root.GetArrayLength()); + Assert.Throws(() => root.GetPropertyCount()); Assert.Throws(() => root.EnumerateArray()); Assert.Throws(() => root.EnumerateObject()); Assert.Throws(() => root.GetBoolean()); @@ -1091,6 +1095,7 @@ public static void ReadSmallInteger(int value) Assert.Throws(() => root.GetDateTimeOffset()); Assert.Throws(() => root.GetGuid()); Assert.Throws(() => root.GetArrayLength()); + Assert.Throws(() => root.GetPropertyCount()); Assert.Throws(() => root.EnumerateArray()); Assert.Throws(() => root.EnumerateObject()); Assert.Throws(() => root.GetBoolean()); @@ -1194,6 +1199,7 @@ public static void ReadMediumInteger(long value) Assert.Throws(() => root.GetDateTimeOffset()); Assert.Throws(() => root.GetGuid()); Assert.Throws(() => root.GetArrayLength()); + Assert.Throws(() => root.GetPropertyCount()); Assert.Throws(() => root.EnumerateArray()); Assert.Throws(() => root.EnumerateObject()); Assert.Throws(() => root.GetBoolean()); @@ -1267,6 +1273,7 @@ public static void ReadLargeInteger(ulong value) Assert.Throws(() => root.GetDateTimeOffset()); Assert.Throws(() => root.GetGuid()); Assert.Throws(() => root.GetArrayLength()); + Assert.Throws(() => root.GetPropertyCount()); Assert.Throws(() => root.EnumerateArray()); Assert.Throws(() => root.EnumerateObject()); Assert.Throws(() => root.GetBoolean()); @@ -1340,6 +1347,7 @@ public static void ReadTooLargeInteger() Assert.Throws(() => root.GetDateTimeOffset()); Assert.Throws(() => root.GetGuid()); Assert.Throws(() => root.GetArrayLength()); + Assert.Throws(() => root.GetPropertyCount()); Assert.Throws(() => root.EnumerateArray()); Assert.Throws(() => root.EnumerateObject()); Assert.Throws(() => root.GetBoolean()); @@ -1379,6 +1387,7 @@ public static void ReadDateTimeAndDateTimeOffset(string jsonString, string expec Assert.Throws(() => root.GetInt64()); Assert.Throws(() => root.GetUInt64()); Assert.Throws(() => root.GetArrayLength()); + Assert.Throws(() => root.GetPropertyCount()); Assert.Throws(() => root.EnumerateArray()); Assert.Throws(() => root.EnumerateObject()); Assert.Throws(() => root.GetBoolean()); @@ -1462,6 +1471,7 @@ public static void ReadGuid(string jsonString, string expectedStr) Assert.Throws(() => root.GetInt64()); Assert.Throws(() => root.GetUInt64()); Assert.Throws(() => root.GetArrayLength()); + Assert.Throws(() => root.GetPropertyCount()); Assert.Throws(() => root.EnumerateArray()); Assert.Throws(() => root.EnumerateObject()); Assert.Throws(() => root.GetBoolean()); @@ -1564,6 +1574,7 @@ public static void ReadNonInteger(string str, double expectedDouble, float expec Assert.Throws(() => root.GetDateTimeOffset()); Assert.Throws(() => root.GetGuid()); Assert.Throws(() => root.GetArrayLength()); + Assert.Throws(() => root.GetPropertyCount()); Assert.Throws(() => root.EnumerateArray()); Assert.Throws(() => root.EnumerateObject()); Assert.Throws(() => root.GetBoolean()); @@ -1654,6 +1665,7 @@ public static void ReadTooPreciseDouble() Assert.Throws(() => root.GetDateTimeOffset()); Assert.Throws(() => root.GetGuid()); Assert.Throws(() => root.GetArrayLength()); + Assert.Throws(() => root.GetPropertyCount()); Assert.Throws(() => root.EnumerateArray()); Assert.Throws(() => root.EnumerateObject()); Assert.Throws(() => root.GetBoolean()); @@ -1735,6 +1747,7 @@ public static void CheckUseAfterDispose() Assert.Throws(() => root.ValueKind); Assert.Throws(() => root.GetArrayLength()); + Assert.Throws(() => root.GetPropertyCount()); Assert.Throws(() => root.EnumerateArray()); Assert.Throws(() => root.EnumerateObject()); Assert.Throws(() => root.GetDouble()); @@ -1793,6 +1806,7 @@ public static void CheckUseDefault() Assert.Equal(JsonValueKind.Undefined, root.ValueKind); Assert.Throws(() => root.GetArrayLength()); + Assert.Throws(() => root.GetPropertyCount()); Assert.Throws(() => root.EnumerateArray()); Assert.Throws(() => root.EnumerateObject()); Assert.Throws(() => root.GetDouble()); @@ -2442,6 +2456,7 @@ public static void GetRawText() using (JsonDocument doc = JsonDocument.Parse(json)) { + Assert.Equal(6, doc.RootElement.GetPropertyCount()); JsonElement.ObjectEnumerator enumerator = doc.RootElement.EnumerateObject(); Assert.True(enumerator.MoveNext(), "Move to first property"); JsonProperty property = enumerator.Current; @@ -2449,6 +2464,7 @@ public static void GetRawText() Assert.Equal(" weird property name", property.Name); string rawText = property.ToString(); int crCount = rawText.Count(c => c == '\r'); + Assert.Equal(2, property.Value.GetPropertyCount()); Assert.Equal(128 + crCount, rawText.Length); Assert.Equal('\"', rawText[0]); Assert.Equal(' ', rawText[1]); @@ -3437,6 +3453,46 @@ public static void ParseValue_AllowMultipleValues_TrailingContent() JsonTestHelper.AssertThrows(ref reader, (ref Utf8JsonReader reader) => reader.Read()); } + [Theory] + [InlineData("""{ "foo" : [1], "test": false, "bar" : { "nested": 3 } }""", 3)] + [InlineData("""{ "foo" : [1,2,3,4] }""", 1)] + [InlineData("""{}""", 0)] + [InlineData("""{ "foo" : {"nested:" : {"nested": 1, "bla": [1, 2, {"bla": 3}] } }, "test": true, "foo2" : {"nested:" : {"nested": 1, "bla": [1, 2, {"bla": 3}] } }}""", 3)] + public static void TestGetPropertyCount(string json, int expectedCount) + { + JsonElement element = JsonSerializer.Deserialize(json); + Assert.Equal(expectedCount, element.GetPropertyCount()); + } + + [Fact] + public static void VerifyGetPropertyCountAndArrayLengthUsingEnumerateMethods() + { + using (JsonDocument doc = JsonDocument.Parse(SR.ProjectLockJson)) + { + CheckPropertyCountAndArrayLengthAgainstEnumerateMethods(doc.RootElement); + } + + void CheckPropertyCountAndArrayLengthAgainstEnumerateMethods(JsonElement elem) + { + if (elem.ValueKind == JsonValueKind.Object) + { + Assert.Equal(elem.EnumerateObject().Count(), elem.GetPropertyCount()); + foreach (JsonProperty prop in elem.EnumerateObject()) + { + CheckPropertyCountAndArrayLengthAgainstEnumerateMethods(prop.Value); + } + } + else if (elem.ValueKind == JsonValueKind.Array) + { + Assert.Equal(elem.EnumerateArray().Count(), elem.GetArrayLength()); + foreach (JsonElement item in elem.EnumerateArray()) + { + CheckPropertyCountAndArrayLengthAgainstEnumerateMethods(item); + } + } + } + } + [Fact] public static void EnsureResizeSucceeds() { diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.ReadTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.ReadTests.cs index f689cf296ead17..e296ee97c8d068 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.ReadTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.ReadTests.cs @@ -220,11 +220,14 @@ public async Task TestBOMWithShortAndLongBuffers(Stream stream, int count, int e void VerifyElement(int index) { Assert.Equal(JsonValueKind.Object, value[index].GetProperty("Test").ValueKind); + Assert.Equal(0, value[index].GetProperty("Test").GetPropertyCount()); Assert.False(value[index].GetProperty("Test").EnumerateObject().MoveNext()); Assert.Equal(JsonValueKind.Array, value[index].GetProperty("Test2").ValueKind); Assert.Equal(0, value[index].GetProperty("Test2").GetArrayLength()); Assert.Equal(JsonValueKind.Object, value[index].GetProperty("Test3").ValueKind); Assert.Equal(JsonValueKind.Object, value[index].GetProperty("Test3").GetProperty("Value").ValueKind); + Assert.Equal(1, value[index].GetProperty("Test3").GetPropertyCount()); + Assert.Equal(0, value[index].GetProperty("Test3").GetProperty("Value").GetPropertyCount()); Assert.False(value[index].GetProperty("Test3").GetProperty("Value").EnumerateObject().MoveNext()); Assert.Equal(0, value[index].GetProperty("PersonType").GetInt32()); Assert.Equal(2, value[index].GetProperty("Id").GetInt32()); From 8626a1ba47afa640e5c871e20e3bdc0722957f1b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:50:29 -0700 Subject: [PATCH 067/748] JIT: Fix `CndSel(AllTrue, op2, op3) -> op2` "next" node return (#106971) When lowering makes this transformation it should proceed lowering from the original next node of the `CndSel`, not from `op2`. If we proceed lowering from `op2` we will relower some nodes. Fix #106876 Co-authored-by: Jakob Botsch Nielsen Co-authored-by: Jeff Schwartz --- src/coreclr/jit/lowerarmarch.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/coreclr/jit/lowerarmarch.cpp b/src/coreclr/jit/lowerarmarch.cpp index 5b944ff9d5f5ac..e0bf56e0eeb3fc 100644 --- a/src/coreclr/jit/lowerarmarch.cpp +++ b/src/coreclr/jit/lowerarmarch.cpp @@ -4042,6 +4042,9 @@ void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node) // node - The hardware intrinsic node of the form // ConditionalSelect(mask, trueValue, falseValue) // +// Returns: +// Next node to lower. +// GenTree* Lowering::LowerHWIntrinsicCndSel(GenTreeHWIntrinsic* cndSelNode) { assert(cndSelNode->OperIsHWIntrinsic(NI_Sve_ConditionalSelect)); @@ -4134,13 +4137,15 @@ GenTree* Lowering::LowerHWIntrinsicCndSel(GenTreeHWIntrinsic* cndSelNode) op3->SetUnusedValue(); } op1->SetUnusedValue(); + + GenTree* next = cndSelNode->gtNext; BlockRange().Remove(cndSelNode); JITDUMP("lowering ConditionalSelect HWIntrinisic (after):\n"); DISPTREERANGE(BlockRange(), op2); JITDUMP("\n"); - return op2; + return next; } } From 5c35d1a5f999edade608d9a7c0d18edde34f36c7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:51:33 -0700 Subject: [PATCH 068/748] Ensure that Arm64 correctly handles multiplication of simd by a 64-bit scalar (#106972) Co-authored-by: Tanner Gooding Co-authored-by: Jeff Schwartz --- src/coreclr/jit/gentree.cpp | 42 +++++++++---------- .../JitBlue/Runtime_106838/Runtime_106838.cs | 20 +++++++++ .../Runtime_106838/Runtime_106838.csproj | 8 ++++ 3 files changed, 48 insertions(+), 22 deletions(-) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106838/Runtime_106838.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106838/Runtime_106838.csproj diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 17497fa3742e3d..adb85ddda13a73 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -20842,13 +20842,6 @@ GenTree* Compiler::gtNewSimdBinOpNode( { GenTree** broadcastOp = nullptr; -#if defined(TARGET_ARM64) - if (varTypeIsLong(simdBaseType)) - { - break; - } -#endif // TARGET_ARM64 - if (varTypeIsArithmetic(op1)) { broadcastOp = &op1; @@ -20856,7 +20849,7 @@ GenTree* Compiler::gtNewSimdBinOpNode( #if defined(TARGET_ARM64) if (!varTypeIsByte(simdBaseType)) { - // MultiplyByScalar requires the scalar op to be op2fGetHWIntrinsicIdForBinOp + // MultiplyByScalar requires the scalar op to be op2 for GetHWIntrinsicIdForBinOp needsReverseOps = true; } #endif // TARGET_ARM64 @@ -20869,7 +20862,12 @@ GenTree* Compiler::gtNewSimdBinOpNode( if (broadcastOp != nullptr) { #if defined(TARGET_ARM64) - if (!varTypeIsByte(simdBaseType)) + if (varTypeIsLong(simdBaseType)) + { + // This is handled via emulation and the scalar is consumed directly + break; + } + else if (!varTypeIsByte(simdBaseType)) { op2ForLookup = *broadcastOp; *broadcastOp = gtNewSimdCreateScalarUnsafeNode(TYP_SIMD8, *broadcastOp, simdBaseJitType, 8); @@ -21273,16 +21271,13 @@ GenTree* Compiler::gtNewSimdBinOpNode( #elif defined(TARGET_ARM64) if (varTypeIsLong(simdBaseType)) { - GenTree** op1ToDup = &op1; - GenTree** op2ToDup = &op2; + GenTree** op2ToDup = nullptr; - if (!varTypeIsArithmetic(op1)) - { - op1 = gtNewSimdToScalarNode(TYP_LONG, op1, simdBaseJitType, simdSize); - op1ToDup = &op1->AsHWIntrinsic()->Op(1); - } + assert(varTypeIsSIMD(op1)); + op1 = gtNewSimdToScalarNode(TYP_LONG, op1, simdBaseJitType, simdSize); + GenTree** op1ToDup = &op1->AsHWIntrinsic()->Op(1); - if (!varTypeIsArithmetic(op2)) + if (varTypeIsSIMD(op2)) { op2 = gtNewSimdToScalarNode(TYP_LONG, op2, simdBaseJitType, simdSize); op2ToDup = &op2->AsHWIntrinsic()->Op(1); @@ -21290,7 +21285,12 @@ GenTree* Compiler::gtNewSimdBinOpNode( // lower = op1.GetElement(0) * op2.GetElement(0) GenTree* lower = gtNewOperNode(GT_MUL, TYP_LONG, op1, op2); - lower = gtNewSimdCreateScalarUnsafeNode(type, lower, simdBaseJitType, simdSize); + + if (op2ToDup == nullptr) + { + op2ToDup = &lower->AsOp()->gtOp2; + } + lower = gtNewSimdCreateScalarUnsafeNode(type, lower, simdBaseJitType, simdSize); if (simdSize == 8) { @@ -21302,10 +21302,8 @@ GenTree* Compiler::gtNewSimdBinOpNode( GenTree* op1Dup = fgMakeMultiUse(op1ToDup); GenTree* op2Dup = fgMakeMultiUse(op2ToDup); - if (!varTypeIsArithmetic(op1Dup)) - { - op1Dup = gtNewSimdGetElementNode(TYP_LONG, op1Dup, gtNewIconNode(1), simdBaseJitType, simdSize); - } + assert(!varTypeIsArithmetic(op1Dup)); + op1Dup = gtNewSimdGetElementNode(TYP_LONG, op1Dup, gtNewIconNode(1), simdBaseJitType, simdSize); if (!varTypeIsArithmetic(op2Dup)) { diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106838/Runtime_106838.cs b/src/tests/JIT/Regression/JitBlue/Runtime_106838/Runtime_106838.cs new file mode 100644 index 00000000000000..9c3f024398d8e3 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106838/Runtime_106838.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; +using System.Runtime.CompilerServices; +using System.Runtime.Intrinsics; +using Xunit; + +public class Runtime_106838 +{ + [MethodImpl(MethodImplOptions.NoInlining)] + private static Vector128 Problem(Vector128 vector) => vector * 5UL; + + [Fact] + public static void TestEntryPoint() + { + Vector128 result = Problem(Vector128.Create(5)); + Assert.Equal(Vector128.Create(25), result); + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106838/Runtime_106838.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_106838/Runtime_106838.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106838/Runtime_106838.csproj @@ -0,0 +1,8 @@ + + + True + + + + + From 87a5855e015a611ad1d678f46451157644d3b732 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:52:06 -0700 Subject: [PATCH 069/748] Set GC metrics to zero prior to first GC (#107004) Fixes #106733 Co-authored-by: Noah Falk Co-authored-by: Jeff Schwartz --- .../System/Diagnostics/Metrics/RuntimeMetrics.cs | 15 +-------------- .../tests/RuntimeMetricsTests.cs | 7 ------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/RuntimeMetrics.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/RuntimeMetrics.cs index fc746ff1f3545d..287af3127d7ad1 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/RuntimeMetrics.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/RuntimeMetrics.cs @@ -49,14 +49,7 @@ static RuntimeMetrics() s_meter.CreateObservableUpDownCounter( "dotnet.gc.last_collection.memory.committed_size", - () => - { - GCMemoryInfo gcInfo = GC.GetGCMemoryInfo(); - - return gcInfo.Index == 0 - ? Array.Empty>() - : [new(gcInfo.TotalCommittedBytes)]; - }, + () => GC.GetGCMemoryInfo().TotalCommittedBytes, unit: "By", description: "The amount of committed virtual memory in use by the .NET GC, as observed during the latest garbage collection."); @@ -193,9 +186,6 @@ private static IEnumerable> GetHeapSizes() { GCMemoryInfo gcInfo = GC.GetGCMemoryInfo(); - if (gcInfo.Index == 0) - yield break; - for (int i = 0; i < s_maxGenerations; ++i) { yield return new(gcInfo.GenerationInfo[i].SizeAfterBytes, new KeyValuePair("gc.heap.generation", s_genNames[i])); @@ -206,9 +196,6 @@ private static IEnumerable> GetHeapFragmentation() { GCMemoryInfo gcInfo = GC.GetGCMemoryInfo(); - if (gcInfo.Index == 0) - yield break; - for (int i = 0; i < s_maxGenerations; ++i) { yield return new(gcInfo.GenerationInfo[i].FragmentationAfterBytes, new KeyValuePair("gc.heap.generation", s_genNames[i])); diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/RuntimeMetricsTests.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/RuntimeMetricsTests.cs index 8049d1b5e25d26..2963533ac7cdc0 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/RuntimeMetricsTests.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/RuntimeMetricsTests.cs @@ -288,13 +288,6 @@ private void EnsureAllHeapTags(string metricName) instrumentRecorder.RecordObservableInstruments(); var measurements = instrumentRecorder.GetMeasurements(); - if (GC.GetGCMemoryInfo().Index == 0) - { - // No GC has occurred which can be the case on some platforms. - Assert.Empty(measurements); - return; - } - bool[] foundGenerations = new bool[s_genNames.Length]; for (int i = 0; i < 5; i++) { From 7019cc2586b54c4f05018510b88680f45ff4b98b Mon Sep 17 00:00:00 2001 From: Eric StJohn Date: Tue, 27 Aug 2024 14:55:17 -0700 Subject: [PATCH 070/748] Fix regression in ExtensionEqualityComparer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously this comparison was Ordinal after calling ToUpperInvariant This was changed to InvariantIgnoreCase which breaks because it will treat things like ß and ss as equal where they were not before. --- .../System.IO.Packaging/src/System/IO/Packaging/ZipPackage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/ZipPackage.cs b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/ZipPackage.cs index 677364d0d55b9b..5088d0e3f20c2b 100644 --- a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/ZipPackage.cs +++ b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/ZipPackage.cs @@ -739,7 +739,7 @@ bool IEqualityComparer.Equals(string? extensionA, string? extensionB) //with the rules for comparing/normalizing partnames. //Refer to PackUriHelper.ValidatedPartUri.GetNormalizedPartUri method. //Currently normalization just involves upper-casing ASCII and hence the simplification. - return extensionA.Equals(extensionB, StringComparison.InvariantCultureIgnoreCase); + return extensionA.Equals(extensionB, StringComparison.OrdinalCultureIgnoreCase); } int IEqualityComparer.GetHashCode(string extension) From 5c9d1fa2f1459e74ae9cf5ed26b2377cbb803d6b Mon Sep 17 00:00:00 2001 From: Kevin Jones Date: Tue, 27 Aug 2024 21:18:02 -0400 Subject: [PATCH 071/748] [release/9.0] Backport Azure Linux test changes (#106980) * Disable MD5 tests on Azure Linux * Handle disabled algorithms on Azure Linux * Fix MD5 failures on Azure Linux in System.Security.Cryptography.Pkcs * Fix KMAC tests on Azure Linux --- .../AlgorithmImplementations/EC/ECKeyFileTests.cs | 4 +++- .../ECDiffieHellman/ECDiffieHellmanFactory.cs | 3 +++ .../ECDiffieHellmanTests.ImportExport.cs | 2 +- .../AlgorithmImplementations/ECDsa/ECDsaFactory.cs | 2 ++ .../AlgorithmImplementations/RSA/KeyGeneration.cs | 4 ++-- .../AlgorithmImplementations/RSA/RSAFactory.cs | 2 ++ .../AlgorithmImplementations/RSA/SignVerify.cs | 12 ++++++++++-- .../System/Security/Cryptography/SignatureSupport.cs | 11 +++++++---- .../TestUtilities/System/PlatformDetection.Unix.cs | 2 ++ .../tests/RSACngProvider.cs | 2 ++ .../tests/RSACryptoServiceProviderBackCompat.cs | 9 ++++++--- .../tests/RSACryptoServiceProviderProvider.cs | 2 ++ .../tests/EcDsaOpenSslProvider.cs | 2 +- .../tests/RSAOpenSslProvider.cs | 2 ++ .../tests/Pkcs12/ShroudedKeyBagTests.cs | 8 ++++---- .../tests/SignatureSupport.cs | 3 +++ .../tests/SignedCms/SignerInfoTests.cs | 2 +- .../tests/ChaCha20Poly1305Tests.cs | 5 +++++ .../tests/DefaultECDiffieHellmanProvider.Unix.cs | 2 +- .../tests/DefaultECDsaProvider.Unix.cs | 2 +- .../tests/DefaultRSAProvider.cs | 2 ++ .../System.Security.Cryptography/tests/HKDFTests.cs | 7 ++++--- .../tests/HmacMD5Tests.cs | 4 ++-- .../tests/KmacTestDriver.cs | 2 +- 24 files changed, 69 insertions(+), 27 deletions(-) diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/EC/ECKeyFileTests.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/EC/ECKeyFileTests.cs index 492c9d451329c8..1a6686c4326db3 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/EC/ECKeyFileTests.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/EC/ECKeyFileTests.cs @@ -18,7 +18,9 @@ public abstract partial class ECKeyFileTests where T : ECAlgorithm // This would need to be virtualized if there was ever a platform that // allowed explicit in ECDH or ECDSA but not the other. - public static bool SupportsExplicitCurves { get; } = EcDiffieHellman.Tests.ECDiffieHellmanFactory.ExplicitCurvesSupported; + public static bool SupportsExplicitCurves { get; } = + EcDiffieHellman.Tests.ECDiffieHellmanFactory.ExplicitCurvesSupported || + EcDiffieHellman.Tests.ECDiffieHellmanFactory.ExplicitCurvesSupportFailOnUseOnly; public static bool CanDeriveNewPublicKey { get; } = EcDiffieHellman.Tests.ECDiffieHellmanFactory.CanDeriveNewPublicKey; diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDiffieHellmanFactory.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDiffieHellmanFactory.cs index 9a2de091ab3b42..d3d00c754d584e 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDiffieHellmanFactory.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDiffieHellmanFactory.cs @@ -12,6 +12,7 @@ public interface IECDiffieHellmanProvider #endif bool IsCurveValid(Oid oid); bool ExplicitCurvesSupported { get; } + bool ExplicitCurvesSupportFailOnUseOnly => PlatformDetection.IsAzureLinux; bool CanDeriveNewPublicKey { get; } bool SupportsRawDerivation { get; } bool SupportsSha3 { get; } @@ -48,5 +49,7 @@ public static bool IsCurveValid(Oid oid) public static bool SupportsRawDerivation => s_provider.SupportsRawDerivation; public static bool SupportsSha3 => s_provider.SupportsSha3; + + public static bool ExplicitCurvesSupportFailOnUseOnly => s_provider.ExplicitCurvesSupportFailOnUseOnly; } } diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDiffieHellmanTests.ImportExport.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDiffieHellmanTests.ImportExport.cs index 1c507beee0d8d7..2651a538a8019f 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDiffieHellmanTests.ImportExport.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDiffieHellmanTests.ImportExport.cs @@ -319,7 +319,7 @@ public static void TestGeneralExportWithExplicitParameters() [Fact] public static void TestExplicitCurveImportOnUnsupportedPlatform() { - if (ECDiffieHellmanFactory.ExplicitCurvesSupported) + if (ECDiffieHellmanFactory.ExplicitCurvesSupported || ECDiffieHellmanFactory.ExplicitCurvesSupportFailOnUseOnly) { return; } diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaFactory.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaFactory.cs index 01e5dfe6701f48..7571ec641fb718 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaFactory.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaFactory.cs @@ -12,6 +12,7 @@ public interface IECDsaProvider #endif bool IsCurveValid(Oid oid); bool ExplicitCurvesSupported { get; } + bool ExplicitCurvesSupportFailOnUseOnly => PlatformDetection.IsAzureLinux; } public static partial class ECDsaFactory @@ -39,5 +40,6 @@ public static bool IsCurveValid(Oid oid) } public static bool ExplicitCurvesSupported => s_provider.ExplicitCurvesSupported; + public static bool ExplicitCurvesSupportFailOnUseOnly => s_provider.ExplicitCurvesSupportFailOnUseOnly; } } diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/KeyGeneration.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/KeyGeneration.cs index ea13e350b977f9..601118c17bd01c 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/KeyGeneration.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/KeyGeneration.cs @@ -8,13 +8,13 @@ namespace System.Security.Cryptography.Rsa.Tests [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public class KeyGeneration { - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotAzureLinux))] public static void GenerateMinKey() { GenerateKey(rsa => GetMin(rsa.LegalKeySizes)); } - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotAzureLinux))] public static void GenerateSecondMinKey() { GenerateKey(rsa => GetSecondMin(rsa.LegalKeySizes)); diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAFactory.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAFactory.cs index b13a6ee01d8e41..a01390dec6c982 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAFactory.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAFactory.cs @@ -12,6 +12,7 @@ public interface IRSAProvider bool SupportsSha2Oaep { get; } bool SupportsPss { get; } bool SupportsSha1Signatures { get; } + bool SupportsMd5Signatures { get; } bool SupportsSha3 { get; } } @@ -43,6 +44,7 @@ public static RSA Create(RSAParameters rsaParameters) public static bool SupportsPss => s_provider.SupportsPss; public static bool SupportsSha1Signatures => s_provider.SupportsSha1Signatures; + public static bool SupportsMd5Signatures => s_provider.SupportsMd5Signatures; public static bool SupportsSha3 => s_provider.SupportsSha3; public static bool NoSupportsSha3 => !SupportsSha3; diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.cs index 84c8f76d2b3eec..cc4d396d01ffb7 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.cs @@ -600,7 +600,11 @@ public static IEnumerable RoundTripTheories yield return new object[] { nameof(HashAlgorithmName.SHA1), rsaParameters }; } - yield return new object[] { nameof(HashAlgorithmName.MD5), rsaParameters }; + if (RSAFactory.SupportsMd5Signatures) + { + yield return new object[] { nameof(HashAlgorithmName.MD5), rsaParameters }; + } + yield return new object[] { nameof(HashAlgorithmName.SHA256), rsaParameters }; } @@ -1589,7 +1593,11 @@ public static IEnumerable HashAlgorithmNames yield return new object[] { HashAlgorithmName.SHA256.Name }; yield return new object[] { HashAlgorithmName.SHA384.Name }; yield return new object[] { HashAlgorithmName.SHA512.Name }; - yield return new object[] { HashAlgorithmName.MD5.Name }; + + if (RSAFactory.SupportsMd5Signatures) + { + yield return new object[] { HashAlgorithmName.MD5.Name }; + } if (RSAFactory.SupportsSha1Signatures) { diff --git a/src/libraries/Common/tests/System/Security/Cryptography/SignatureSupport.cs b/src/libraries/Common/tests/System/Security/Cryptography/SignatureSupport.cs index b625df0184c2b2..94ecb8d82c5115 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/SignatureSupport.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/SignatureSupport.cs @@ -5,14 +5,17 @@ namespace System.Security.Cryptography.Tests { internal static class SignatureSupport { - internal static bool CanProduceSha1Signature(AsymmetricAlgorithm algorithm) + internal static bool CanProduceSha1Signature(AsymmetricAlgorithm algorithm) => CanProduceSignature(algorithm, HashAlgorithmName.SHA1); + internal static bool CanProduceMd5Signature(AsymmetricAlgorithm algorithm) => CanProduceSignature(algorithm, HashAlgorithmName.MD5); + + private static bool CanProduceSignature(AsymmetricAlgorithm algorithm, HashAlgorithmName hashAlgorithmName) { using (algorithm) { #if NETFRAMEWORK return true; #else - // We expect all non-Linux platforms to support SHA1 signatures, currently. + // We expect all non-Linux platforms to support any signatures, currently. if (!OperatingSystem.IsLinux()) { return true; @@ -23,7 +26,7 @@ internal static bool CanProduceSha1Signature(AsymmetricAlgorithm algorithm) case ECDsa ecdsa: try { - ecdsa.SignData(Array.Empty(), HashAlgorithmName.SHA1); + ecdsa.SignData(Array.Empty(), hashAlgorithmName); return true; } catch (CryptographicException) @@ -33,7 +36,7 @@ internal static bool CanProduceSha1Signature(AsymmetricAlgorithm algorithm) case RSA rsa: try { - rsa.SignData(Array.Empty(), HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1); + rsa.SignData(Array.Empty(), hashAlgorithmName, RSASignaturePadding.Pkcs1); return true; } catch (CryptographicException) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs index 6b087a82e56ae3..8681d16fd9fb4b 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs @@ -28,11 +28,13 @@ public static partial class PlatformDetection public static bool IsFedora => IsDistroAndVersion("fedora"); public static bool IsLinuxBionic => IsBionic(); public static bool IsRedHatFamily => IsRedHatFamilyAndVersion(); + public static bool IsAzureLinux => IsDistroAndVersionOrHigher("azurelinux", 3); public static bool IsMonoLinuxArm64 => IsMonoRuntime && IsLinux && IsArm64Process; public static bool IsNotMonoLinuxArm64 => !IsMonoLinuxArm64; public static bool IsQemuLinux => IsLinux && Environment.GetEnvironmentVariable("DOTNET_RUNNING_UNDER_QEMU") != null; public static bool IsNotQemuLinux => !IsQemuLinux; + public static bool IsNotAzureLinux => !IsAzureLinux; // OSX family public static bool IsApplePlatform => IsOSX || IsiOS || IstvOS || IsMacCatalyst; diff --git a/src/libraries/System.Security.Cryptography.Cng/tests/RSACngProvider.cs b/src/libraries/System.Security.Cryptography.Cng/tests/RSACngProvider.cs index d41df34b61404b..025bbc426a4cdf 100644 --- a/src/libraries/System.Security.Cryptography.Cng/tests/RSACngProvider.cs +++ b/src/libraries/System.Security.Cryptography.Cng/tests/RSACngProvider.cs @@ -37,6 +37,8 @@ public bool Supports384PrivateKey public bool SupportsSha1Signatures => true; + public bool SupportsMd5Signatures => true; + public bool SupportsSha3 { get; } = SHA3_256.IsSupported; // If SHA3_256 is supported, assume 384 and 512 are, too. } diff --git a/src/libraries/System.Security.Cryptography.Csp/tests/RSACryptoServiceProviderBackCompat.cs b/src/libraries/System.Security.Cryptography.Csp/tests/RSACryptoServiceProviderBackCompat.cs index 887bdc3d983e2e..8ef0c9474d73d7 100644 --- a/src/libraries/System.Security.Cryptography.Csp/tests/RSACryptoServiceProviderBackCompat.cs +++ b/src/libraries/System.Security.Cryptography.Csp/tests/RSACryptoServiceProviderBackCompat.cs @@ -156,9 +156,12 @@ public static void VerifyLegacySignVerifyHash(bool useLegacySign, bool useLegacy public static IEnumerable AlgorithmIdentifiers() { - yield return new object[] { "MD5", MD5.Create() }; - yield return new object[] { "MD5", typeof(MD5) }; - yield return new object[] { "MD5", "1.2.840.113549.2.5" }; + if (RSAFactory.SupportsMd5Signatures) + { + yield return new object[] { "MD5", MD5.Create() }; + yield return new object[] { "MD5", typeof(MD5) }; + yield return new object[] { "MD5", "1.2.840.113549.2.5" }; + } if (RSAFactory.SupportsSha1Signatures) { diff --git a/src/libraries/System.Security.Cryptography.Csp/tests/RSACryptoServiceProviderProvider.cs b/src/libraries/System.Security.Cryptography.Csp/tests/RSACryptoServiceProviderProvider.cs index 7cd358cd5d1213..fb40b5ece1d0fc 100644 --- a/src/libraries/System.Security.Cryptography.Csp/tests/RSACryptoServiceProviderProvider.cs +++ b/src/libraries/System.Security.Cryptography.Csp/tests/RSACryptoServiceProviderProvider.cs @@ -9,6 +9,7 @@ namespace System.Security.Cryptography.Rsa.Tests public class RSACryptoServiceProviderProvider : IRSAProvider { private bool? _supportsSha1Signatures; + private bool? _supportsMd5Signatures; public RSA Create() => new RSACryptoServiceProvider(); @@ -23,6 +24,7 @@ public class RSACryptoServiceProviderProvider : IRSAProvider public bool SupportsPss => false; public bool SupportsSha1Signatures => _supportsSha1Signatures ??= SignatureSupport.CanProduceSha1Signature(Create()); + public bool SupportsMd5Signatures => _supportsMd5Signatures ??= SignatureSupport.CanProduceMd5Signature(Create()); public bool SupportsSha3 => false; } diff --git a/src/libraries/System.Security.Cryptography.OpenSsl/tests/EcDsaOpenSslProvider.cs b/src/libraries/System.Security.Cryptography.OpenSsl/tests/EcDsaOpenSslProvider.cs index aac122ce56d587..4735038ec0184c 100644 --- a/src/libraries/System.Security.Cryptography.OpenSsl/tests/EcDsaOpenSslProvider.cs +++ b/src/libraries/System.Security.Cryptography.OpenSsl/tests/EcDsaOpenSslProvider.cs @@ -50,7 +50,7 @@ public bool ExplicitCurvesSupported { get { - return true; + return !PlatformDetection.IsAzureLinux; } } } diff --git a/src/libraries/System.Security.Cryptography.OpenSsl/tests/RSAOpenSslProvider.cs b/src/libraries/System.Security.Cryptography.OpenSsl/tests/RSAOpenSslProvider.cs index 0adcda4bfad5ec..18aa9528877d9d 100644 --- a/src/libraries/System.Security.Cryptography.OpenSsl/tests/RSAOpenSslProvider.cs +++ b/src/libraries/System.Security.Cryptography.OpenSsl/tests/RSAOpenSslProvider.cs @@ -8,6 +8,7 @@ namespace System.Security.Cryptography.Rsa.Tests public class RSAOpenSslProvider : IRSAProvider { private bool? _supportsSha1Signatures; + private bool? _supportsMd5Signatures; public RSA Create() => new RSAOpenSsl(); @@ -22,6 +23,7 @@ public class RSAOpenSslProvider : IRSAProvider public bool SupportsPss => true; public bool SupportsSha1Signatures => _supportsSha1Signatures ??= SignatureSupport.CanProduceSha1Signature(Create()); + public bool SupportsMd5Signatures => _supportsMd5Signatures ??= SignatureSupport.CanProduceMd5Signature(Create()); public bool SupportsSha3 => SHA3_256.IsSupported; // If SHA3_256 is supported, assume 384 and 512 are, too. } diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/Pkcs12/ShroudedKeyBagTests.cs b/src/libraries/System.Security.Cryptography.Pkcs/tests/Pkcs12/ShroudedKeyBagTests.cs index b2141a822c218e..aebe413b357633 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/Pkcs12/ShroudedKeyBagTests.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/Pkcs12/ShroudedKeyBagTests.cs @@ -40,7 +40,7 @@ public static void BuildWithCharsFactoryReadDirect() Assert.True(rsa2.TrySignData( keyBag.EncryptedPkcs8PrivateKey.Span, sig, - HashAlgorithmName.MD5, + HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1, out int sigLen)); @@ -49,7 +49,7 @@ public static void BuildWithCharsFactoryReadDirect() Assert.True(rsa.VerifyData( keyBag.EncryptedPkcs8PrivateKey.Span, sig, - HashAlgorithmName.MD5, + HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1)); } } @@ -77,7 +77,7 @@ public static void BuildWithBytesFactoryReadDirect() Assert.True(rsa2.TrySignData( keyBag.EncryptedPkcs8PrivateKey.Span, sig, - HashAlgorithmName.MD5, + HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1, out int sigLen)); @@ -86,7 +86,7 @@ public static void BuildWithBytesFactoryReadDirect() Assert.True(rsa.VerifyData( keyBag.EncryptedPkcs8PrivateKey.Span, sig, - HashAlgorithmName.MD5, + HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1)); } } diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignatureSupport.cs b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignatureSupport.cs index ee31485341cab3..5e317d841cfc48 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignatureSupport.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignatureSupport.cs @@ -10,5 +10,8 @@ public class SignatureSupport { public static bool SupportsRsaSha1Signatures { get; } = System.Security.Cryptography.Tests.SignatureSupport.CanProduceSha1Signature(RSA.Create()); + + public static bool SupportsRsaMd5Signatures { get; } = + System.Security.Cryptography.Tests.SignatureSupport.CanProduceMd5Signature(RSA.Create()); } } diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignerInfoTests.cs b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignerInfoTests.cs index 37d8b29ddc5d11..bc000918a0081d 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignerInfoTests.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignerInfoTests.cs @@ -198,7 +198,7 @@ public static void CheckSignature_ExtraStore_IsAdditional() signer.CheckSignature(new X509Certificate2Collection(), true); } - [Fact] + [ConditionalFact(typeof(SignatureSupport), nameof(SignatureSupport.SupportsRsaMd5Signatures))] public static void CheckSignature_MD5WithRSA() { SignedCms cms = new SignedCms(); diff --git a/src/libraries/System.Security.Cryptography/tests/ChaCha20Poly1305Tests.cs b/src/libraries/System.Security.Cryptography/tests/ChaCha20Poly1305Tests.cs index 8ec4f3bc059cac..3968505af2aeb8 100644 --- a/src/libraries/System.Security.Cryptography/tests/ChaCha20Poly1305Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/ChaCha20Poly1305Tests.cs @@ -478,6 +478,11 @@ public static void CheckIsSupported() // CryptoKit is supported on macOS 10.15+, which is our minimum target. On iOS/tvOS, it was added in 13.0 but we can expect that version in our testing environments. expectedIsSupported = true; } + else if (PlatformDetection.IsAzureLinux) + { + // Though Azure Linux uses OpenSSL, they build OpenSSL without ChaCha20-Poly1305. + expectedIsSupported = false; + } else if (PlatformDetection.OpenSslPresentOnSystem && PlatformDetection.IsOpenSslSupported) { const int OpenSslChaChaMinimumVersion = 0x1_01_00_00_F; //major_minor_fix_patch_status diff --git a/src/libraries/System.Security.Cryptography/tests/DefaultECDiffieHellmanProvider.Unix.cs b/src/libraries/System.Security.Cryptography/tests/DefaultECDiffieHellmanProvider.Unix.cs index 5e8aef8546006c..77c32104f2d575 100644 --- a/src/libraries/System.Security.Cryptography/tests/DefaultECDiffieHellmanProvider.Unix.cs +++ b/src/libraries/System.Security.Cryptography/tests/DefaultECDiffieHellmanProvider.Unix.cs @@ -25,7 +25,7 @@ public bool ExplicitCurvesSupported { get { - if (PlatformDetection.IsApplePlatform) + if (PlatformDetection.IsApplePlatform || PlatformDetection.IsAzureLinux) { return false; } diff --git a/src/libraries/System.Security.Cryptography/tests/DefaultECDsaProvider.Unix.cs b/src/libraries/System.Security.Cryptography/tests/DefaultECDsaProvider.Unix.cs index c2dad6c0938fdb..cec7aac4895ab5 100644 --- a/src/libraries/System.Security.Cryptography/tests/DefaultECDsaProvider.Unix.cs +++ b/src/libraries/System.Security.Cryptography/tests/DefaultECDsaProvider.Unix.cs @@ -25,7 +25,7 @@ public bool ExplicitCurvesSupported { get { - if (PlatformDetection.IsApplePlatform) + if (PlatformDetection.IsApplePlatform || PlatformDetection.IsAzureLinux) { return false; } diff --git a/src/libraries/System.Security.Cryptography/tests/DefaultRSAProvider.cs b/src/libraries/System.Security.Cryptography/tests/DefaultRSAProvider.cs index ab19c2aa03344a..1aa87fdab4a9db 100644 --- a/src/libraries/System.Security.Cryptography/tests/DefaultRSAProvider.cs +++ b/src/libraries/System.Security.Cryptography/tests/DefaultRSAProvider.cs @@ -10,6 +10,7 @@ public class DefaultRSAProvider : IRSAProvider { private bool? _supports384PrivateKey; private bool? _supportsSha1Signatures; + private bool? _supportsMd5Signatures; public RSA Create() => RSA.Create(); @@ -41,6 +42,7 @@ public bool Supports384PrivateKey } public bool SupportsSha1Signatures => _supportsSha1Signatures ??= SignatureSupport.CanProduceSha1Signature(Create()); + public bool SupportsMd5Signatures => _supportsMd5Signatures ??= SignatureSupport.CanProduceMd5Signature(Create()); public bool SupportsLargeExponent => true; diff --git a/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs b/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs index 6f58c00e80994c..9c3537808b0a70 100644 --- a/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs @@ -14,6 +14,8 @@ public abstract class HKDFTests protected abstract byte[] Expand(HashAlgorithmName hash, byte[] prk, int outputLength, byte[] info); protected abstract byte[] DeriveKey(HashAlgorithmName hash, byte[] ikm, int outputLength, byte[] salt, byte[] info); + internal static bool MD5Supported => !PlatformDetection.IsBrowser && !PlatformDetection.IsAzureLinux; + [Theory] [MemberData(nameof(GetHkdfTestCases))] public void ExtractTests(HkdfTestCase test) @@ -22,9 +24,8 @@ public void ExtractTests(HkdfTestCase test) Assert.Equal(test.Prk, prk); } - [Theory] + [ConditionalTheory(nameof(MD5Supported))] [MemberData(nameof(GetHkdfTestCases))] - [SkipOnPlatform(TestPlatforms.Browser, "MD5 is not supported on Browser")] public void ExtractTamperHashTests(HkdfTestCase test) { byte[] prk = Extract(HashAlgorithmName.MD5, 128 / 8, test.Ikm, test.Salt); @@ -257,7 +258,7 @@ public static IEnumerable GetPrkTooShortTestCases() yield return new object[] { HashAlgorithmName.SHA256, 256 / 8 - 1 }; yield return new object[] { HashAlgorithmName.SHA512, 512 / 8 - 1 }; - if (!PlatformDetection.IsBrowser) + if (MD5Supported) { yield return new object[] { HashAlgorithmName.MD5, 128 / 8 - 1 }; } diff --git a/src/libraries/System.Security.Cryptography/tests/HmacMD5Tests.cs b/src/libraries/System.Security.Cryptography/tests/HmacMD5Tests.cs index c0a4283498cdd3..17d6a278999d44 100644 --- a/src/libraries/System.Security.Cryptography/tests/HmacMD5Tests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HmacMD5Tests.cs @@ -9,12 +9,12 @@ namespace System.Security.Cryptography.Tests { - [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] + [ConditionalClass(typeof(HmacMD5Tests.Traits), nameof(HmacMD5Tests.Traits.IsSupported))] public class HmacMD5Tests : Rfc2202HmacTests { public sealed class Traits : IHmacTrait { - public static bool IsSupported => true; + public static bool IsSupported => !PlatformDetection.IsAzureLinux && !PlatformDetection.IsBrowser; public static int HashSizeInBytes => HMACMD5.HashSizeInBytes; } diff --git a/src/libraries/System.Security.Cryptography/tests/KmacTestDriver.cs b/src/libraries/System.Security.Cryptography/tests/KmacTestDriver.cs index b219b91791362c..b508acacc1d6d5 100644 --- a/src/libraries/System.Security.Cryptography/tests/KmacTestDriver.cs +++ b/src/libraries/System.Security.Cryptography/tests/KmacTestDriver.cs @@ -95,7 +95,7 @@ public abstract class KmacTestDriver public static bool IsSupported => TKmacTrait.IsSupported; public static bool IsNotSupported => !IsSupported; public static KeySizes? PlatformKeySizeRequirements { get; } = - PlatformDetection.IsOpenSslSupported ? new KeySizes(4, 512, 1) : null; + PlatformDetection.IsOpenSslSupported && !PlatformDetection.IsAzureLinux ? new KeySizes(4, 512, 1) : null; public static int? PlatformMaxOutputSize { get; } = PlatformDetection.IsOpenSslSupported ? 0xFFFFFF / 8 : null; public static int? PlatformMaxCustomizationStringSize { get; } = PlatformDetection.IsOpenSslSupported ? 512 : null; From d5e636923fb1670597b536fa8a6fce4a06822e87 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 18:21:34 -0700 Subject: [PATCH 072/748] [release/9.0] New cert loader should load into CNG by default (#107060) * New cert loader should load into CNG by default When no provider attribute is present on a key, Windows loads the key into the CAPI Base provider unless PKCS12_PREFER_CNG_KSP is set. So, set that flag. On .NET Framework (or .NET Standard running on .NET Framework) we don't have the power to set that flag (without completely redefining how the PFX load loads), so inject a synthetic attribute to force keys into the CNG KSP when PreserveStorageProvider isn't set. Technically these two approaches differ when the incoming PFX has no name and PreserveStorageProvider is set (CoreFX: CNG, NetFX: CAPI Base), but that's unlikely, and consistent with .NET Framework imports. * Name the 0x20/EphemeralKeySet const --------- Co-authored-by: Jeremy Barton --- .../X509CertificateLoader.Pkcs12.cs | 30 +++++++++ .../Cryptography/X509Certificates/TestData.cs | 53 +++++++++++++++ ...9CertificateLoaderPkcs12CollectionTests.cs | 25 +++++++ .../X509CertificateLoaderPkcs12Tests.cs | 67 ++++++++++++++++++- .../Microsoft.Bcl.Cryptography.Tests.csproj | 8 +-- .../StorePal.Windows.Import.cs | 20 ------ .../X509CertificateLoader.Windows.cs | 6 +- 7 files changed, 183 insertions(+), 26 deletions(-) diff --git a/src/libraries/Common/src/System/Security/Cryptography/X509Certificates/X509CertificateLoader.Pkcs12.cs b/src/libraries/Common/src/System/Security/Cryptography/X509Certificates/X509CertificateLoader.Pkcs12.cs index 0a216a3a191058..1e6b5974c6e667 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/X509Certificates/X509CertificateLoader.Pkcs12.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/X509Certificates/X509CertificateLoader.Pkcs12.cs @@ -22,6 +22,15 @@ public static partial class X509CertificateLoader private const int NTE_FAIL = unchecked((int)0x80090020); #endif +#pragma warning disable CA1805 + private static readonly AttributeAsn? s_syntheticKspAttribute = +#if NET + null; +#else + BuildSyntheticKspAttribute(); +#endif +#pragma warning restore CA1805 + static partial void LoadPkcs12NoLimits( ReadOnlyMemory data, ReadOnlySpan password, @@ -366,6 +375,13 @@ private static void ProcessSafeContents( }); } + if (!loaderLimits.PreserveStorageProvider && s_syntheticKspAttribute.HasValue) + { + int newCount = (bag.BagAttributes?.Length).GetValueOrDefault(0) + 1; + Array.Resize(ref bag.BagAttributes, newCount); + bag.BagAttributes[newCount - 1] = s_syntheticKspAttribute.GetValueOrDefault(); + } + bagState.AddKey(bag); } } @@ -552,6 +568,20 @@ static int GetRawKdfCount(in AlgorithmIdentifierAsn algorithmIdentifier) } } +#if !NET + private static AttributeAsn? BuildSyntheticKspAttribute() + { + AsnWriter writer = new AsnWriter(AsnEncodingRules.DER); + writer.WriteCharacterString(UniversalTagNumber.BMPString, "Microsoft Software Key Storage Provider"); + + return new AttributeAsn + { + AttrType = Oids.MsPkcs12KeyProviderName, + AttrValues = new[] { new ReadOnlyMemory(writer.Encode()) } + }; + } +#endif + private readonly partial struct Pkcs12Return { internal partial bool HasValue(); diff --git a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/TestData.cs b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/TestData.cs index 4c1025a7c1c028..610d623ba9f0d0 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/TestData.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/TestData.cs @@ -4630,5 +4630,58 @@ internal static DSAParameters GetDSA1024Params() "007600690064006500721E4E004D006900630072006F0073006F006600740020" + "0053006F0066007400770061007200650020004B00650079002000530074006F" + "0072006100670065002000500072006F00760069006400650072").HexToByteArray(); + + // Uses Placeholder + internal static readonly byte[] SChannelPfx = ( + "3082062A020103308205E606092A864886F70D010701A08205D7048205D33082" + + "05CF3082038806092A864886F70D010701A08203790482037530820371308203" + + "6D060B2A864886F70D010C0A0102A08202B6308202B2301C060A2A864886F70D" + + "010C0103300E040823A7915B5E0EECA9020207D0048202905D79973EDC12FE3C" + + "839C839008F3E79933BAA119C8015AF35C0DA932704D0C45990F2A60FFDFD26A" + + "4CC138A3A04673A79CE067AD6D1376608B1A0E61B5F9284A9D9D229ABB17EEFC" + + "870EB8CD61E6C054FA0AE0202B0FF04452BF3487B38FE256F406CFCA94547EC1" + + "BD44DA25A857E90990EAB58EAAD26322FDCD8810E4019B81670AD455FF905675" + + "DABDAC3331AA662AB08D1DCDE0B56CB0F3B8D53F5ABDB613772174B3959EBE75" + + "EF085404D60DC6161E576B641E5BFB60400C462BA5F9F69CDD2F4F48BA5A3C64" + + "509FCFF53EF2A7C5AA471762C9BCE99B2AD8C0E415795A816BED896B46C66FE8" + + "E737829614E0FCF2E3BDC68D24710DDC86FEA5329F8355EF1A51330981303DE8" + + "38F4CD00D3187CE52F03ACB9BD5A62F98FA1395DA14E3D5FA50F8B466488C0A0" + + "4780074FD330CA3539067A8A194CC63C2D0D35B3A61A6F8EC711907DB0D8E3D0" + + "6912F8202746264C5A9C0A9CBD7AACB1176519D901100C299126E0B30D869C14" + + "B68AA04E8EF3B144447976581BDD63E83DCDDBC8C5C185E2EA598CCAFC137BB0" + + "F46D053F900D46381915322BFF04F6EADE31F14D6781FD98764613BB679ECE45" + + "01821EBA6C0AF5E603151903B2A7F19BCBF623401E14C3456DA20128BD53DE70" + + "1422EFF06FB0DA901D68D55389BE369D76F65B5D4AA112B6636C12F4A7806BE1" + + "A8DAABCD827D65AEE41B9F2AB9E978E936309F54CC77A5E693161E84D4031DB4" + + "26440E61F01464CBE564C97BD0F6E23D4E803C9CBB65A79BAEECED26FD03FA41" + + "4EB2DEE34044DE434D18CE643C2AA1A12A7336522020498642BBC2F2B8132E84" + + "87227D130B37BA4376D57EF4CF57ADC56F9AB38F60235DAC7C7EC7ED1A537C25" + + "E3BDF6E5D1B647817CA8D730E4FC0A6013CB4FF8920F76CBD287A50D40818638" + + "D7E44168E65E26513181A3301306092A864886F70D0109153106040401000000" + + "302106092A864886F70D01091431141E12004E0061006D006500640020004B00" + + "650079306906092B0601040182371101315C1E5A004D006900630072006F0073" + + "006F00660074002000520053004100200053004300680061006E006E0065006C" + + "002000430072007900700074006F006700720061007000680069006300200050" + + "0072006F007600690064006500723082023F06092A864886F70D010706A08202" + + "303082022C0201003082022506092A864886F70D010701301C060A2A864886F7" + + "0D010C0103300E0408543FA90B580A66D0020207D0808201F8DE9CCF9441B460" + + "478D35A09462569A805A1067DA2BA99BB5E7AC02FCE133BD4DD5246861D614DD" + + "903F02D1D342CC5CB3A939D5DABAB1157007B30BB9C9099F29A62FA812EA5DE8" + + "460B3312D8490EE1DAA69E7E7946488B28E33CDBF5378DD288427ED276FAC685" + + "12E3CC1D4D5F6BEB297EF639A331970B5D33C723E7F66C64FEF8907DB8CDB3C4" + + "BE64B5DE333E0D900FC2F5AF6E782114F1A6704D58698C4EF9C796F4A054D985" + + "5570D3E9B268A321E7A1F655B77EEB45C198EB2A7B6D11A30E816ADB8CF5FCDE" + + "29ADDA29CA15E807862E607DB8B0E4A67A2DC4C167EBB0EE4ECAB3CB3F844CC5" + + "528B569128F27F6ECE1495E7ACFC34FC114A8906A872BAF40CDB8425431FD985" + + "DC0BAC262D7E8FB4F71DF5151E242C4C160252FC56DBAF16EF1C082A2E1C32BB" + + "992E3A12F21D86259A37FF6528D1FEB98DC64E79D0901F9873372D0C0659C917" + + "A2F1CFA7176EEE82292A58EEFAFAC104FA61AC124114C4067EB1211C9590714C" + + "A0F67B315E597AFD1BE546C61E58490C093842A926BB1CF3C4D27395C520A707" + + "294234316A3E1837E6521C2565845E244345790FD53DAAD00673596D66438CCD" + + "82E5EA088AC6D2928DACFD3BBC7B40FC55BBD502B6410B575AADE4D50F6DBDB7" + + "94A24BAAACF49C2CCF025D454A1B7541B159CBAC7F12D184B7ECA8F4A7B72805" + + "EE10774B5501BDEBDE4A61D0A3B22C9B0F303B301F300706052B0E03021A0414" + + "95BAC18221F16265AFDD6688C9FA59BE80616F830414C3365AE07D90C0CD656F" + + "15661D39D56F307AB983020207D0").HexToByteArray(); } } diff --git a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12CollectionTests.cs b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12CollectionTests.cs index 13fa4bb81971fc..da5a2d6a7e929a 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12CollectionTests.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12CollectionTests.cs @@ -786,6 +786,31 @@ public void LoadWithDuplicateAttributes(bool allowDuplicates) } } + [Theory] + [InlineData(false, false)] + [InlineData(false, true)] + [InlineData(true, false)] + [InlineData(true, true)] + public void LoadWithLegacyProvider(bool preserveStorageProvider, bool ephemeralIfPossible) + { + Pkcs12LoaderLimits limits = new Pkcs12LoaderLimits { PreserveStorageProvider = preserveStorageProvider }; + X509KeyStorageFlags flags = ephemeralIfPossible ? EphemeralIfPossible : X509KeyStorageFlags.DefaultKeySet; + + // EphemeralKeySet is not available by name in the netfx build. + const X509KeyStorageFlags EphemeralKeySet = (X509KeyStorageFlags)0x20; + bool expectLegacy = (flags & EphemeralKeySet) == 0 && preserveStorageProvider; + + X509Certificate2Collection coll = LoadPfxNoFile(TestData.SChannelPfx, TestData.PlaceholderPw, flags, limits); + + using (new CollectionDisposer(coll)) + { + foreach (X509Certificate2 cert in coll) + { + X509CertificateLoaderPkcs12Tests.VerifySChannelProvider(cert, expectLegacy); + } + } + } + private sealed class CollectionDisposer : IDisposable { private readonly X509Certificate2Collection _coll; diff --git a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12Tests.cs b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12Tests.cs index 086721eef28b3f..b2005ab6052ac0 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12Tests.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12Tests.cs @@ -179,7 +179,7 @@ public abstract partial class X509CertificateLoaderPkcs12Tests #if NETFRAMEWORK X509KeyStorageFlags.DefaultKeySet; #else - PlatformDetection.UsesAppleCrypto ? + PlatformDetection.UsesAppleCrypto ? X509KeyStorageFlags.DefaultKeySet : X509KeyStorageFlags.EphemeralKeySet; #endif @@ -776,6 +776,71 @@ public void LoadWithDuplicateAttributes(bool allowDuplicates) } } + [Theory] + [InlineData(false, false)] + [InlineData(false, true)] + [InlineData(true, false)] + [InlineData(true, true)] + public void LoadWithLegacyProvider(bool preserveStorageProvider, bool ephemeralIfPossible) + { + Pkcs12LoaderLimits limits = new Pkcs12LoaderLimits { PreserveStorageProvider = preserveStorageProvider, }; + X509KeyStorageFlags flags = ephemeralIfPossible ? EphemeralIfPossible : X509KeyStorageFlags.DefaultKeySet; + + // EphemeralKeySet is not available by name in the netfx build. + const X509KeyStorageFlags EphemeralKeySet = (X509KeyStorageFlags)0x20; + bool expectLegacy = (flags & EphemeralKeySet) == 0 && preserveStorageProvider; + + using (X509Certificate2 cert = LoadPfxNoFile(TestData.SChannelPfx, TestData.PlaceholderPw, flags, limits)) + { + VerifySChannelProvider(cert, expectLegacy); + } + } + + internal static void VerifySChannelProvider(X509Certificate2 cert, bool expectLegacy) + { + const string SChannelProviderName = "Microsoft RSA SChannel Cryptographic Provider"; + + Assert.True(cert.HasPrivateKey, "cert.HasPrivateKey"); + + using (RSA privateKey = cert.GetRSAPrivateKey()) + { + Assert.NotNull(privateKey); + + if (PlatformDetection.IsWindows) + { + string expectedProvider = expectLegacy ? + SChannelProviderName : + "Microsoft Software Key Storage Provider"; + + RSACng cng = Assert.IsType(privateKey); + Assert.Equal(expectedProvider, cng.Key.Provider.Provider); + } + + if (PlatformDetection.IsNetFramework) + { +#pragma warning disable SYSLIB0028 + if (expectLegacy) + { + AsymmetricAlgorithm otherPrivateKeyInstance = cert.PrivateKey; + + RSACryptoServiceProvider csp = + Assert.IsType(otherPrivateKeyInstance); + + Assert.Equal(SChannelProviderName, csp.CspKeyContainerInfo.ProviderName); + } + else + { + Assert.Throws(() => cert.PrivateKey); + } +#pragma warning restore SYSLIB0028 + } + + // Regardless of the platform, the key should work (partially because of the CNG wrapper of CAPI keys) + // Assert.NoThrow + privateKey.SignData(TestData.SChannelPfx, HashAlgorithmName.SHA256, RSASignaturePadding.Pss); + } + } + #if NET [Theory] [InlineData(false)] diff --git a/src/libraries/Microsoft.Bcl.Cryptography/tests/Microsoft.Bcl.Cryptography.Tests.csproj b/src/libraries/Microsoft.Bcl.Cryptography/tests/Microsoft.Bcl.Cryptography.Tests.csproj index 265d2a512e0e96..be85e50d295cbd 100644 --- a/src/libraries/Microsoft.Bcl.Cryptography/tests/Microsoft.Bcl.Cryptography.Tests.csproj +++ b/src/libraries/Microsoft.Bcl.Cryptography/tests/Microsoft.Bcl.Cryptography.Tests.csproj @@ -25,13 +25,13 @@ + Link="CommonTest\System\Security\Cryptography\X509Certificates\TestData.cs" /> + Link="CommonTest\System\Security\Cryptography\X509Certificates\X509CertificateLoaderPkcs12CollectionTests.cs" /> + Link="CommonTest\System\Security\Cryptography\X509Certificates\X509CertificateLoaderPkcs12Tests.cs" /> + Link="CommonTest\System\Security\Cryptography\X509Certificates\X509CertificateLoaderTests.cs" /> diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/StorePal.Windows.Import.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/StorePal.Windows.Import.cs index 59155e2b76a2e8..664f308027f58c 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/StorePal.Windows.Import.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/StorePal.Windows.Import.cs @@ -212,26 +212,6 @@ internal static partial IStorePal FromSystemStore(string storeName, StoreLocatio return new StorePal(certStore); } - // this method maps a X509KeyStorageFlags enum to a combination of crypto API flags - private static Interop.Crypt32.PfxCertStoreFlags MapKeyStorageFlags(X509KeyStorageFlags keyStorageFlags) - { - Interop.Crypt32.PfxCertStoreFlags dwFlags = 0; - if ((keyStorageFlags & X509KeyStorageFlags.UserKeySet) == X509KeyStorageFlags.UserKeySet) - dwFlags |= Interop.Crypt32.PfxCertStoreFlags.CRYPT_USER_KEYSET; - else if ((keyStorageFlags & X509KeyStorageFlags.MachineKeySet) == X509KeyStorageFlags.MachineKeySet) - dwFlags |= Interop.Crypt32.PfxCertStoreFlags.CRYPT_MACHINE_KEYSET; - - if ((keyStorageFlags & X509KeyStorageFlags.Exportable) == X509KeyStorageFlags.Exportable) - dwFlags |= Interop.Crypt32.PfxCertStoreFlags.CRYPT_EXPORTABLE; - if ((keyStorageFlags & X509KeyStorageFlags.UserProtected) == X509KeyStorageFlags.UserProtected) - dwFlags |= Interop.Crypt32.PfxCertStoreFlags.CRYPT_USER_PROTECTED; - - if ((keyStorageFlags & X509KeyStorageFlags.EphemeralKeySet) == X509KeyStorageFlags.EphemeralKeySet) - dwFlags |= Interop.Crypt32.PfxCertStoreFlags.PKCS12_NO_PERSIST_KEY | Interop.Crypt32.PfxCertStoreFlags.PKCS12_ALWAYS_CNG_KSP; - - return dwFlags; - } - // this method maps X509Store OpenFlags to a combination of crypto API flags private static Interop.Crypt32.CertStoreFlags MapX509StoreFlags(StoreLocation storeLocation, OpenFlags flags) { diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509CertificateLoader.Windows.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509CertificateLoader.Windows.cs index 346e8062d34561..2e43dc78b56700 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509CertificateLoader.Windows.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509CertificateLoader.Windows.cs @@ -281,7 +281,8 @@ private static Interop.Crypt32.PfxCertStoreFlags MapKeyStorageFlags(X509KeyStora { Debug.Assert((keyStorageFlags & KeyStorageFlagsAll) == keyStorageFlags); - Interop.Crypt32.PfxCertStoreFlags pfxCertStoreFlags = 0; + Interop.Crypt32.PfxCertStoreFlags pfxCertStoreFlags = Interop.Crypt32.PfxCertStoreFlags.PKCS12_PREFER_CNG_KSP; + if ((keyStorageFlags & X509KeyStorageFlags.UserKeySet) == X509KeyStorageFlags.UserKeySet) pfxCertStoreFlags |= Interop.Crypt32.PfxCertStoreFlags.CRYPT_USER_KEYSET; else if ((keyStorageFlags & X509KeyStorageFlags.MachineKeySet) == X509KeyStorageFlags.MachineKeySet) @@ -297,7 +298,10 @@ private static Interop.Crypt32.PfxCertStoreFlags MapKeyStorageFlags(X509KeyStora // difficult to do SHA-2 RSA signatures with, simplifies the story for UWP, and reduces the // complexity of pointer interpretation. if ((keyStorageFlags & X509KeyStorageFlags.EphemeralKeySet) == X509KeyStorageFlags.EphemeralKeySet) + { + pfxCertStoreFlags &= ~Interop.Crypt32.PfxCertStoreFlags.PKCS12_PREFER_CNG_KSP; pfxCertStoreFlags |= Interop.Crypt32.PfxCertStoreFlags.PKCS12_NO_PERSIST_KEY | Interop.Crypt32.PfxCertStoreFlags.PKCS12_ALWAYS_CNG_KSP; + } // In .NET Framework loading a PFX then adding the key to the Windows Certificate Store would // enable a native application compiled against CAPI to find that private key and interoperate with it. From 0d4e67b85fa434f83fa7dd0b4be2f13988745d0f Mon Sep 17 00:00:00 2001 From: Radek Zikmund Date: Wed, 28 Aug 2024 15:50:24 +0200 Subject: [PATCH 073/748] Use explicit full-path for loading MsQuic.dll --- .../src/System/Net/Quic/Internal/MsQuicApi.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs index e89119844c744c..ab7fd7fa5ee085 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs @@ -83,8 +83,23 @@ static MsQuicApi() if (OperatingSystem.IsWindows()) { - // Windows ships msquic in the assembly directory. - loaded = NativeLibrary.TryLoad(Interop.Libraries.MsQuic, typeof(MsQuicApi).Assembly, DllImportSearchPath.AssemblyDirectory, out msQuicHandle); +#pragma warning disable IL3000 // Avoid accessing Assembly file path when publishing as a single file + // Windows ships msquic in the assembly directory next to System.Net.Quic, so load that + // for single-file deployments, the assembly location is an empty string so we fall back + // to AppContext.BaseDirectory which is the directory containing the single-file executable + string path = typeof(MsQuicApi).Assembly.Location is string assemblyLocation && !string.IsNullOrEmpty(assemblyLocation) + ? System.IO.Path.GetDirectoryName(assemblyLocation)! + : AppContext.BaseDirectory; +#pragma warning restore IL3000 + + path = System.IO.Path.Combine(path, Interop.Libraries.MsQuic); + + if (NetEventSource.Log.IsEnabled()) + { + NetEventSource.Info(null, $"Attempting to load MsQuic from {path}"); + } + + loaded = NativeLibrary.TryLoad(path, typeof(MsQuicApi).Assembly, DllImportSearchPath.LegacyBehavior, out msQuicHandle); } else { From fae6c3e3b44c16258541a2d710b4c867c5c774ee Mon Sep 17 00:00:00 2001 From: Radek Zikmund Date: Wed, 28 Aug 2024 16:13:30 +0200 Subject: [PATCH 074/748] Fix comment wording --- .../src/System/Net/Quic/Internal/MsQuicApi.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs index ab7fd7fa5ee085..4148f4ac1cc43b 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicApi.cs @@ -84,9 +84,9 @@ static MsQuicApi() if (OperatingSystem.IsWindows()) { #pragma warning disable IL3000 // Avoid accessing Assembly file path when publishing as a single file - // Windows ships msquic in the assembly directory next to System.Net.Quic, so load that - // for single-file deployments, the assembly location is an empty string so we fall back - // to AppContext.BaseDirectory which is the directory containing the single-file executable + // Windows ships msquic in the assembly directory next to System.Net.Quic, so load that. + // For single-file deployments, the assembly location is an empty string so we fall back + // to AppContext.BaseDirectory which is the directory containing the single-file executable. string path = typeof(MsQuicApi).Assembly.Location is string assemblyLocation && !string.IsNullOrEmpty(assemblyLocation) ? System.IO.Path.GetDirectoryName(assemblyLocation)! : AppContext.BaseDirectory; From 7cf8f4aa5ee168606974cebbb20e73fdaed2de88 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 08:33:52 -0700 Subject: [PATCH 075/748] Fix copying ephemeral keys to keychains. (#106993) Starting on macOS Sequoia, at least in beta, SecKeychainitemCopyKeychain no longer returns errSecNoSuchKeychain for ephemeral keys. Instead, it returns errSecInvalidItemRef. This adds the error code in the handling logic for when we need to add an ephemeral key to the target keychain. Co-authored-by: Kevin Jones --- .../System.Security.Cryptography.Native.Apple/pal_x509_macos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/native/libs/System.Security.Cryptography.Native.Apple/pal_x509_macos.c b/src/native/libs/System.Security.Cryptography.Native.Apple/pal_x509_macos.c index 41ba9648259c76..fc261117a1588b 100644 --- a/src/native/libs/System.Security.Cryptography.Native.Apple/pal_x509_macos.c +++ b/src/native/libs/System.Security.Cryptography.Native.Apple/pal_x509_macos.c @@ -391,7 +391,7 @@ int32_t AppleCryptoNative_X509CopyWithPrivateKey(SecCertificateRef cert, SecKeychainItemRef itemCopy = NULL; // This only happens with an ephemeral key, so the keychain we're adding it to is temporary. - if (status == errSecNoSuchKeychain) + if (status == errSecNoSuchKeychain || status == errSecInvalidItemRef) { status = AddKeyToKeychain(privateKey, targetKeychain, NULL); } From 996ce3b8cba17dbbc1d4fdb899c0bae23176ee66 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 17:50:21 -0700 Subject: [PATCH 076/748] [release/9.0] Use OpenSSL 3's HKDF if it is available (#107085) * Split out managed implementation * Misc. cleanup * Introduce a PAL * Start a Unix implementation * Get DeriveKey working with OpenSSL * Extract and Expand individual calls * Fix build * Fix tests on Azure Linux * Use defined consts rather than magic strings --------- Co-authored-by: Kevin Jones --- .../Interop.EVP.Kdf.cs | 113 +++++++++++ .../Interop.EVP.KdfAlgs.cs | 3 + .../src/System.Security.Cryptography.csproj | 6 + .../Security/Cryptography/HKDF.Managed.cs | 39 ++++ .../Security/Cryptography/HKDF.OpenSsl.cs | 79 ++++++++ .../src/System/Security/Cryptography/HKDF.cs | 180 +++--------------- .../Cryptography/HKDFManagedImplementation.cs | 101 ++++++++++ .../System/Security/Cryptography/Helpers.cs | 40 ++++ .../tests/HKDFTests.cs | 4 +- .../entrypoints.c | 3 + .../opensslshim.h | 20 ++ .../osslcompat_30.h | 2 + .../pal_evp_kdf.c | 162 ++++++++++++++++ .../pal_evp_kdf.h | 32 ++++ 14 files changed, 633 insertions(+), 151 deletions(-) create mode 100644 src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.Managed.cs create mode 100644 src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.OpenSsl.cs create mode 100644 src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDFManagedImplementation.cs diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EVP.Kdf.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EVP.Kdf.cs index 082d496497289f..f3c971a1a2f956 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EVP.Kdf.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EVP.Kdf.cs @@ -13,6 +13,41 @@ internal static partial class Crypto [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EvpKdfFree")] internal static partial void EvpKdfFree(IntPtr kdf); + [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HkdfDeriveKey", StringMarshalling = StringMarshalling.Utf8)] + private static partial int CryptoNative_HkdfDeriveKey( + SafeEvpKdfHandle kdf, + ReadOnlySpan ikm, + int ikmLength, + string algorithm, + ReadOnlySpan salt, + int saltLength, + ReadOnlySpan info, + int infoLength, + Span destination, + int destinationLength); + + [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HkdfExpand", StringMarshalling = StringMarshalling.Utf8)] + private static partial int CryptoNative_HkdfExpand( + SafeEvpKdfHandle kdf, + ReadOnlySpan prk, + int prkLength, + string algorithm, + ReadOnlySpan info, + int infoLength, + Span destination, + int destinationLength); + + [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_HkdfExtract", StringMarshalling = StringMarshalling.Utf8)] + private static partial int CryptoNative_HkdfExtract( + SafeEvpKdfHandle kdf, + ReadOnlySpan ikm, + int ikmLength, + string algorithm, + ReadOnlySpan salt, + int saltLength, + Span destination, + int destinationLength); + [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_KbkdfHmacOneShot", StringMarshalling = StringMarshalling.Utf8)] private static unsafe partial int CryptoNative_KbkdfHmacOneShot( SafeEvpKdfHandle kdf, @@ -26,6 +61,84 @@ private static unsafe partial int CryptoNative_KbkdfHmacOneShot( Span destination, int destinationLength); + internal static void HkdfDeriveKey( + SafeEvpKdfHandle kdf, + ReadOnlySpan ikm, + string algorithm, + ReadOnlySpan salt, + ReadOnlySpan info, + Span destination) + { + const int Success = 1; + int ret = CryptoNative_HkdfDeriveKey( + kdf, + ikm, + ikm.Length, + algorithm, + salt, + salt.Length, + info, + info.Length, + destination, + destination.Length); + + if (ret != Success) + { + Debug.Assert(ret == 0); + throw CreateOpenSslCryptographicException(); + } + } + + internal static void HkdfExpand( + SafeEvpKdfHandle kdf, + ReadOnlySpan prk, + string algorithm, + ReadOnlySpan info, + Span destination) + { + const int Success = 1; + int ret = CryptoNative_HkdfExpand( + kdf, + prk, + prk.Length, + algorithm, + info, + info.Length, + destination, + destination.Length); + + if (ret != Success) + { + Debug.Assert(ret == 0); + throw CreateOpenSslCryptographicException(); + } + } + + internal static void HkdfExtract( + SafeEvpKdfHandle kdf, + ReadOnlySpan ikm, + string algorithm, + ReadOnlySpan salt, + Span destination) + { + const int Success = 1; + int ret = CryptoNative_HkdfExtract( + kdf, + ikm, + ikm.Length, + algorithm, + salt, + salt.Length, + destination, + destination.Length); + + if (ret != Success) + { + Debug.Assert(ret == 0); + throw CreateOpenSslCryptographicException(); + } + } + internal static void KbkdfHmacOneShot( SafeEvpKdfHandle kdf, ReadOnlySpan key, diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EVP.KdfAlgs.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EVP.KdfAlgs.cs index 0b4217e30d7910..1cd7598a9421f5 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EVP.KdfAlgs.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EVP.KdfAlgs.cs @@ -13,8 +13,10 @@ internal static partial class Crypto internal static partial class EvpKdfAlgs { private const string KbkdfAlgorithmName = "KBKDF"; + private const string HkdfAlgorithmName = "HKDF"; internal static SafeEvpKdfHandle? Kbkdf { get; } + internal static SafeEvpKdfHandle? Hkdf { get; } static EvpKdfAlgs() { @@ -24,6 +26,7 @@ static EvpKdfAlgs() // is called first. Property initializers happen before cctors, so instead set the property after the // initializer is run. Kbkdf = EvpKdfFetch(KbkdfAlgorithmName); + Hkdf = EvpKdfFetch(HkdfAlgorithmName); } [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_EvpKdfFetch", StringMarshalling = StringMarshalling.Utf8)] diff --git a/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj b/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj index ec6f682444aa29..c609292d4059f6 100644 --- a/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj +++ b/src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj @@ -418,6 +418,7 @@ + @@ -668,6 +669,7 @@ + @@ -864,6 +866,7 @@ + @@ -1024,6 +1027,7 @@ + @@ -1154,6 +1158,7 @@ + @@ -1745,6 +1750,7 @@ + diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.Managed.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.Managed.cs new file mode 100644 index 00000000000000..e3af79fd8d41e9 --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.Managed.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. + +namespace System.Security.Cryptography +{ + public static partial class HKDF + { + private static void Extract( + HashAlgorithmName hashAlgorithmName, + int hashLength, + ReadOnlySpan ikm, + ReadOnlySpan salt, + Span prk) + { + HKDFManagedImplementation.Extract(hashAlgorithmName, hashLength, ikm, salt, prk); + } + + private static void Expand( + HashAlgorithmName hashAlgorithmName, + int hashLength, + ReadOnlySpan prk, + Span output, + ReadOnlySpan info) + { + HKDFManagedImplementation.Expand(hashAlgorithmName, hashLength, prk, output, info); + } + + private static void DeriveKeyCore( + HashAlgorithmName hashAlgorithmName, + int hashLength, + ReadOnlySpan ikm, + Span output, + ReadOnlySpan salt, + ReadOnlySpan info) + { + HKDFManagedImplementation.DeriveKey(hashAlgorithmName, hashLength, ikm, output, salt, info); + } + } +} diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.OpenSsl.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.OpenSsl.cs new file mode 100644 index 00000000000000..9194f144be76d3 --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.OpenSsl.cs @@ -0,0 +1,79 @@ +// 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 +{ + public static partial class HKDF + { + private static readonly bool s_hasOpenSslImplementation = Interop.Crypto.EvpKdfAlgs.Hkdf is not null; + + private static void Extract( + HashAlgorithmName hashAlgorithmName, + int hashLength, + ReadOnlySpan ikm, + ReadOnlySpan salt, + Span prk) + { + if (s_hasOpenSslImplementation) + { + Debug.Assert(Interop.Crypto.EvpKdfAlgs.Hkdf is not null); + Debug.Assert(hashAlgorithmName.Name is not null); + + Interop.Crypto.HkdfExtract(Interop.Crypto.EvpKdfAlgs.Hkdf, ikm, hashAlgorithmName.Name, salt, prk); + } + else + { + HKDFManagedImplementation.Extract(hashAlgorithmName, hashLength, ikm, salt, prk); + } + } + + private static void Expand( + HashAlgorithmName hashAlgorithmName, + int hashLength, + ReadOnlySpan prk, + Span output, + ReadOnlySpan info) + { + if (s_hasOpenSslImplementation) + { + Debug.Assert(Interop.Crypto.EvpKdfAlgs.Hkdf is not null); + Debug.Assert(hashAlgorithmName.Name is not null); + + Interop.Crypto.HkdfExpand(Interop.Crypto.EvpKdfAlgs.Hkdf, prk, hashAlgorithmName.Name, info, output); + } + else + { + HKDFManagedImplementation.Expand(hashAlgorithmName, hashLength, prk, output, info); + } + } + + private static void DeriveKeyCore( + HashAlgorithmName hashAlgorithmName, + int hashLength, + ReadOnlySpan ikm, + Span output, + ReadOnlySpan salt, + ReadOnlySpan info) + { + if (s_hasOpenSslImplementation) + { + Debug.Assert(Interop.Crypto.EvpKdfAlgs.Hkdf is not null); + Debug.Assert(hashAlgorithmName.Name is not null); + + Interop.Crypto.HkdfDeriveKey( + Interop.Crypto.EvpKdfAlgs.Hkdf, + ikm, + hashAlgorithmName.Name, + salt, + info, + output); + } + else + { + HKDFManagedImplementation.DeriveKey(hashAlgorithmName, hashLength, ikm, output, salt, info); + } + } + } +} diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.cs index 9b33aea297a77c..f167f18afc2466 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDF.cs @@ -15,7 +15,7 @@ namespace System.Security.Cryptography /// phase to be skipped, and the master key to be used directly as the pseudorandom key. /// See RFC5869 for more information. /// - public static class HKDF + public static partial class HKDF { /// /// Performs the HKDF-Extract function. @@ -23,13 +23,16 @@ public static class HKDF /// /// The hash algorithm used for HMAC operations. /// The input keying material. - /// The optional salt value (a non-secret random value). If not provided it defaults to a byte array of zeros. + /// + /// The optional salt value (a non-secret random value). If not provided it defaults to a + /// byte array of the same length as the output of the specified hash algorithm. + /// /// The pseudo random key (prk). public static byte[] Extract(HashAlgorithmName hashAlgorithmName, byte[] ikm, byte[]? salt = null) { ArgumentNullException.ThrowIfNull(ikm); - int hashLength = HashLength(hashAlgorithmName); + int hashLength = Helpers.HashLength(hashAlgorithmName); byte[] prk = new byte[hashLength]; Extract(hashAlgorithmName, hashLength, ikm, salt, prk); @@ -47,7 +50,7 @@ public static byte[] Extract(HashAlgorithmName hashAlgorithmName, byte[] ikm, by /// The number of bytes written to the buffer. public static int Extract(HashAlgorithmName hashAlgorithmName, ReadOnlySpan ikm, ReadOnlySpan salt, Span prk) { - int hashLength = HashLength(hashAlgorithmName); + int hashLength = Helpers.HashLength(hashAlgorithmName); if (prk.Length < hashLength) { @@ -63,19 +66,15 @@ public static int Extract(HashAlgorithmName hashAlgorithmName, ReadOnlySpan ikm, ReadOnlySpan salt, Span prk) - { - Debug.Assert(HashLength(hashAlgorithmName) == hashLength); - int written = CryptographicOperations.HmacData(hashAlgorithmName, salt, ikm, prk); - Debug.Assert(written == prk.Length, $"Bytes written is {written} bytes which does not match output length ({prk.Length} bytes)"); - } - /// /// Performs the HKDF-Expand function /// See section 2.3 of RFC5869 /// /// The hash algorithm used for HMAC operations. - /// The pseudorandom key of at least bytes (usually the output from Expand step). + /// + /// The pseudorandom key that is at least as long as the output byte array of the specified hash + /// algorithm (usually the output from the Extract step). + /// /// The length of the output keying material. /// The optional context and application specific information. /// The output keying material. @@ -84,10 +83,14 @@ private static void Extract(HashAlgorithmName hashAlgorithmName, int hashLength, public static byte[] Expand(HashAlgorithmName hashAlgorithmName, byte[] prk, int outputLength, byte[]? info = null) { ArgumentNullException.ThrowIfNull(prk); - ArgumentOutOfRangeException.ThrowIfNegativeOrZero(outputLength); - int hashLength = HashLength(hashAlgorithmName); + int hashLength = Helpers.HashLength(hashAlgorithmName); + + if (prk.Length < hashLength) + { + throw new ArgumentException(SR.Format(SR.Cryptography_Prk_TooSmall, hashLength), nameof(prk)); + } // Constant comes from section 2.3 (the constraint on L in the Inputs section) int maxOkmLength = 255 * hashLength; @@ -105,17 +108,23 @@ public static byte[] Expand(HashAlgorithmName hashAlgorithmName, byte[] prk, int /// See section 2.3 of RFC5869 /// /// The hash algorithm used for HMAC operations. - /// The pseudorandom key of at least bytes (usually the output from Expand step). + /// + /// The pseudorandom key that is at least as long as the output byte array of the specified hash + /// algorithm (usually the output from the Extract step). + /// /// The destination buffer to receive the output keying material. /// The context and application specific information (can be an empty span). /// is empty, or is larger than the maximum allowed length. public static void Expand(HashAlgorithmName hashAlgorithmName, ReadOnlySpan prk, Span output, ReadOnlySpan info) { - int hashLength = HashLength(hashAlgorithmName); + int hashLength = Helpers.HashLength(hashAlgorithmName); if (output.Length == 0) throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(output)); + if (prk.Length < hashLength) + throw new ArgumentException(SR.Format(SR.Cryptography_Prk_TooSmall, hashLength), nameof(prk)); + // Constant comes from section 2.3 (the constraint on L in the Inputs section) int maxOkmLength = 255 * hashLength; if (output.Length > maxOkmLength) @@ -124,83 +133,13 @@ public static void Expand(HashAlgorithmName hashAlgorithmName, ReadOnlySpan prk, Span output, ReadOnlySpan info) - { - Debug.Assert(HashLength(hashAlgorithmName) == hashLength); - - if (prk.Length < hashLength) - throw new ArgumentException(SR.Format(SR.Cryptography_Prk_TooSmall, hashLength), nameof(prk)); - - byte counter = 0; - var counterSpan = new Span(ref counter); - Span t = Span.Empty; - Span remainingOutput = output; - - const int MaxStackInfoBuffer = 64; - Span tempInfoBuffer = stackalloc byte[MaxStackInfoBuffer]; - scoped ReadOnlySpan infoBuffer; - byte[]? rentedTempInfoBuffer = null; - - if (output.Overlaps(info)) - { - if (info.Length > MaxStackInfoBuffer) - { - rentedTempInfoBuffer = CryptoPool.Rent(info.Length); - tempInfoBuffer = rentedTempInfoBuffer; - } - - tempInfoBuffer = tempInfoBuffer.Slice(0, info.Length); - info.CopyTo(tempInfoBuffer); - infoBuffer = tempInfoBuffer; - } - else - { - infoBuffer = info; - } - - using (IncrementalHash hmac = IncrementalHash.CreateHMAC(hashAlgorithmName, prk)) - { - for (int i = 1; ; i++) - { - hmac.AppendData(t); - hmac.AppendData(infoBuffer); - counter = (byte)i; - hmac.AppendData(counterSpan); - - if (remainingOutput.Length >= hashLength) - { - t = remainingOutput.Slice(0, hashLength); - remainingOutput = remainingOutput.Slice(hashLength); - GetHashAndReset(hmac, t); - } - else - { - if (remainingOutput.Length > 0) - { - Debug.Assert(hashLength <= 512 / 8, "hashLength is larger than expected, consider increasing this value or using regular allocation"); - Span lastChunk = stackalloc byte[hashLength]; - GetHashAndReset(hmac, lastChunk); - lastChunk.Slice(0, remainingOutput.Length).CopyTo(remainingOutput); - } - - break; - } - } - } - - if (rentedTempInfoBuffer is not null) - { - CryptoPool.Return(rentedTempInfoBuffer, clearSize: info.Length); - } - } - /// /// Performs the key derivation HKDF Expand and Extract functions /// /// The hash algorithm used for HMAC operations. /// The input keying material. /// The length of the output keying material. - /// The optional salt value (a non-secret random value). If not provided it defaults to a byte array of zeros. + /// The optional salt value (a non-secret random value). /// The optional context and application specific information. /// The output keying material. /// is . @@ -211,7 +150,7 @@ public static byte[] DeriveKey(HashAlgorithmName hashAlgorithmName, byte[] ikm, ArgumentOutOfRangeException.ThrowIfNegativeOrZero(outputLength); - int hashLength = HashLength(hashAlgorithmName); + int hashLength = Helpers.HashLength(hashAlgorithmName); Debug.Assert(hashLength <= 512 / 8, "hashLength is larger than expected, consider increasing this value or using regular allocation"); // Constant comes from section 2.3 (the constraint on L in the Inputs section) @@ -219,13 +158,8 @@ public static byte[] DeriveKey(HashAlgorithmName hashAlgorithmName, byte[] ikm, if (outputLength > maxOkmLength) throw new ArgumentOutOfRangeException(nameof(outputLength), SR.Format(SR.Cryptography_Okm_TooLarge, maxOkmLength)); - Span prk = stackalloc byte[hashLength]; - - Extract(hashAlgorithmName, hashLength, ikm, salt, prk); - byte[] result = new byte[outputLength]; - Expand(hashAlgorithmName, hashLength, prk, result, info); - + DeriveKeyCore(hashAlgorithmName, hashLength, ikm, result, salt, info); return result; } @@ -240,7 +174,7 @@ public static byte[] DeriveKey(HashAlgorithmName hashAlgorithmName, byte[] ikm, /// is empty, or is larger than the maximum allowed length. public static void DeriveKey(HashAlgorithmName hashAlgorithmName, ReadOnlySpan ikm, Span output, ReadOnlySpan salt, ReadOnlySpan info) { - int hashLength = HashLength(hashAlgorithmName); + int hashLength = Helpers.HashLength(hashAlgorithmName); if (output.Length == 0) throw new ArgumentException(SR.Argument_DestinationTooShort, nameof(output)); @@ -251,61 +185,7 @@ public static void DeriveKey(HashAlgorithmName hashAlgorithmName, ReadOnlySpan prk = stackalloc byte[hashLength]; - - Extract(hashAlgorithmName, hashLength, ikm, salt, prk); - Expand(hashAlgorithmName, hashLength, prk, output, info); - } - - private static void GetHashAndReset(IncrementalHash hmac, Span output) - { - if (!hmac.TryGetHashAndReset(output, out int bytesWritten)) - { - Debug.Fail("HMAC operation failed unexpectedly"); - throw new CryptographicException(SR.Arg_CryptographyException); - } - - Debug.Assert(bytesWritten == output.Length, $"Bytes written is {bytesWritten} bytes which does not match output length ({output.Length} bytes)"); - } - - private static int HashLength(HashAlgorithmName hashAlgorithmName) - { - if (hashAlgorithmName == HashAlgorithmName.SHA1) - { - return HMACSHA1.HashSizeInBytes; - } - else if (hashAlgorithmName == HashAlgorithmName.SHA256) - { - return HMACSHA256.HashSizeInBytes; - } - else if (hashAlgorithmName == HashAlgorithmName.SHA384) - { - return HMACSHA384.HashSizeInBytes; - } - else if (hashAlgorithmName == HashAlgorithmName.SHA512) - { - return HMACSHA512.HashSizeInBytes; - } - else if (hashAlgorithmName == HashAlgorithmName.SHA3_256) - { - return HMACSHA3_256.HashSizeInBytes; - } - else if (hashAlgorithmName == HashAlgorithmName.SHA3_384) - { - return HMACSHA3_384.HashSizeInBytes; - } - else if (hashAlgorithmName == HashAlgorithmName.SHA3_512) - { - return HMACSHA3_512.HashSizeInBytes; - } - else if (hashAlgorithmName == HashAlgorithmName.MD5) - { - return HMACMD5.HashSizeInBytes; - } - else - { - throw new ArgumentOutOfRangeException(nameof(hashAlgorithmName)); - } + DeriveKeyCore(hashAlgorithmName, hashLength, ikm, output, salt, info); } } } diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDFManagedImplementation.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDFManagedImplementation.cs new file mode 100644 index 00000000000000..e62cc4e33ecf54 --- /dev/null +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/HKDFManagedImplementation.cs @@ -0,0 +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.Diagnostics; +using System.Runtime.Versioning; +using Internal.Cryptography; + +namespace System.Security.Cryptography +{ + internal static class HKDFManagedImplementation + { + internal static void Extract(HashAlgorithmName hashAlgorithmName, int hashLength, ReadOnlySpan ikm, ReadOnlySpan salt, Span prk) + { + Debug.Assert(Helpers.HashLength(hashAlgorithmName) == hashLength); + int written = CryptographicOperations.HmacData(hashAlgorithmName, salt, ikm, prk); + Debug.Assert(written == prk.Length, $"Bytes written is {written} bytes which does not match output length ({prk.Length} bytes)"); + } + + internal static void Expand(HashAlgorithmName hashAlgorithmName, int hashLength, ReadOnlySpan prk, Span output, ReadOnlySpan info) + { + Debug.Assert(Helpers.HashLength(hashAlgorithmName) == hashLength); + + byte counter = 0; + var counterSpan = new Span(ref counter); + Span t = Span.Empty; + Span remainingOutput = output; + + const int MaxStackInfoBuffer = 64; + Span tempInfoBuffer = stackalloc byte[MaxStackInfoBuffer]; + scoped ReadOnlySpan infoBuffer; + byte[]? rentedTempInfoBuffer = null; + + if (output.Overlaps(info)) + { + if (info.Length > MaxStackInfoBuffer) + { + rentedTempInfoBuffer = CryptoPool.Rent(info.Length); + tempInfoBuffer = rentedTempInfoBuffer; + } + + tempInfoBuffer = tempInfoBuffer.Slice(0, info.Length); + info.CopyTo(tempInfoBuffer); + infoBuffer = tempInfoBuffer; + } + else + { + infoBuffer = info; + } + + using (IncrementalHash hmac = IncrementalHash.CreateHMAC(hashAlgorithmName, prk)) + { + for (int i = 1; ; i++) + { + hmac.AppendData(t); + hmac.AppendData(infoBuffer); + counter = (byte)i; + hmac.AppendData(counterSpan); + + if (remainingOutput.Length >= hashLength) + { + t = remainingOutput.Slice(0, hashLength); + remainingOutput = remainingOutput.Slice(hashLength); + GetHashAndReset(hmac, t); + } + else + { + if (remainingOutput.Length > 0) + { + Debug.Assert(hashLength <= 512 / 8, "hashLength is larger than expected, consider increasing this value or using regular allocation"); + Span lastChunk = stackalloc byte[hashLength]; + GetHashAndReset(hmac, lastChunk); + lastChunk.Slice(0, remainingOutput.Length).CopyTo(remainingOutput); + } + + break; + } + } + } + + if (rentedTempInfoBuffer is not null) + { + CryptoPool.Return(rentedTempInfoBuffer, clearSize: info.Length); + } + } + + internal static void DeriveKey(HashAlgorithmName hashAlgorithmName, int hashLength, ReadOnlySpan ikm, Span output, ReadOnlySpan salt, ReadOnlySpan info) + { + Span prk = stackalloc byte[hashLength]; + + Extract(hashAlgorithmName, hashLength, ikm, salt, prk); + Expand(hashAlgorithmName, hashLength, prk, output, info); + CryptographicOperations.ZeroMemory(prk); + } + + private static void GetHashAndReset(IncrementalHash hmac, Span output) + { + int written = hmac.GetHashAndReset(output); + Debug.Assert(written == output.Length, $"Bytes written is {written} bytes which does not match output length ({output.Length} bytes)"); + } + } +} diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Helpers.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Helpers.cs index 5a07b09c2cc17b..72319d5185af60 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Helpers.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/Helpers.cs @@ -347,5 +347,45 @@ internal static ReadOnlySpan ArrayToSpanOrThrow( return arg; } + + internal static int HashLength(HashAlgorithmName hashAlgorithmName) + { + if (hashAlgorithmName == HashAlgorithmName.SHA1) + { + return HMACSHA1.HashSizeInBytes; + } + else if (hashAlgorithmName == HashAlgorithmName.SHA256) + { + return HMACSHA256.HashSizeInBytes; + } + else if (hashAlgorithmName == HashAlgorithmName.SHA384) + { + return HMACSHA384.HashSizeInBytes; + } + else if (hashAlgorithmName == HashAlgorithmName.SHA512) + { + return HMACSHA512.HashSizeInBytes; + } + else if (hashAlgorithmName == HashAlgorithmName.SHA3_256) + { + return HMACSHA3_256.HashSizeInBytes; + } + else if (hashAlgorithmName == HashAlgorithmName.SHA3_384) + { + return HMACSHA3_384.HashSizeInBytes; + } + else if (hashAlgorithmName == HashAlgorithmName.SHA3_512) + { + return HMACSHA3_512.HashSizeInBytes; + } + else if (hashAlgorithmName == HashAlgorithmName.MD5) + { + return HMACMD5.HashSizeInBytes; + } + else + { + throw new ArgumentOutOfRangeException(nameof(hashAlgorithmName)); + } + } } } diff --git a/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs b/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs index 9c3537808b0a70..896325de4b371c 100644 --- a/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs @@ -15,6 +15,7 @@ public abstract class HKDFTests protected abstract byte[] DeriveKey(HashAlgorithmName hash, byte[] ikm, int outputLength, byte[] salt, byte[] info); internal static bool MD5Supported => !PlatformDetection.IsBrowser && !PlatformDetection.IsAzureLinux; + internal static bool EmptyKeysSupported => !PlatformDetection.IsAzureLinux; [Theory] [MemberData(nameof(GetHkdfTestCases))] @@ -72,7 +73,7 @@ public void ExtractNonsensicalHash() () => Extract(new HashAlgorithmName("foo"), 20, ikm, salt)); } - [Fact] + [ConditionalFact(nameof(EmptyKeysSupported))] public void ExtractEmptyIkm() { byte[] salt = new byte[20]; @@ -206,6 +207,7 @@ public void DeriveKeyTamperInfoTests(HkdfTestCase test) [Theory] [MemberData(nameof(Sha3TestCases))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/106489", typeof(PlatformDetection), nameof(PlatformDetection.IsAzureLinux))] public void Sha3Tests(HkdfTestCase test) { if (PlatformDetection.SupportsSha3) diff --git a/src/native/libs/System.Security.Cryptography.Native/entrypoints.c b/src/native/libs/System.Security.Cryptography.Native/entrypoints.c index 523796cd3cac59..de513a3c4152a5 100644 --- a/src/native/libs/System.Security.Cryptography.Native/entrypoints.c +++ b/src/native/libs/System.Security.Cryptography.Native/entrypoints.c @@ -222,6 +222,9 @@ static const Entry s_cryptoNative[] = DllImportEntry(CryptoNative_GetX509SubjectPublicKeyInfoDerSize) DllImportEntry(CryptoNative_GetX509Thumbprint) DllImportEntry(CryptoNative_GetX509Version) + DllImportEntry(CryptoNative_HkdfDeriveKey) + DllImportEntry(CryptoNative_HkdfExpand) + DllImportEntry(CryptoNative_HkdfExtract) DllImportEntry(CryptoNative_HmacCopy) DllImportEntry(CryptoNative_HmacCreate) DllImportEntry(CryptoNative_HmacCurrent) diff --git a/src/native/libs/System.Security.Cryptography.Native/opensslshim.h b/src/native/libs/System.Security.Cryptography.Native/opensslshim.h index 1ce54770235218..b85316556c0aac 100644 --- a/src/native/libs/System.Security.Cryptography.Native/opensslshim.h +++ b/src/native/libs/System.Security.Cryptography.Native/opensslshim.h @@ -104,6 +104,24 @@ void ERR_put_error(int32_t lib, int32_t func, int32_t reason, const char* file, c_static_assert(ERR_R_UNSUPPORTED == 0x8010C); #endif +#ifndef EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND +#define EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND 0 +#else +c_static_assert(EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND == 0); +#endif + +#ifndef EVP_KDF_HKDF_MODE_EXTRACT_ONLY +#define EVP_KDF_HKDF_MODE_EXTRACT_ONLY 1 +#else +c_static_assert(EVP_KDF_HKDF_MODE_EXTRACT_ONLY == 1); +#endif + +#ifndef EVP_KDF_HKDF_MODE_EXPAND_ONLY +#define EVP_KDF_HKDF_MODE_EXPAND_ONLY 2 +#else +c_static_assert(EVP_KDF_HKDF_MODE_EXPAND_ONLY == 2); +#endif + #if defined FEATURE_DISTRO_AGNOSTIC_SSL || OPENSSL_VERSION_NUMBER >= OPENSSL_VERSION_3_0_RTM #include "apibridge_30_rev.h" #endif @@ -552,6 +570,7 @@ extern bool g_libSslUses32BitTime; LIGHTUP_FUNCTION(OSSL_STORE_open_ex) \ LIGHTUP_FUNCTION(OSSL_PARAM_construct_octet_string) \ LIGHTUP_FUNCTION(OSSL_PARAM_construct_utf8_string) \ + LIGHTUP_FUNCTION(OSSL_PARAM_construct_int) \ LIGHTUP_FUNCTION(OSSL_PARAM_construct_int32) \ LIGHTUP_FUNCTION(OSSL_PARAM_construct_end) \ REQUIRED_FUNCTION(PKCS8_PRIV_KEY_INFO_free) \ @@ -1104,6 +1123,7 @@ extern TYPEOF(OPENSSL_gmtime)* OPENSSL_gmtime_ptr; #define OSSL_STORE_open_ex OSSL_STORE_open_ex_ptr #define OSSL_PARAM_construct_octet_string OSSL_PARAM_construct_octet_string_ptr #define OSSL_PARAM_construct_utf8_string OSSL_PARAM_construct_utf8_string_ptr +#define OSSL_PARAM_construct_int OSSL_PARAM_construct_int_ptr #define OSSL_PARAM_construct_int32 OSSL_PARAM_construct_int32_ptr #define OSSL_PARAM_construct_end OSSL_PARAM_construct_end_ptr #define PKCS8_PRIV_KEY_INFO_free PKCS8_PRIV_KEY_INFO_free_ptr diff --git a/src/native/libs/System.Security.Cryptography.Native/osslcompat_30.h b/src/native/libs/System.Security.Cryptography.Native/osslcompat_30.h index 6baa8fa143347b..1609afd2a003bd 100644 --- a/src/native/libs/System.Security.Cryptography.Native/osslcompat_30.h +++ b/src/native/libs/System.Security.Cryptography.Native/osslcompat_30.h @@ -17,6 +17,7 @@ #define OSSL_KDF_PARAM_KEY "key" #define OSSL_KDF_PARAM_SALT "salt" #define OSSL_KDF_PARAM_INFO "info" +#define OSSL_KDF_PARAM_MODE "mode" #define OSSL_MAC_PARAM_KEY "key" #define OSSL_MAC_PARAM_CUSTOM "custom" @@ -76,6 +77,7 @@ EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_pkey( OSSL_LIB_CTX *libctx, EVP_PKEY *pkey, const char *propquery); OSSL_PARAM OSSL_PARAM_construct_end(void); +OSSL_PARAM OSSL_PARAM_construct_int(const char *key, int *buf); OSSL_PARAM OSSL_PARAM_construct_int32(const char *key, int32_t *buf); OSSL_PARAM OSSL_PARAM_construct_octet_string(const char *key, void *buf, size_t bsize); OSSL_PARAM OSSL_PARAM_construct_utf8_string(const char *key, char *buf, size_t bsize); diff --git a/src/native/libs/System.Security.Cryptography.Native/pal_evp_kdf.c b/src/native/libs/System.Security.Cryptography.Native/pal_evp_kdf.c index 5b3705e8128419..a7af40330316a5 100644 --- a/src/native/libs/System.Security.Cryptography.Native/pal_evp_kdf.c +++ b/src/native/libs/System.Security.Cryptography.Native/pal_evp_kdf.c @@ -157,3 +157,165 @@ int32_t CryptoNative_KbkdfHmacOneShot( #endif return 0; } + +static int32_t HkdfCore( + EVP_KDF* kdf, + int operation, + uint8_t* key, + int32_t keyLength, + char* algorithm, + uint8_t* salt, + int32_t saltLength, + uint8_t* info, + int32_t infoLength, + uint8_t* destination, + int32_t destinationLength) +{ + assert(kdf); + assert(key != NULL || keyLength == 0); + assert(keyLength >= 0); + assert(algorithm); + assert(destination); + assert(destinationLength > 0); + assert(salt != NULL || saltLength == 0); + assert(info != NULL || infoLength == 0); + + ERR_clear_error(); + +#ifdef NEED_OPENSSL_3_0 + if (API_EXISTS(EVP_KDF_CTX_new)) + { + assert(API_EXISTS(EVP_KDF_CTX_free)); + assert(API_EXISTS(EVP_KDF_derive)); + assert(API_EXISTS(OSSL_PARAM_construct_utf8_string)); + assert(API_EXISTS(OSSL_PARAM_construct_octet_string)); + assert(API_EXISTS(OSSL_PARAM_construct_end)); + + EVP_KDF_CTX* ctx = EVP_KDF_CTX_new(kdf); + int32_t ret = 0; + + if (ctx == NULL) + { + goto cleanup; + } + + size_t keyLengthT = Int32ToSizeT(keyLength); + size_t destinationLengthT = Int32ToSizeT(destinationLength); + size_t saltLengthT = Int32ToSizeT(saltLength); + size_t infoLengthT = Int32ToSizeT(infoLength); + + OSSL_PARAM params[] = + { + OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY, (void*)key, keyLengthT), + OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, algorithm, 0), + OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT, (void*)salt, saltLengthT), + OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO, (void*)info, infoLengthT), + OSSL_PARAM_construct_int(OSSL_KDF_PARAM_MODE, &operation), + OSSL_PARAM_construct_end(), + }; + + if (EVP_KDF_derive(ctx, destination, destinationLengthT, params) <= 0) + { + goto cleanup; + } + + ret = 1; + +cleanup: + if (ctx != NULL) + { + EVP_KDF_CTX_free(ctx); + } + + return ret; + } +#else + (void)kdf; + (void)operation; + (void)key; + (void)keyLength; + (void)algorithm; + (void)salt; + (void)saltLength; + (void)info; + (void)infoLength; + (void)destination; + (void)destinationLength; + assert(0 && "Inconsistent EVP_KDF API availability."); +#endif + return 0; +} + +int32_t CryptoNative_HkdfDeriveKey( + EVP_KDF* kdf, + uint8_t* ikm, + int32_t ikmLength, + char* algorithm, + uint8_t* salt, + int32_t saltLength, + uint8_t* info, + int32_t infoLength, + uint8_t* destination, + int32_t destinationLength) +{ + return HkdfCore( + kdf, + EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND, + ikm, + ikmLength, + algorithm, + salt, + saltLength, + info, + infoLength, + destination, + destinationLength); +} + +int32_t CryptoNative_HkdfExpand( + EVP_KDF* kdf, + uint8_t* prk, + int32_t prkLength, + char* algorithm, + uint8_t* info, + int32_t infoLength, + uint8_t* destination, + int32_t destinationLength) +{ + return HkdfCore( + kdf, + EVP_KDF_HKDF_MODE_EXPAND_ONLY, + prk, + prkLength, + algorithm, + NULL /* salt */, + 0 /* saltLength */, + info, + infoLength, + destination, + destinationLength); +} + +int32_t CryptoNative_HkdfExtract( + EVP_KDF* kdf, + uint8_t* ikm, + int32_t ikmLength, + char* algorithm, + uint8_t* salt, + int32_t saltLength, + uint8_t* destination, + int32_t destinationLength) +{ + return HkdfCore( + kdf, + EVP_KDF_HKDF_MODE_EXTRACT_ONLY, + ikm, + ikmLength, + algorithm, + salt, + saltLength, + NULL /* info */, + 0 /* infoLength */, + destination, + destinationLength); +} diff --git a/src/native/libs/System.Security.Cryptography.Native/pal_evp_kdf.h b/src/native/libs/System.Security.Cryptography.Native/pal_evp_kdf.h index 0841dc2b3553e1..165e9e59d7ad56 100644 --- a/src/native/libs/System.Security.Cryptography.Native/pal_evp_kdf.h +++ b/src/native/libs/System.Security.Cryptography.Native/pal_evp_kdf.h @@ -61,3 +61,35 @@ PALEXPORT int32_t CryptoNative_KbkdfHmacOneShot( int32_t contextLength, uint8_t* destination, int32_t destinationLength); + +PALEXPORT int32_t CryptoNative_HkdfDeriveKey( + EVP_KDF* kdf, + uint8_t* ikm, + int32_t ikmLength, + char* algorithm, + uint8_t* salt, + int32_t saltLength, + uint8_t* info, + int32_t infoLength, + uint8_t* destination, + int32_t destinationLength); + +PALEXPORT int32_t CryptoNative_HkdfExpand( + EVP_KDF* kdf, + uint8_t* prk, + int32_t prkLength, + char* algorithm, + uint8_t* info, + int32_t infoLength, + uint8_t* destination, + int32_t destinationLength); + +PALEXPORT int32_t CryptoNative_HkdfExtract( + EVP_KDF* kdf, + uint8_t* ikm, + int32_t ikmLength, + char* algorithm, + uint8_t* salt, + int32_t saltLength, + uint8_t* destination, + int32_t destinationLength); From 0550bcde396222834ba0b6fecf757a568aeeec22 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 17:53:48 -0700 Subject: [PATCH 077/748] Extend timeout when waiting for service status (#107109) Co-authored-by: Eric StJohn --- .../tests/WindowsServiceTester.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/WindowsServiceTester.cs b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/WindowsServiceTester.cs index 880fae3e0465a4..708e2abab68c1a 100644 --- a/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/WindowsServiceTester.cs +++ b/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/WindowsServiceTester.cs @@ -48,7 +48,7 @@ private WindowsServiceTester(SafeServiceHandle serviceHandle, RemoteInvokeHandle { } } - public static TimeSpan WaitForStatusTimeout { get; set; } = TimeSpan.FromSeconds(30); + public static TimeSpan WaitForStatusTimeout { get; set; } = TimeSpan.FromMinutes(3); public new void WaitForStatus(ServiceControllerStatus desiredStatus) => WaitForStatus(desiredStatus, WaitForStatusTimeout); From 0a5cccb57942c0493ef680f559f69866f3b1eb7d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 18:39:53 -0700 Subject: [PATCH 078/748] pal init: Move InitializeFlushProcessWriteBuffers() after VIRTUALInitialize() (#107114) A fixup of commit 27ee590d that's broken on platforms which don't support membarrier() syscall: GetVirtualPageSize() is called in the fallback path of InitializeFlushProcessWriteBuffers() and attempts to mmap() zero bytes. Move InitializeFlushProcessWriteBuffers() after VIRTUALInitialize() but before the first thread is created. Fixes https://github.com/dotnet/runtime/issues/106892 Fixes https://github.com/dotnet/runtime/issues/106722 Co-authored-by: Haris Okanovic --- src/coreclr/pal/src/init/pal.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/coreclr/pal/src/init/pal.cpp b/src/coreclr/pal/src/init/pal.cpp index a51feb390b44ca..63ee86e291ff75 100644 --- a/src/coreclr/pal/src/init/pal.cpp +++ b/src/coreclr/pal/src/init/pal.cpp @@ -382,16 +382,6 @@ Initialize( goto CLEANUP0a; } - if (flags & PAL_INITIALIZE_FLUSH_PROCESS_WRITE_BUFFERS) - { - // Initialize before first thread is created for faster load on Linux - if (!InitializeFlushProcessWriteBuffers()) - { - palError = ERROR_PALINIT_INITIALIZE_FLUSH_PROCESS_WRITE_BUFFERS; - goto CLEANUP0a; - } - } - // The gSharedFilesPath is allocated dynamically so its destructor does not get // called unexpectedly during cleanup gSharedFilesPath = InternalNew(); @@ -639,6 +629,17 @@ Initialize( goto CLEANUP10; } + if (flags & PAL_INITIALIZE_FLUSH_PROCESS_WRITE_BUFFERS) + { + // Initialize before first thread is created for faster load on Linux + if (!InitializeFlushProcessWriteBuffers()) + { + ERROR("Unable to initialize flush process write buffers\n"); + palError = ERROR_PALINIT_INITIALIZE_FLUSH_PROCESS_WRITE_BUFFERS; + goto CLEANUP10; + } + } + if (flags & PAL_INITIALIZE_SYNC_THREAD) { // From 6c8b1edf135937fcd400d6e1d7d417832bffe6e1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 09:37:22 -0700 Subject: [PATCH 079/748] [release/9.0] Ensure the layout of `StackAllocatedBox` matches boxed layouts (#107075) * Ensure the layout of `StackAllocatedBox` matches boxed layouts The boxed layout of a struct always has its data at +8, as evidenced by `Object::UnBox`. This means that `StackAllocatedBox` should have `Pack = 1`, otherwise this may not be the case. In the test failure we had a `StackAllocatedBox` which had its `_value` field at offset 16. After object stack allocation this meant that we were saving data in padding of the structure, which promotion does not guarantee to preserve. Fix #106947 * Run jit-format * Correct enum --------- Co-authored-by: Jakob Botsch Nielsen Co-authored-by: Jeff Schwartz --- src/coreclr/jit/valuenum.cpp | 4 +++- src/coreclr/vm/corelib.h | 1 + src/coreclr/vm/jitinterface.cpp | 6 ++++++ .../System/Runtime/CompilerServices/StackAllocatedBox.cs | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/valuenum.cpp b/src/coreclr/jit/valuenum.cpp index afbaeeb931bffa..08d490813033cd 100644 --- a/src/coreclr/jit/valuenum.cpp +++ b/src/coreclr/jit/valuenum.cpp @@ -10299,7 +10299,9 @@ void ValueNumStore::vnDumpSimdType(Compiler* comp, VNFuncApp* simdType) int simdSize = ConstantValue(simdType->m_args[0]); CorInfoType baseJitType = (CorInfoType)ConstantValue(simdType->m_args[1]); - printf("%s(simd%d, %s)", VNFuncName(simdType->m_func), simdSize, varTypeName(JitType2PreciseVarType(baseJitType))); + printf("%s(simd%d, %s)", VNFuncName(simdType->m_func), simdSize, + baseJitType == CORINFO_TYPE_UNDEF ? varTypeName(TYP_UNDEF) + : varTypeName(JitType2PreciseVarType(baseJitType))); } #endif // FEATURE_SIMD diff --git a/src/coreclr/vm/corelib.h b/src/coreclr/vm/corelib.h index ea78d259cd73e9..2b69d7f6775c87 100644 --- a/src/coreclr/vm/corelib.h +++ b/src/coreclr/vm/corelib.h @@ -1129,6 +1129,7 @@ DEFINE_METHOD(ICASTABLEHELPERS, GETIMPLTYPE, GetImplType, SM_ICast #endif // FEATURE_ICASTABLE DEFINE_CLASS(STACKALLOCATEDBOX, CompilerServices, StackAllocatedBox`1) +DEFINE_FIELD(STACKALLOCATEDBOX, VALUE, _value) DEFINE_CLASS(UTF8STRINGMARSHALLER, Marshalling, Utf8StringMarshaller) DEFINE_METHOD(UTF8STRINGMARSHALLER, CONVERT_TO_MANAGED, ConvertToManaged, SM_PtrByte_RetStr) diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 9c76cf0e7b08b0..e590250e76c7c6 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -6185,6 +6185,12 @@ CORINFO_CLASS_HANDLE CEEInfo::getTypeForBoxOnStack(CORINFO_CLASS_HANDLE cls) TypeHandle stackAllocatedBox = CoreLibBinder::GetClass(CLASS__STACKALLOCATEDBOX); TypeHandle stackAllocatedBoxInst = stackAllocatedBox.Instantiate(boxedFieldsInst); result = static_cast(stackAllocatedBoxInst.AsPtr()); + +#ifdef _DEBUG + FieldDesc* pValueFD = CoreLibBinder::GetField(FIELD__STACKALLOCATEDBOX__VALUE); + DWORD index = pValueFD->GetApproxEnclosingMethodTable()->GetIndexForFieldDesc(pValueFD); + _ASSERTE(stackAllocatedBoxInst.GetMethodTable()->GetFieldDescByIndex(index)->GetOffset() == TARGET_POINTER_SIZE); +#endif } EE_TO_JIT_TRANSITION(); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/StackAllocatedBox.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/StackAllocatedBox.cs index 868edb18c1594b..33f2131edd115a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/StackAllocatedBox.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/StackAllocatedBox.cs @@ -7,7 +7,7 @@ namespace System.Runtime.CompilerServices { [NonVersionable] - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] internal unsafe struct StackAllocatedBox { // These fields are only accessed from jitted code From c827c2711e9f232195829c0e90ed16a098efb6ce Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 09:37:56 -0700 Subject: [PATCH 080/748] Ensure that AdvSimd.Insert doesn't zero out the upper bits (#107089) Co-authored-by: Tanner Gooding Co-authored-by: Jeff Schwartz --- src/coreclr/jit/hwintrinsiccodegenarm64.cpp | 40 ++++++++----------- src/coreclr/jit/lowerarmarch.cpp | 12 ------ .../JitBlue/Runtime_106079/Runtime_106079.cs | 28 +++++++++++++ .../Runtime_106079/Runtime_106079.csproj | 8 ++++ 4 files changed, 53 insertions(+), 35 deletions(-) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106079/Runtime_106079.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106079/Runtime_106079.csproj diff --git a/src/coreclr/jit/hwintrinsiccodegenarm64.cpp b/src/coreclr/jit/hwintrinsiccodegenarm64.cpp index 665b0c64751b28..5bf021ac90b55f 100644 --- a/src/coreclr/jit/hwintrinsiccodegenarm64.cpp +++ b/src/coreclr/jit/hwintrinsiccodegenarm64.cpp @@ -1383,44 +1383,38 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) break; case NI_AdvSimd_Insert: + { assert(isRMW); GetEmitter()->emitIns_Mov(INS_mov, emitTypeSize(node), targetReg, op1Reg, /* canSkip */ true); - if (intrin.op3->isContainedFltOrDblImmed()) - { - assert(intrin.op2->isContainedIntOrIImmed()); - assert(intrin.op2->AsIntCon()->gtIconVal == 0); + // fmov (scalar) zeros the upper bits and is not safe to use + assert(!intrin.op3->isContainedFltOrDblImmed()); - const double dataValue = intrin.op3->AsDblCon()->DconValue(); - GetEmitter()->emitIns_R_F(INS_fmov, emitSize, targetReg, dataValue, opt); - } - else - { - assert(targetReg != op3Reg); + assert(targetReg != op3Reg); - HWIntrinsicImmOpHelper helper(this, intrin.op2, node); + HWIntrinsicImmOpHelper helper(this, intrin.op2, node); - if (varTypeIsFloating(intrin.baseType)) + if (varTypeIsFloating(intrin.baseType)) + { + for (helper.EmitBegin(); !helper.Done(); helper.EmitCaseEnd()) { - for (helper.EmitBegin(); !helper.Done(); helper.EmitCaseEnd()) - { - const int elementIndex = helper.ImmValue(); + const int elementIndex = helper.ImmValue(); - GetEmitter()->emitIns_R_R_I_I(ins, emitSize, targetReg, op3Reg, elementIndex, 0, opt); - } + GetEmitter()->emitIns_R_R_I_I(ins, emitSize, targetReg, op3Reg, elementIndex, 0, opt); } - else + } + else + { + for (helper.EmitBegin(); !helper.Done(); helper.EmitCaseEnd()) { - for (helper.EmitBegin(); !helper.Done(); helper.EmitCaseEnd()) - { - const int elementIndex = helper.ImmValue(); + const int elementIndex = helper.ImmValue(); - GetEmitter()->emitIns_R_R_I(ins, emitSize, targetReg, op3Reg, elementIndex, opt); - } + GetEmitter()->emitIns_R_R_I(ins, emitSize, targetReg, op3Reg, elementIndex, opt); } } break; + } case NI_AdvSimd_InsertScalar: { diff --git a/src/coreclr/jit/lowerarmarch.cpp b/src/coreclr/jit/lowerarmarch.cpp index e0bf56e0eeb3fc..978c066be998a5 100644 --- a/src/coreclr/jit/lowerarmarch.cpp +++ b/src/coreclr/jit/lowerarmarch.cpp @@ -3771,18 +3771,6 @@ void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node) if (intrin.op2->IsCnsIntOrI()) { MakeSrcContained(node, intrin.op2); - - if ((intrin.op2->AsIntCon()->gtIconVal == 0) && intrin.op3->IsCnsFltOrDbl()) - { - assert(varTypeIsFloating(intrin.baseType)); - - const double dataValue = intrin.op3->AsDblCon()->DconValue(); - - if (comp->GetEmitter()->emitIns_valid_imm_for_fmov(dataValue)) - { - MakeSrcContained(node, intrin.op3); - } - } } break; diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106079/Runtime_106079.cs b/src/tests/JIT/Regression/JitBlue/Runtime_106079/Runtime_106079.cs new file mode 100644 index 00000000000000..9f7c7e559c24a2 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106079/Runtime_106079.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. + +using System; +using System.Runtime.CompilerServices; +using System.Numerics; +using System.Runtime.Intrinsics; +using System.Runtime.Intrinsics.Arm; +using Xunit; + +// Generated by Fuzzlyn v2.2 on 2024-08-06 15:11:52 +// Run on Arm64 MacOS +// Seed: 289142602786847481-vectort,vector64,vector128,armadvsimd,armadvsimdarm64,armaes,armarmbase,armarmbasearm64,armcrc32,armcrc32arm64,armdp,armrdm,armrdmarm64,armsha1,armsha256 +// Reduced from 87.5 KiB to 0.4 KiB in 00:00:36 +// Debug: Outputs <4607182418800017408, 13871573557235963454> +// Release: Outputs <4607182418800017408, 0> + +public class Runtime_106079 +{ + private static Vector128 s_38 = Vector128.Create(0, -567.3319449449843d); + + public static void TestEntryPoint() + { + double vr4 = 1; + s_38 = AdvSimd.Insert(s_38, 0, vr4); + Assert.Equal(Vector128.Create(4607182418800017408UL, 13871573557235963454UL), s_38.AsUInt64()); + } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106079/Runtime_106079.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_106079/Runtime_106079.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106079/Runtime_106079.csproj @@ -0,0 +1,8 @@ + + + True + + + + + From 13c6579fb12ba837055413dfc476cf60d962d7be Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 09:38:29 -0700 Subject: [PATCH 081/748] Fix storage of stack trace of exception from reflection (#107093) There was one more case where we have saved the stack trace into the _remoteStackTraceString field in the exception when the exception was passing from reflection invoked code to the caller of that code. While there is no visible difference in the Exception.ToString, a SOS test was failing due to that. And it is not necessary to save the stack trace there. I have thought about the cases when we really need the stack trace saved into the _remoteStackTraceString and I believe that actually the only case is when an existing exception is thrown again in managed code. So I have removed the option to save the stack trace from all the variants of the DispatchManagedException. Co-authored-by: Jan Vorlicek Co-authored-by: Jeff Schwartz --- src/coreclr/vm/excep.cpp | 2 +- src/coreclr/vm/exceptionhandling.cpp | 17 +++++------------ src/coreclr/vm/exceptionhandling.h | 4 ++-- src/coreclr/vm/jithelpers.cpp | 2 +- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/coreclr/vm/excep.cpp b/src/coreclr/vm/excep.cpp index 1942aab2d79a72..8d880b224f60c9 100644 --- a/src/coreclr/vm/excep.cpp +++ b/src/coreclr/vm/excep.cpp @@ -7504,7 +7504,7 @@ VOID DECLSPEC_NORETURN UnwindAndContinueRethrowHelperAfterCatch(Frame* pEntryFra } else { - DispatchManagedException(orThrowable, /* preserveStackTrace */ false); + DispatchManagedException(orThrowable); } } else diff --git a/src/coreclr/vm/exceptionhandling.cpp b/src/coreclr/vm/exceptionhandling.cpp index 191367f0a816ea..9ae42c23b99b4d 100644 --- a/src/coreclr/vm/exceptionhandling.cpp +++ b/src/coreclr/vm/exceptionhandling.cpp @@ -970,7 +970,7 @@ ProcessCLRExceptionNew(IN PEXCEPTION_RECORD pExceptionRecord, else { OBJECTREF oref = ExceptionTracker::CreateThrowable(pExceptionRecord, FALSE); - DispatchManagedException(oref, pContextRecord, /* preserveStackTrace */ false); + DispatchManagedException(oref, pContextRecord); } } #endif // !HOST_UNIX @@ -5649,7 +5649,7 @@ void FirstChanceExceptionNotification() #endif // TARGET_UNIX } -VOID DECLSPEC_NORETURN DispatchManagedException(OBJECTREF throwable, CONTEXT* pExceptionContext, bool preserveStackTrace) +VOID DECLSPEC_NORETURN DispatchManagedException(OBJECTREF throwable, CONTEXT* pExceptionContext) { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; @@ -5661,19 +5661,12 @@ VOID DECLSPEC_NORETURN DispatchManagedException(OBJECTREF throwable, CONTEXT* pE Thread *pThread = GetThread(); - if (preserveStackTrace) - { - pThread->IncPreventAbort(); - ExceptionPreserveStackTrace(throwable); - pThread->DecPreventAbort(); - } - ULONG_PTR hr = GetHRFromThrowable(throwable); EXCEPTION_RECORD exceptionRecord; exceptionRecord.ExceptionCode = EXCEPTION_COMPLUS; exceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE | EXCEPTION_SOFTWARE_ORIGINATE; - exceptionRecord.ExceptionAddress = (void *)(void (*)(OBJECTREF, bool))&DispatchManagedException; + exceptionRecord.ExceptionAddress = (void *)(void (*)(OBJECTREF))&DispatchManagedException; exceptionRecord.NumberParameters = MarkAsThrownByUs(exceptionRecord.ExceptionInformation, hr); exceptionRecord.ExceptionRecord = NULL; @@ -5709,7 +5702,7 @@ VOID DECLSPEC_NORETURN DispatchManagedException(OBJECTREF throwable, CONTEXT* pE UNREACHABLE(); } -VOID DECLSPEC_NORETURN DispatchManagedException(OBJECTREF throwable, bool preserveStackTrace) +VOID DECLSPEC_NORETURN DispatchManagedException(OBJECTREF throwable) { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; @@ -5718,7 +5711,7 @@ VOID DECLSPEC_NORETURN DispatchManagedException(OBJECTREF throwable, bool preser CONTEXT exceptionContext; RtlCaptureContext(&exceptionContext); - DispatchManagedException(throwable, &exceptionContext, preserveStackTrace); + DispatchManagedException(throwable, &exceptionContext); UNREACHABLE(); } diff --git a/src/coreclr/vm/exceptionhandling.h b/src/coreclr/vm/exceptionhandling.h index 108856bec40c6f..64e02a85e78623 100644 --- a/src/coreclr/vm/exceptionhandling.h +++ b/src/coreclr/vm/exceptionhandling.h @@ -22,8 +22,8 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord, IN OUT PT_CONTEXT pContextRecord, IN OUT PT_DISPATCHER_CONTEXT pDispatcherContext); -VOID DECLSPEC_NORETURN DispatchManagedException(OBJECTREF throwable, CONTEXT *pExceptionContext, bool preserveStackTrace = true); -VOID DECLSPEC_NORETURN DispatchManagedException(OBJECTREF throwable, bool preserveStackTrace = true); +VOID DECLSPEC_NORETURN DispatchManagedException(OBJECTREF throwable, CONTEXT *pExceptionContext); +VOID DECLSPEC_NORETURN DispatchManagedException(OBJECTREF throwable); VOID DECLSPEC_NORETURN DispatchManagedException(RuntimeExceptionKind reKind); enum CLRUnwindStatus { UnwindPending, FirstPassComplete, SecondPassComplete }; diff --git a/src/coreclr/vm/jithelpers.cpp b/src/coreclr/vm/jithelpers.cpp index b365309257dbc3..f8893f7351fe69 100644 --- a/src/coreclr/vm/jithelpers.cpp +++ b/src/coreclr/vm/jithelpers.cpp @@ -3060,7 +3060,7 @@ void ThrowNew(OBJECTREF oref) } } - DispatchManagedException(oref, /* preserveStackTrace */ false); + DispatchManagedException(oref); } #endif // FEATURE_EH_FUNCLETS From 00f3f3e37cbca7c73c51bdf3c76ffc066a8d2ffb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 13:13:54 -0700 Subject: [PATCH 082/748] [release/9.0] Tensor Operation fixes when input is sliced (non-contiguous) (#107097) * slicing fixes * rebased on main --------- Co-authored-by: Michael Sharp --- .../ref/System.Numerics.Tensors.netcore.cs | 10 +- .../src/Properties/InternalVisibleTo.cs | 6 + .../src/System.Numerics.Tensors.csproj | 1 + .../Tensors/netcore/TensorExtensions.cs | 507 ++++++++++++------ .../Numerics/Tensors/netcore/TensorHelpers.cs | 15 + .../System.Numerics.Tensors/tests/Helpers.cs | 4 +- .../tests/TensorSpanTests.cs | 455 +++++++++++++--- 7 files changed, 749 insertions(+), 249 deletions(-) create mode 100644 src/libraries/System.Numerics.Tensors/src/Properties/InternalVisibleTo.cs diff --git a/src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs b/src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs index 9a4b08633db1d7..c3a9f5be9ee36f 100644 --- a/src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs +++ b/src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs @@ -299,7 +299,7 @@ public static void BroadcastTo(this System.Numerics.Tensors.Tensor source, public static bool GreaterThanAny(in System.Numerics.Tensors.ReadOnlyTensorSpan x, T y) where T : System.Numerics.IComparisonOperators { throw null; } public static bool GreaterThanAny(T x, in System.Numerics.Tensors.ReadOnlyTensorSpan y) where T : System.Numerics.IComparisonOperators { throw null; } public static bool GreaterThanOrEqualAll(in System.Numerics.Tensors.ReadOnlyTensorSpan x, in System.Numerics.Tensors.ReadOnlyTensorSpan y) where T : System.Numerics.IComparisonOperators { throw null; } - public static bool GreaterThanOrEqualAll(in System.Numerics.Tensors.ReadOnlyTensorSpan s, T y) where T : System.Numerics.IComparisonOperators { throw null; } + public static bool GreaterThanOrEqualAll(in System.Numerics.Tensors.ReadOnlyTensorSpan x, T y) where T : System.Numerics.IComparisonOperators { throw null; } public static bool GreaterThanOrEqualAll(T x, in System.Numerics.Tensors.ReadOnlyTensorSpan y) where T : System.Numerics.IComparisonOperators { throw null; } public static bool GreaterThanOrEqualAny(in System.Numerics.Tensors.ReadOnlyTensorSpan x, in System.Numerics.Tensors.ReadOnlyTensorSpan y) where T : System.Numerics.IComparisonOperators { throw null; } public static bool GreaterThanOrEqualAny(in System.Numerics.Tensors.ReadOnlyTensorSpan x, T y) where T : System.Numerics.IComparisonOperators { throw null; } @@ -333,16 +333,16 @@ public static void BroadcastTo(this System.Numerics.Tensors.Tensor source, public static System.Numerics.Tensors.Tensor LeadingZeroCount(in System.Numerics.Tensors.ReadOnlyTensorSpan x) where T : System.Numerics.IBinaryInteger { throw null; } public static ref readonly System.Numerics.Tensors.TensorSpan LeadingZeroCount(scoped in System.Numerics.Tensors.ReadOnlyTensorSpan x, in System.Numerics.Tensors.TensorSpan destination) where T : System.Numerics.IBinaryInteger { throw null; } public static bool LessThanAll(in System.Numerics.Tensors.ReadOnlyTensorSpan x, in System.Numerics.Tensors.ReadOnlyTensorSpan y) where T : System.Numerics.IComparisonOperators { throw null; } - public static bool LessThanAll(in System.Numerics.Tensors.ReadOnlyTensorSpan f, T x) where T : System.Numerics.IComparisonOperators { throw null; } + public static bool LessThanAll(in System.Numerics.Tensors.ReadOnlyTensorSpan x, T y) where T : System.Numerics.IComparisonOperators { throw null; } public static bool LessThanAll(T x, in System.Numerics.Tensors.ReadOnlyTensorSpan y) where T : System.Numerics.IComparisonOperators { throw null; } public static bool LessThanAny(in System.Numerics.Tensors.ReadOnlyTensorSpan x, in System.Numerics.Tensors.ReadOnlyTensorSpan y) where T : System.Numerics.IComparisonOperators { throw null; } - public static bool LessThanAny(in System.Numerics.Tensors.ReadOnlyTensorSpan f, T x) where T : System.Numerics.IComparisonOperators { throw null; } + public static bool LessThanAny(in System.Numerics.Tensors.ReadOnlyTensorSpan x, T y) where T : System.Numerics.IComparisonOperators { throw null; } public static bool LessThanAny(T x, in System.Numerics.Tensors.ReadOnlyTensorSpan y) where T : System.Numerics.IComparisonOperators { throw null; } public static bool LessThanOrEqualAll(in System.Numerics.Tensors.ReadOnlyTensorSpan x, in System.Numerics.Tensors.ReadOnlyTensorSpan y) where T : System.Numerics.IComparisonOperators { throw null; } - public static bool LessThanOrEqualAll(in System.Numerics.Tensors.ReadOnlyTensorSpan f, T x) where T : System.Numerics.IComparisonOperators { throw null; } + public static bool LessThanOrEqualAll(in System.Numerics.Tensors.ReadOnlyTensorSpan x, T y) where T : System.Numerics.IComparisonOperators { throw null; } public static bool LessThanOrEqualAll(T x, in System.Numerics.Tensors.ReadOnlyTensorSpan y) where T : System.Numerics.IComparisonOperators { throw null; } public static bool LessThanOrEqualAny(in System.Numerics.Tensors.ReadOnlyTensorSpan x, in System.Numerics.Tensors.ReadOnlyTensorSpan y) where T : System.Numerics.IComparisonOperators { throw null; } - public static bool LessThanOrEqualAny(in System.Numerics.Tensors.ReadOnlyTensorSpan f, T x) where T : System.Numerics.IComparisonOperators { throw null; } + public static bool LessThanOrEqualAny(in System.Numerics.Tensors.ReadOnlyTensorSpan x, T y) where T : System.Numerics.IComparisonOperators { throw null; } public static bool LessThanOrEqualAny(T x, in System.Numerics.Tensors.ReadOnlyTensorSpan y) where T : System.Numerics.IComparisonOperators { throw null; } public static System.Numerics.Tensors.Tensor LessThanOrEqual(in System.Numerics.Tensors.ReadOnlyTensorSpan x, in System.Numerics.Tensors.ReadOnlyTensorSpan y) where T : System.Numerics.IComparisonOperators { throw null; } public static ref readonly System.Numerics.Tensors.TensorSpan LessThanOrEqual(scoped in System.Numerics.Tensors.ReadOnlyTensorSpan x, scoped in System.Numerics.Tensors.ReadOnlyTensorSpan y, in System.Numerics.Tensors.TensorSpan destination) where T : System.Numerics.IComparisonOperators { throw null; } diff --git a/src/libraries/System.Numerics.Tensors/src/Properties/InternalVisibleTo.cs b/src/libraries/System.Numerics.Tensors/src/Properties/InternalVisibleTo.cs new file mode 100644 index 00000000000000..8858b4b76a81bf --- /dev/null +++ b/src/libraries/System.Numerics.Tensors/src/Properties/InternalVisibleTo.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. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("System.Numerics.Tensors.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001004b86c4cb78549b34bab61a3b1800e23bfeb5b3ec390074041536a7e3cbd97f5f04cf0f857155a8928eaa29ebfd11cfbbad3ba70efea7bda3226c6a8d370a4cd303f714486b6ebc225985a638471e6ef571cc92a4613c00b8fa65d61ccee0cbe5f36330c9a01f4183559f1bef24cc2917c6d913e3a541333a1d05d9bed22b38cb")] diff --git a/src/libraries/System.Numerics.Tensors/src/System.Numerics.Tensors.csproj b/src/libraries/System.Numerics.Tensors/src/System.Numerics.Tensors.csproj index 29c38e142ba808..454a1ce98fbe36 100644 --- a/src/libraries/System.Numerics.Tensors/src/System.Numerics.Tensors.csproj +++ b/src/libraries/System.Numerics.Tensors/src/System.Numerics.Tensors.csproj @@ -11,6 +11,7 @@ + diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorExtensions.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorExtensions.cs index c01da7a52160d2..176a2b4ef5ec77 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorExtensions.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorExtensions.cs @@ -56,7 +56,7 @@ public static T Average(scoped in ReadOnlyTensorSpan x) where T : IFloatingPoint { T sum = Sum(x); - return T.CreateChecked(sum / T.CreateChecked(x._shape._memoryLength)); + return T.CreateChecked(sum / T.CreateChecked(x.FlattenedLength)); } #endregion @@ -395,10 +395,11 @@ public static ref readonly TensorSpan ConcatenateOnDimension(int dimension scoped Span curIndex; nint[]? curIndexArray; - if (tensors[0].Rank > 6) + if (tensors[0].Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(tensors[0].Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, tensors[0].Rank); } else { @@ -499,10 +500,11 @@ public static ref readonly TensorSpan Equals(scoped in ReadOnlyTensorSp scoped Span curIndex; nint[]? curIndexArray; - if (right.Rank > 6) + if (right.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(right.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, right.Rank); } else { @@ -554,10 +556,11 @@ public static ref readonly TensorSpan Equals(scoped in ReadOnlyTensorSp scoped Span curIndex; nint[]? curIndexArray; - if (x.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { @@ -598,10 +601,11 @@ public static bool EqualsAll(in ReadOnlyTensorSpan x, in ReadOnlyTensorSpa scoped Span curIndex; nint[]? curIndexArray; - if (broadcastedLeft.Rank > 6) + if (broadcastedLeft.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(broadcastedRight.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, broadcastedRight.Rank); } else { @@ -636,10 +640,11 @@ public static bool EqualsAll(in ReadOnlyTensorSpan x, T y) scoped Span curIndex; nint[]? curIndexArray; - if (x.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { @@ -680,10 +685,11 @@ public static bool EqualsAny(in ReadOnlyTensorSpan x, in ReadOnlyTensorSpa scoped Span curIndex; nint[]? curIndexArray; - if (broadcastedRight.Lengths.Length > 6) + if (broadcastedRight.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(broadcastedRight.Lengths.Length); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, broadcastedRight.Rank); } else { @@ -718,10 +724,11 @@ public static bool EqualsAny(in ReadOnlyTensorSpan x, T y) scoped Span curIndex; nint[]? curIndexArray; - if (x.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { @@ -864,10 +871,11 @@ public static ref readonly TensorSpan GreaterThan(scoped in ReadOnlyTen scoped Span curIndex; nint[]? curIndexArray; - if (right.Rank > 6) + if (right.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(right.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, right.Rank); } else { @@ -923,10 +931,11 @@ public static ref readonly TensorSpan GreaterThan(scoped in ReadOnlyTen scoped Span curIndex; nint[]? curIndexArray; - if (x.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { @@ -982,10 +991,11 @@ public static ref readonly TensorSpan GreaterThan(T x, scoped in ReadOn scoped Span curIndex; nint[]? curIndexArray; - if (y.Rank > 6) + if (y.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(y.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, y.Rank); } else { @@ -1070,10 +1080,11 @@ public static ref readonly TensorSpan GreaterThanOrEqual(scoped in Read scoped Span curIndex; nint[]? curIndexArray; - if (right.Rank > 6) + if (right.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(right.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, right.Rank); } else { @@ -1129,10 +1140,11 @@ public static ref readonly TensorSpan GreaterThanOrEqual(scoped in Read scoped Span curIndex; nint[]? curIndexArray; - if (x.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { @@ -1188,10 +1200,11 @@ public static ref readonly TensorSpan GreaterThanOrEqual(T x, scoped in scoped Span curIndex; nint[]? curIndexArray; - if (y.Rank > 6) + if (y.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(y.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, y.Rank); } else { @@ -1231,10 +1244,11 @@ public static bool GreaterThanAny(in ReadOnlyTensorSpan x, in ReadOnlyTens scoped Span curIndex; nint[]? curIndexArray; - if (broadcastedRight.Lengths.Length > 6) + if (broadcastedRight.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(broadcastedRight.Lengths.Length); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, broadcastedRight.Rank); } else { @@ -1269,10 +1283,11 @@ public static bool GreaterThanAny(in ReadOnlyTensorSpan x, T y) scoped Span curIndex; nint[]? curIndexArray; - if (x.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { @@ -1307,10 +1322,11 @@ public static bool GreaterThanAny(T x, in ReadOnlyTensorSpan y) scoped Span curIndex; nint[]? curIndexArray; - if (y.Rank > 6) + if (y.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(y.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, y.Rank); } else { @@ -1351,10 +1367,11 @@ public static bool GreaterThanOrEqualAny(in ReadOnlyTensorSpan x, in ReadO scoped Span curIndex; nint[]? curIndexArray; - if (broadcastedRight.Lengths.Length > 6) + if (broadcastedRight.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(broadcastedRight.Lengths.Length); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, broadcastedRight.Rank); } else { @@ -1389,10 +1406,11 @@ public static bool GreaterThanOrEqualAny(in ReadOnlyTensorSpan x, T y) scoped Span curIndex; nint[]? curIndexArray; - if (x.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { @@ -1427,10 +1445,11 @@ public static bool GreaterThanOrEqualAny(T x, in ReadOnlyTensorSpan y) scoped Span curIndex; nint[]? curIndexArray; - if (y.Rank > 6) + if (y.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(y.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, y.Rank); } else { @@ -1472,10 +1491,11 @@ public static bool GreaterThanAll(in ReadOnlyTensorSpan x, in ReadOnlyTens scoped Span curIndex; nint[]? curIndexArray; - if (broadcastedLeft.Rank > 6) + if (broadcastedLeft.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(broadcastedRight.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, broadcastedRight.Rank); } else { @@ -1510,10 +1530,11 @@ public static bool GreaterThanAll(in ReadOnlyTensorSpan x, T y) scoped Span curIndex; nint[]? curIndexArray; - if (x.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { @@ -1548,10 +1569,11 @@ public static bool GreaterThanAll(T x, in ReadOnlyTensorSpan y) scoped Span curIndex; nint[]? curIndexArray; - if (y.Rank > 6) + if (y.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(y.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, y.Rank); } else { @@ -1593,10 +1615,11 @@ public static bool GreaterThanOrEqualAll(in ReadOnlyTensorSpan x, in ReadO scoped Span curIndex; nint[]? curIndexArray; - if (broadcastedLeft.Rank > 6) + if (broadcastedLeft.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(broadcastedRight.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, broadcastedRight.Rank); } else { @@ -1618,35 +1641,36 @@ public static bool GreaterThanOrEqualAll(in ReadOnlyTensorSpan x, in ReadO } /// - /// Compares the elements of two to see if all elements of are greater than . + /// Compares the elements of two to see if all elements of are greater than . /// If the shapes are not the same, the tensors are broadcasted to the smallest broadcastable size before they are compared. - /// It returns a where the value is true if all elements in are greater than . + /// It returns a where the value is true if all elements in are greater than . /// - /// First to compare. + /// First to compare. /// Second to compare against. - /// where the value is true if all elements in are greater than . - public static bool GreaterThanOrEqualAll(in ReadOnlyTensorSpan s, T y) + /// where the value is true if all elements in are greater than . + public static bool GreaterThanOrEqualAll(in ReadOnlyTensorSpan x, T y) where T : IComparisonOperators { scoped Span curIndex; nint[]? curIndexArray; - if (s.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { - curIndexArray = ArrayPool.Shared.Rent(s.Rank); + curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { curIndexArray = null; - curIndex = stackalloc nint[s.Rank]; + curIndex = stackalloc nint[x.Rank]; } - for (int i = 0; i < s.FlattenedLength; i++) + for (int i = 0; i < x.FlattenedLength; i++) { - if (s[curIndex] < y) + if (x[curIndex] < y) return false; - TensorSpanHelpers.AdjustIndexes(s.Rank - 1, 1, curIndex, s.Lengths); + TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.Lengths); } if (curIndexArray != null) @@ -1669,10 +1693,11 @@ public static bool GreaterThanOrEqualAll(T x, in ReadOnlyTensorSpan y) scoped Span curIndex; nint[]? curIndexArray; - if (y.Rank > 6) + if (y.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(y.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, y.Rank); } else { @@ -1758,10 +1783,11 @@ public static ref readonly TensorSpan LessThan(scoped in ReadOnlyTensor scoped Span curIndex; nint[]? curIndexArray; - if (right.Rank > 6) + if (right.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(right.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, right.Rank); } else { @@ -1817,10 +1843,11 @@ public static ref readonly TensorSpan LessThan(scoped in ReadOnlyTensor scoped Span curIndex; nint[]? curIndexArray; - if (x.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { @@ -1876,10 +1903,11 @@ public static ref readonly TensorSpan LessThan(T x, scoped in ReadOnlyT scoped Span curIndex; nint[]? curIndexArray; - if (y.Rank > 6) + if (y.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(y.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, y.Rank); } else { @@ -1964,10 +1992,11 @@ public static ref readonly TensorSpan LessThanOrEqual(scoped in ReadOnl scoped Span curIndex; nint[]? curIndexArray; - if (right.Rank > 6) + if (right.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(right.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, right.Rank); } else { @@ -2023,10 +2052,11 @@ public static ref readonly TensorSpan LessThanOrEqual(scoped in ReadOnl scoped Span curIndex; nint[]? curIndexArray; - if (x.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { @@ -2082,10 +2112,11 @@ public static ref readonly TensorSpan LessThanOrEqual(T x, scoped in Re scoped Span curIndex; nint[]? curIndexArray; - if (y.Rank > 6) + if (y.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(y.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, y.Rank); } else { @@ -2126,10 +2157,11 @@ public static bool LessThanAny(in ReadOnlyTensorSpan x, in ReadOnlyTensorS scoped Span curIndex; nint[]? curIndexArray; - if (broadcastedRight.Lengths.Length > 6) + if (broadcastedRight.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(broadcastedRight.Lengths.Length); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, broadcastedRight.Rank); } else { @@ -2151,35 +2183,36 @@ public static bool LessThanAny(in ReadOnlyTensorSpan x, in ReadOnlyTensorS } /// - /// Compares the elements of two to see if any elements of are less than . + /// Compares the elements of two to see if any elements of are less than . /// If the shapes are not the same, the tensors are broadcasted to the smallest broadcastable size before they are compared. - /// It returns a where the value is true if any elements in are less than . + /// It returns a where the value is true if any elements in are less than . /// - /// First to compare. - /// Second value to compare against. - /// where the value is true if any elements in are less than . - public static bool LessThanAny(in ReadOnlyTensorSpan f, T x) + /// First to compare. + /// Second value to compare against. + /// where the value is true if any elements in are less than . + public static bool LessThanAny(in ReadOnlyTensorSpan x, T y) where T : IComparisonOperators { scoped Span curIndex; nint[]? curIndexArray; - if (f.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { - curIndexArray = ArrayPool.Shared.Rent(f.Rank); + curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { curIndexArray = null; - curIndex = stackalloc nint[f.Rank]; + curIndex = stackalloc nint[x.Rank]; } - for (int i = 0; i < f.FlattenedLength; i++) + for (int i = 0; i < x.FlattenedLength; i++) { - if (f[curIndex] < x) + if (x[curIndex] < y) return true; - TensorSpanHelpers.AdjustIndexes(f.Rank - 1, 1, curIndex, f.Lengths); + TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.Lengths); } if (curIndexArray != null) @@ -2202,10 +2235,11 @@ public static bool LessThanAny(T x, in ReadOnlyTensorSpan y) scoped Span curIndex; nint[]? curIndexArray; - if (y.Rank > 6) + if (y.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(y.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, y.Rank); } else { @@ -2247,10 +2281,11 @@ public static bool LessThanOrEqualAny(in ReadOnlyTensorSpan x, in ReadOnly scoped Span curIndex; nint[]? curIndexArray; - if (broadcastedRight.Lengths.Length > 6) + if (broadcastedRight.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(broadcastedRight.Lengths.Length); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, broadcastedRight.Rank); } else { @@ -2272,35 +2307,36 @@ public static bool LessThanOrEqualAny(in ReadOnlyTensorSpan x, in ReadOnly } /// - /// Compares the elements of two to see if any elements of are less than . + /// Compares the elements of two to see if any elements of are less than . /// If the shapes are not the same, the tensors are broadcasted to the smallest broadcastable size before they are compared. - /// It returns a where the value is true if any elements in are less than . + /// It returns a where the value is true if any elements in are less than . /// - /// First to compare. - /// Second value to compare against. - /// where the value is true if any elements in are less than . - public static bool LessThanOrEqualAny(in ReadOnlyTensorSpan f, T x) + /// First to compare. + /// Second value to compare against. + /// where the value is true if any elements in are less than . + public static bool LessThanOrEqualAny(in ReadOnlyTensorSpan x, T y) where T : IComparisonOperators { scoped Span curIndex; nint[]? curIndexArray; - if (f.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { - curIndexArray = ArrayPool.Shared.Rent(f.Rank); + curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { curIndexArray = null; - curIndex = stackalloc nint[f.Rank]; + curIndex = stackalloc nint[x.Rank]; } - for (int i = 0; i < f.FlattenedLength; i++) + for (int i = 0; i < x.FlattenedLength; i++) { - if (f[curIndex] <= x) + if (x[curIndex] <= y) return true; - TensorSpanHelpers.AdjustIndexes(f.Rank - 1, 1, curIndex, f.Lengths); + TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.Lengths); } if (curIndexArray != null) @@ -2323,10 +2359,11 @@ public static bool LessThanOrEqualAny(T x, in ReadOnlyTensorSpan y) scoped Span curIndex; nint[]? curIndexArray; - if (y.Rank > 6) + if (y.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(y.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, y.Rank); } else { @@ -2367,10 +2404,11 @@ public static bool LessThanAll(in ReadOnlyTensorSpan x, in ReadOnlyTensorS scoped Span curIndex; nint[]? curIndexArray; - if (broadcastedRight.Lengths.Length > 6) + if (broadcastedRight.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(broadcastedRight.Lengths.Length); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, broadcastedRight.Rank); } else { @@ -2392,35 +2430,36 @@ public static bool LessThanAll(in ReadOnlyTensorSpan x, in ReadOnlyTensorS } /// - /// Compares the elements of two to see if all elements of are less than . + /// Compares the elements of two to see if all elements of are less than . /// If the shapes are not the same, the tensors are broadcasted to the smallest broadcastable size before they are compared. - /// It returns a where the value is true if all elements in are less than . + /// It returns a where the value is true if all elements in are less than . /// - /// First to compare. - /// Second value to compare against. - /// where the value is true if all elements in are less than . - public static bool LessThanAll(in ReadOnlyTensorSpan f, T x) + /// First to compare. + /// Second value to compare against. + /// where the value is true if all elements in are less than . + public static bool LessThanAll(in ReadOnlyTensorSpan x, T y) where T : IComparisonOperators { scoped Span curIndex; nint[]? curIndexArray; - if (f.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { - curIndexArray = ArrayPool.Shared.Rent(f.Rank); + curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { curIndexArray = null; - curIndex = stackalloc nint[f.Rank]; + curIndex = stackalloc nint[x.Rank]; } - for (int i = 0; i < f.FlattenedLength; i++) + for (int i = 0; i < x.FlattenedLength; i++) { - if (f[curIndex] >= x) + if (x[curIndex] >= y) return false; - TensorSpanHelpers.AdjustIndexes(f.Rank - 1, 1, curIndex, f.Lengths); + TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.Lengths); } if (curIndexArray != null) @@ -2443,10 +2482,11 @@ public static bool LessThanAll(T x, in ReadOnlyTensorSpan y) scoped Span curIndex; nint[]? curIndexArray; - if (y.Rank > 6) + if (y.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(y.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, y.Rank); } else { @@ -2487,10 +2527,11 @@ public static bool LessThanOrEqualAll(in ReadOnlyTensorSpan x, in ReadOnly scoped Span curIndex; nint[]? curIndexArray; - if (broadcastedRight.Lengths.Length > 6) + if (broadcastedRight.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(broadcastedRight.Lengths.Length); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, broadcastedRight.Rank); } else { @@ -2512,35 +2553,36 @@ public static bool LessThanOrEqualAll(in ReadOnlyTensorSpan x, in ReadOnly } /// - /// Compares the elements of two to see if all elements of are less than . + /// Compares the elements of two to see if all elements of are less than . /// If the shapes are not the same, the tensors are broadcasted to the smallest broadcastable size before they are compared. - /// It returns a where the value is true if all elements in are less than . + /// It returns a where the value is true if all elements in are less than . /// - /// First to compare. - /// Second value to compare against. - /// where the value is true if all elements in are less than . - public static bool LessThanOrEqualAll(in ReadOnlyTensorSpan f, T x) + /// First to compare. + /// Second value to compare against. + /// where the value is true if all elements in are less than . + public static bool LessThanOrEqualAll(in ReadOnlyTensorSpan x, T y) where T : IComparisonOperators { scoped Span curIndex; nint[]? curIndexArray; - if (f.Rank > 6) + if (x.Rank > TensorShape.MaxInlineRank) { - curIndexArray = ArrayPool.Shared.Rent(f.Rank); + curIndexArray = ArrayPool.Shared.Rent(x.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, x.Rank); } else { curIndexArray = null; - curIndex = stackalloc nint[f.Rank]; + curIndex = stackalloc nint[x.Rank]; } - for (int i = 0; i < f.FlattenedLength; i++) + for (int i = 0; i < x.FlattenedLength; i++) { - if (f[curIndex] > x) + if (x[curIndex] > y) return false; - TensorSpanHelpers.AdjustIndexes(f.Rank - 1, 1, curIndex, f.Lengths); + TensorSpanHelpers.AdjustIndexes(x.Rank - 1, 1, curIndex, x.Lengths); } if (curIndexArray != null) @@ -2563,10 +2605,11 @@ public static bool LessThanOrEqualAll(T x, in ReadOnlyTensorSpan y) scoped Span curIndex; nint[]? curIndexArray; - if (y.Rank > 6) + if (y.Rank > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(y.Rank); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, y.Rank); } else { @@ -4234,7 +4277,7 @@ public static ref readonly TensorSpan ConvertChecked(scoped in where TFrom : IEquatable, IEqualityOperators, INumberBase where TTo : INumberBase { - return ref TensorPrimitivesHelperTFromSpanInTToSpanOut(source, destination, TensorPrimitives.ConvertChecked); + return ref TensorPrimitivesHelperSpanInSpanOut(source, destination, TensorPrimitives.ConvertChecked); } #endregion @@ -4264,7 +4307,7 @@ public static ref readonly TensorSpan ConvertSaturating(scoped where TFrom : IEquatable, IEqualityOperators, INumberBase where TTo : INumberBase { - return ref TensorPrimitivesHelperTFromSpanInTToSpanOut(source, destination, TensorPrimitives.ConvertSaturating); + return ref TensorPrimitivesHelperSpanInSpanOut(source, destination, TensorPrimitives.ConvertSaturating); } #endregion @@ -4294,7 +4337,7 @@ public static ref readonly TensorSpan ConvertTruncating(scoped where TFrom : IEquatable, IEqualityOperators, INumberBase where TTo : INumberBase { - return ref TensorPrimitivesHelperTFromSpanInTToSpanOut(source, destination, TensorPrimitives.ConvertTruncating); + return ref TensorPrimitivesHelperSpanInSpanOut(source, destination, TensorPrimitives.ConvertTruncating); } #endregion @@ -4964,7 +5007,7 @@ public static Tensor ILogB(in ReadOnlyTensorSpan x) public static ref readonly TensorSpan ILogB(scoped in ReadOnlyTensorSpan x, in TensorSpan destination) where T : IFloatingPointIeee754 { - return ref TensorPrimitivesHelperSpanInIntSpanOut(x, destination, TensorPrimitives.ILogB); + return ref TensorPrimitivesHelperSpanInSpanOut(x, destination, TensorPrimitives.ILogB); } #endregion @@ -5824,8 +5867,7 @@ public static ref readonly TensorSpan Negate(scoped in ReadOnlyTensorSpan< public static T Norm(scoped in ReadOnlyTensorSpan x) where T : IRootFunctions { - ReadOnlySpan span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); - return TensorPrimitives.Norm(span); + return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.Norm); } #endregion @@ -6423,8 +6465,7 @@ public static ref readonly TensorSpan Subtract(scoped in ReadOnlyTensorSpa public static T Sum(scoped in ReadOnlyTensorSpan x) where T : IAdditionOperators, IAdditiveIdentity { - ReadOnlySpan span = MemoryMarshal.CreateSpan(ref x._reference, (int)x._shape._memoryLength); - return TensorPrimitives.Sum(span); + return TensorPrimitivesHelperSpanInTOut(x, TensorPrimitives.Sum); } #endregion @@ -6616,7 +6657,7 @@ public static nint[] GetSmallestBroadcastableLengths(ReadOnlySpan shape1, } #region TensorPrimitivesHelpers - private delegate void PerformCalculationSpanInSpanOut(ReadOnlySpan input, Span output); + private delegate void PerformCalculationSpanInSpanOut(ReadOnlySpan input, Span output); private delegate void PerformCalculationSpanInTInSpanOut(ReadOnlySpan input, T value, Span output); @@ -6624,37 +6665,36 @@ public static nint[] GetSmallestBroadcastableLengths(ReadOnlySpan shape1, private delegate void PerformCalculationTwoSpanInSpanOut(ReadOnlySpan input, ReadOnlySpan inputTwo, Span output); - private delegate void PerformCalculationTFromSpanInTToSpanOut(ReadOnlySpan input, Span output) - where TFrom : INumberBase - where TTo : INumberBase; - private delegate T PerformCalculationTwoSpanInTOut(ReadOnlySpan input, ReadOnlySpan inputTwo); - private delegate void PerformCalculationSpanInIntSpanOut(ReadOnlySpan input, Span output); - private delegate T PerformCalculationSpanInTOut(ReadOnlySpan input); private static T TensorPrimitivesHelperSpanInTOut(scoped in ReadOnlyTensorSpan input, PerformCalculationSpanInTOut performCalculation) { - ReadOnlySpan span = MemoryMarshal.CreateSpan(ref input._reference, (int)input._shape._memoryLength); - return performCalculation(span); - } - - private static ref readonly TensorSpan TensorPrimitivesHelperSpanInIntSpanOut(scoped in ReadOnlyTensorSpan input, in TensorSpan destination, PerformCalculationSpanInIntSpanOut performCalculation) - { - ReadOnlySpan span = MemoryMarshal.CreateSpan(ref input._reference, (int)input._shape._memoryLength); - Span data = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); - performCalculation(span, data); - return ref destination; + if (TensorHelpers.IsContiguousAndDense(input)) + { + ReadOnlySpan span = MemoryMarshal.CreateSpan(ref input._reference, (int)input._shape.FlattenedLength); + return performCalculation(span); + } + // Flattening needs to happen + else + { + // TODO: Can optimize this to not need to realize the broadcasts + // That will need to be done on a per method basis. + nint flattenedLength = input.FlattenedLength; + T[] flattened = new T[flattenedLength]; + input.FlattenTo(flattened); + return performCalculation(flattened); + } } private static T TensorPrimitivesHelperTwoSpanInTOut(scoped in ReadOnlyTensorSpan left, scoped in ReadOnlyTensorSpan right, PerformCalculationTwoSpanInTOut performCalculation) { // If sizes are the same. - if (TensorHelpers.AreLengthsTheSame(left, right) && TensorHelpers.IsUnderlyingStorageSameSize(left, right)) + if (TensorHelpers.IsContiguousAndDense(left) && TensorHelpers.IsContiguousAndDense(right) && TensorHelpers.AreLengthsTheSame(left, right)) { - ReadOnlySpan span = MemoryMarshal.CreateSpan(ref left._reference, (int)left._shape._memoryLength); - ReadOnlySpan rspan = MemoryMarshal.CreateSpan(ref right._reference, (int)right._shape._memoryLength); + ReadOnlySpan span = MemoryMarshal.CreateSpan(ref left._reference, (int)left._shape.FlattenedLength); + ReadOnlySpan rspan = MemoryMarshal.CreateSpan(ref right._reference, (int)right._shape.FlattenedLength); return performCalculation(span, rspan); } // Broadcasting needs to happen. @@ -6665,6 +6705,8 @@ private static T TensorPrimitivesHelperTwoSpanInTOut(scoped in ReadOnlyTensor // 2 - One tensor has row contiguous memory and the right has column contiguous memory (i.e. a 1x5 and a 5x1) // Because we are returning a single T though we need to actual realize the broadcasts at this point to perform the calculations. + // TODO: Can optimize this to not need to realize the broadcasts + // That will need to be done on a per method basis. nint[] newLengths = Tensor.GetSmallestBroadcastableLengths(left.Lengths, right.Lengths); nint newLength = TensorSpanHelpers.CalculateTotalLength(newLengths); TensorSpan broadcastedLeft = new TensorSpan(new T[newLength], newLengths, ReadOnlySpan.Empty); @@ -6678,59 +6720,177 @@ private static T TensorPrimitivesHelperTwoSpanInTOut(scoped in ReadOnlyTensor } } - private static ref readonly TensorSpan TensorPrimitivesHelperSpanInSpanOut(scoped in ReadOnlyTensorSpan input, in TensorSpan destination, PerformCalculationSpanInSpanOut performCalculation) + private static ref readonly TensorSpan TensorPrimitivesHelperSpanInSpanOut(scoped in ReadOnlyTensorSpan input, in TensorSpan destination, PerformCalculationSpanInSpanOut performCalculation) { - if (destination._shape._memoryLength < input._shape._memoryLength) + // Make sure destination has enough memory + if (destination._shape._memoryLength < input._shape.FlattenedLength) ThrowHelper.ThrowArgumentException_DestinationTooShort(); - ReadOnlySpan span = MemoryMarshal.CreateSpan(ref input._reference, (int)input._shape._memoryLength); - Span ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); - performCalculation(span, ospan); + // Make sure destination shape works with input shape + TensorSpan slicedDestination = destination.Slice(input._shape.Lengths); + + Span destinationSpan; + ReadOnlySpan inputSpan; + + // Memory is contiguous for both input and destination + if (TensorHelpers.IsContiguousAndDense(input) && TensorHelpers.IsContiguousAndDense(slicedDestination)) + { + inputSpan = MemoryMarshal.CreateSpan(ref input._reference, (int)input._shape.FlattenedLength); + destinationSpan = MemoryMarshal.CreateSpan(ref slicedDestination._reference, (int)slicedDestination._shape.FlattenedLength); + performCalculation(inputSpan, destinationSpan); + } + else + { + scoped Span curIndex; + nint[]? curIndexArray; + if (input.Lengths.Length > TensorShape.MaxInlineRank) + { + curIndexArray = ArrayPool.Shared.Rent(input.Lengths.Length); + curIndex = curIndexArray; + curIndex = curIndex.Slice(0, input.Rank); + } + else + { + curIndexArray = null; + curIndex = stackalloc nint[input.Lengths.Length]; + } + + int copiedValues = 0; + nint rowLength = input.Lengths[^1]; + + while (copiedValues < slicedDestination.FlattenedLength) + { + inputSpan = MemoryMarshal.CreateReadOnlySpan(in input[curIndex], (int)rowLength); + destinationSpan = MemoryMarshal.CreateSpan(ref slicedDestination[curIndex], (int)rowLength); + performCalculation(inputSpan, destinationSpan); + copiedValues += (int)rowLength; + TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.Lengths); + } + + if (curIndexArray != null) + ArrayPool.Shared.Return(curIndexArray); + } + return ref destination; } private static ref readonly TensorSpan TensorPrimitivesHelperSpanInTInSpanOut(scoped in ReadOnlyTensorSpan input, T value, in TensorSpan destination, PerformCalculationSpanInTInSpanOut performCalculation) { - if (destination._shape._memoryLength < input._shape._memoryLength) + if (destination._shape._memoryLength < input._shape.FlattenedLength) ThrowHelper.ThrowArgumentException_DestinationTooShort(); - ReadOnlySpan span = MemoryMarshal.CreateSpan(ref input._reference, (int)input._shape._memoryLength); - Span ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); - performCalculation(span, value, ospan); + // Make sure destination shape works with input shape + TensorSpan slicedDestination = destination.Slice(input._shape.Lengths); + + ReadOnlySpan inputSpan; + Span destinationSpan; + + if (TensorHelpers.IsContiguousAndDense(input) && TensorHelpers.IsContiguousAndDense(slicedDestination)) + { + inputSpan = MemoryMarshal.CreateSpan(ref input._reference, (int)input.FlattenedLength); + destinationSpan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination.FlattenedLength); + performCalculation(inputSpan, value, destinationSpan); + } + else + { + scoped Span curIndex; + nint[]? curIndexArray; + if (input.Lengths.Length > TensorShape.MaxInlineRank) + { + curIndexArray = ArrayPool.Shared.Rent(input.Lengths.Length); + curIndex = curIndexArray; + curIndex = curIndex.Slice(0, input.Rank); + } + else + { + curIndexArray = null; + curIndex = stackalloc nint[input.Lengths.Length]; + } + + int copiedValues = 0; + nint rowLength = input.Lengths[^1]; + + while (copiedValues < slicedDestination.FlattenedLength) + { + inputSpan = MemoryMarshal.CreateReadOnlySpan(in input[curIndex], (int)rowLength); + destinationSpan = MemoryMarshal.CreateSpan(ref slicedDestination[curIndex], (int)rowLength); + performCalculation(inputSpan, value, destinationSpan); + copiedValues += (int)rowLength; + TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.Lengths); + } + + if (curIndexArray != null) + ArrayPool.Shared.Return(curIndexArray); + } + return ref destination; } private static ref readonly TensorSpan TensorPrimitivesHelperTInSpanInSpanOut(T value, scoped in ReadOnlyTensorSpan input, in TensorSpan destination, PerformCalculationTInSpanInSpanOut performCalculation) { - if (destination._shape._memoryLength < input._shape._memoryLength) + if (destination._shape._memoryLength < input._shape.FlattenedLength) ThrowHelper.ThrowArgumentException_DestinationTooShort(); - ReadOnlySpan span = MemoryMarshal.CreateSpan(ref input._reference, (int)input._shape._memoryLength); - Span ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); - performCalculation(value, span, ospan); - return ref destination; - } + // Make sure destination shape works with input shape + TensorSpan slicedDestination = destination.Slice(input._shape.Lengths); + + ReadOnlySpan inputSpan; + Span destinationSpan; + + if (TensorHelpers.IsContiguousAndDense(input) && TensorHelpers.IsContiguousAndDense(slicedDestination)) + { + inputSpan = MemoryMarshal.CreateSpan(ref input._reference, (int)input._shape._memoryLength); + destinationSpan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); + performCalculation(value, inputSpan, destinationSpan); + } + else + { + scoped Span curIndex; + nint[]? curIndexArray; + if (input.Lengths.Length > TensorShape.MaxInlineRank) + { + curIndexArray = ArrayPool.Shared.Rent(input.Lengths.Length); + curIndex = curIndexArray; + curIndex = curIndex.Slice(0, input.Rank); + } + else + { + curIndexArray = null; + curIndex = stackalloc nint[input.Lengths.Length]; + } + + int copiedValues = 0; + nint rowLength = input.Lengths[^1]; + + while (copiedValues < slicedDestination.FlattenedLength) + { + inputSpan = MemoryMarshal.CreateReadOnlySpan(in input[curIndex], (int)rowLength); + destinationSpan = MemoryMarshal.CreateSpan(ref slicedDestination[curIndex], (int)rowLength); + performCalculation(value, inputSpan, destinationSpan); + copiedValues += (int)rowLength; + TensorSpanHelpers.AdjustIndexes(input.Rank - 2, 1, curIndex, input.Lengths); + } + + if (curIndexArray != null) + ArrayPool.Shared.Return(curIndexArray); + } - private static ref readonly TensorSpan TensorPrimitivesHelperTFromSpanInTToSpanOut(scoped in ReadOnlyTensorSpan input, in TensorSpan destination, PerformCalculationTFromSpanInTToSpanOut performCalculation) - where TFrom : IEquatable, IEqualityOperators, INumberBase - where TTo : INumberBase - { - ReadOnlySpan span = MemoryMarshal.CreateSpan(ref input._reference, (int)input._shape._memoryLength); - Span ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); - performCalculation(span, ospan); return ref destination; } private static ref readonly TensorSpan TensorPrimitivesHelperTwoSpanInSpanOut(scoped in ReadOnlyTensorSpan left, scoped in ReadOnlyTensorSpan right, in TensorSpan destination, PerformCalculationTwoSpanInSpanOut performCalculation) { - // If sizes are the same. - if (TensorHelpers.AreLengthsTheSame(left, right) && TensorHelpers.IsUnderlyingStorageSameSize(left, right)) + nint[] newSize = Tensor.GetSmallestBroadcastableLengths(left.Lengths, right.Lengths); + + TensorSpan slicedDestination = destination.Slice(newSize); + + // If sizes are the same and memory is contiguous for all tensors + if (TensorHelpers.AreLengthsTheSame(left, right) && TensorHelpers.IsUnderlyingStorageSameSize(left, right) && TensorHelpers.IsContiguousAndDense(left) + && TensorHelpers.IsContiguousAndDense(right) && TensorHelpers.IsContiguousAndDense(slicedDestination)) { - if (!TensorHelpers.IsUnderlyingStorageSameSize(left, destination)) - ThrowHelper.ThrowArgument_DestinationTooShort(); - ReadOnlySpan span = MemoryMarshal.CreateSpan(ref left._reference, (int)left._shape._memoryLength); - ReadOnlySpan rspan = MemoryMarshal.CreateSpan(ref right._reference, (int)right._shape._memoryLength); - Span ospan = MemoryMarshal.CreateSpan(ref destination._reference, (int)destination._shape._memoryLength); + ReadOnlySpan span = MemoryMarshal.CreateSpan(ref left._reference, left._shape._memoryLength <= left.FlattenedLength ? (int)left._shape._memoryLength : (int)left.FlattenedLength); + ReadOnlySpan rspan = MemoryMarshal.CreateSpan(ref right._reference, right._shape._memoryLength <= right.FlattenedLength ? (int)right._shape._memoryLength : (int)right.FlattenedLength); + Span ospan = MemoryMarshal.CreateSpan(ref slicedDestination._reference, (int)slicedDestination._shape._memoryLength); performCalculation(span, rspan, ospan); return ref destination; } @@ -6741,12 +6901,8 @@ private static ref readonly TensorSpan TensorPrimitivesHelperTwoSpanInSpanOut // 1 - Both tensors have row contiguous memory (i.e. a 1x5 being broadcast to a 5x5) // 2 - One tensor has row contiguous memory and the right has column contiguous memory (i.e. a 1x5 and a 5x1) - nint[] newSize = Tensor.GetSmallestBroadcastableLengths(left.Lengths, right.Lengths); - ReadOnlyTensorSpan broadcastedLeft = Tensor.LazyBroadcast(left, newSize); ReadOnlyTensorSpan broadcastedRight = Tensor.LazyBroadcast(right, newSize); - if (!destination.Lengths.SequenceEqual(newSize) || destination._shape._memoryLength < broadcastedLeft.FlattenedLength) - ThrowHelper.ThrowArgument_LengthsNotBroadcastCompatible(); nint rowLength = newSize[^1]; Span ospan; @@ -6755,10 +6911,11 @@ private static ref readonly TensorSpan TensorPrimitivesHelperTwoSpanInSpanOut scoped Span curIndex; nint[]? curIndexArray; - if (newSize.Length > 6) + if (newSize.Length > TensorShape.MaxInlineRank) { curIndexArray = ArrayPool.Shared.Rent(newSize.Length); curIndex = curIndexArray; + curIndex = curIndex.Slice(0, newSize.Length); } else { @@ -6767,13 +6924,27 @@ private static ref readonly TensorSpan TensorPrimitivesHelperTwoSpanInSpanOut } int outputOffset = 0; - // ADD IN CASE WHERE NEITHER ARE ROW CONTIGUOUS + // neither row contiguous + if (broadcastedLeft.Strides[^1] == 0 && broadcastedRight.Strides[^1] == 0) + { + Span buffer2 = new T[rowLength]; + + while (outputOffset < slicedDestination.FlattenedLength) + { + ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref slicedDestination._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, slicedDestination.Strides, slicedDestination.Lengths)), (int)rowLength); + buffer.Fill(broadcastedLeft[curIndex]); + buffer2.Fill(broadcastedRight[curIndex]); + performCalculation(buffer, buffer2, ospan); + outputOffset += (int)rowLength; + TensorSpanHelpers.AdjustIndexes(broadcastedLeft.Rank - 2, 1, curIndex, broadcastedLeft.Lengths); + } + } // tensor not row contiguous - if (broadcastedLeft.Strides[^1] == 0) + else if (broadcastedLeft.Strides[^1] == 0) { - while (outputOffset < destination.FlattenedLength) + while (outputOffset < slicedDestination.FlattenedLength) { - ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref destination._reference, outputOffset), (int)rowLength); + ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref slicedDestination._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, slicedDestination.Strides, slicedDestination.Lengths)), (int)rowLength); buffer.Fill(broadcastedLeft[curIndex]); ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedRight._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedRight.Strides, broadcastedRight.Lengths)), (int)rowLength); performCalculation(buffer, ispan, ospan); @@ -6784,9 +6955,9 @@ private static ref readonly TensorSpan TensorPrimitivesHelperTwoSpanInSpanOut // right not row contiguous else if (broadcastedRight.Strides[^1] == 0) { - while (outputOffset < destination.FlattenedLength) + while (outputOffset < slicedDestination.FlattenedLength) { - ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref destination._reference, outputOffset), (int)rowLength); + ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref slicedDestination._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, slicedDestination.Strides, slicedDestination.Lengths)), (int)rowLength); buffer.Fill(broadcastedRight[curIndex]); ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedLeft._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedLeft.Strides, broadcastedLeft.Lengths)), (int)rowLength); performCalculation(ispan, buffer, ospan); @@ -6798,9 +6969,9 @@ private static ref readonly TensorSpan TensorPrimitivesHelperTwoSpanInSpanOut else { Span rspan; - while (outputOffset < destination.FlattenedLength) + while (outputOffset < slicedDestination.FlattenedLength) { - ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref destination._reference, outputOffset), (int)rowLength); + ospan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref slicedDestination._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, slicedDestination.Strides, slicedDestination.Lengths)), (int)rowLength); ispan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedLeft._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedLeft.Strides, broadcastedLeft.Lengths)), (int)rowLength); rspan = MemoryMarshal.CreateSpan(ref Unsafe.Add(ref broadcastedRight._reference, TensorSpanHelpers.ComputeLinearIndex(curIndex, broadcastedRight.Strides, broadcastedRight.Lengths)), (int)rowLength); performCalculation(ispan, rspan, ospan); diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorHelpers.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorHelpers.cs index 163075ce5c13dc..c169c082af48ae 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorHelpers.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorHelpers.cs @@ -97,6 +97,21 @@ internal static bool AreLengthsTheSame(scoped in ReadOnlyTensorSpan tensor internal static bool AreLengthsTheSame(ReadOnlySpan lengths1, ReadOnlySpan lengths2) => lengths1.SequenceEqual(lengths2); + internal static bool IsContiguousAndDense(scoped in ReadOnlyTensorSpan tensor) + { + // Right most dimension must be 1 for a dense tensor. + if (tensor._shape.Strides[^1] != 1) + return false; + + // For other dimensions, the stride must be equal to the product of the dimensions to the right. + for (int i = tensor._shape._rank - 2; i >= 0; i--) + { + if (tensor._shape.Strides[i] != TensorPrimitives.Product(tensor.Lengths.Slice(i + 1, tensor.Lengths.Length - i - 1))) + return false; + } + return true; + } + internal static void PermuteIndices(Span indices, Span permutedIndices, ReadOnlySpan permutation) { for (int i = 0; i < indices.Length; i++) diff --git a/src/libraries/System.Numerics.Tensors/tests/Helpers.cs b/src/libraries/System.Numerics.Tensors/tests/Helpers.cs index d55745614646fe..4ea2988e6f47af 100644 --- a/src/libraries/System.Numerics.Tensors/tests/Helpers.cs +++ b/src/libraries/System.Numerics.Tensors/tests/Helpers.cs @@ -14,7 +14,9 @@ public static class Helpers public static IEnumerable TensorLengthsIncluding0 => Enumerable.Range(0, 257); public static IEnumerable TensorLengths => Enumerable.Range(1, 256); - public static IEnumerable TensorShapes => [[1], [2], [10], [1,1], [1,2], [2,2], [5, 5], [2, 2, 2], [5, 5, 5], [3, 3, 3, 3], [4, 4, 4, 4, 4], [1, 2, 3, 4, 5, 6, 7]]; + public static IEnumerable TensorShapes => [[1], [2], [10], [1, 1], [1, 2], [2, 2], [5, 5], [2, 2, 2], [5, 5, 5], [3, 3, 3, 3], [4, 4, 4, 4, 4], [1, 2, 3, 4, 5, 6, 7, 1, 2]]; + public static nint[][] TensorSliceShapes => [[1], [1], [5], [1, 1], [1, 1], [1, 2], [3, 3], [2, 2, 1], [5, 3, 5], [3, 2, 1, 3], [4, 3, 2, 1, 2], [1, 2, 2, 2, 2, 1, 1, 1, 1]]; + public static nint[][] TensorSliceShapesForBroadcast => [[1], [1], [1], [1, 1], [1, 1], [1, 2], [1, 1], [2, 2, 1], [1, 5, 5], [3, 1, 1, 3], [4, 1, 4, 1, 4], [1, 2, 1, 4, 1, 1, 7, 1, 1]]; // Tolerances taken from testing in the scalar math routines: // cf. https://github.com/dotnet/runtime/blob/89f7ad3b276fb0b48f20cb4e8408bdce85c2b415/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Math.cs diff --git a/src/libraries/System.Numerics.Tensors/tests/TensorSpanTests.cs b/src/libraries/System.Numerics.Tensors/tests/TensorSpanTests.cs index e43a7d55e7dfae..f03f682f94f704 100644 --- a/src/libraries/System.Numerics.Tensors/tests/TensorSpanTests.cs +++ b/src/libraries/System.Numerics.Tensors/tests/TensorSpanTests.cs @@ -4,6 +4,7 @@ using System.Buffers; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Runtime.InteropServices; using Xunit; @@ -34,93 +35,179 @@ private static nint CalculateTotalLength(ReadOnlySpan lengths) return totalLength; } - public delegate void TensorPrimitivesSpanInSpanOut(ReadOnlySpan input, Span output); - public delegate ref readonly TensorSpan TensorSpanInSpanOut(scoped in ReadOnlyTensorSpan input, in TensorSpan destination); - public delegate ref readonly TensorSpan TensorSpanInSpanOutInPlace(in TensorSpan input); + public delegate void TensorPrimitivesSpanInSpanOut(ReadOnlySpan input, Span output); + public delegate ref readonly TensorSpan TensorSpanInSpanOut(scoped in ReadOnlyTensorSpan input, in TensorSpan destination); public static IEnumerable SpanInSpanOutData() { - yield return Create(TensorPrimitives.Abs, Tensor.Abs); - yield return Create(TensorPrimitives.Acos, Tensor.Acos); - yield return Create(TensorPrimitives.Acosh, Tensor.Acosh); - yield return Create(TensorPrimitives.AcosPi, Tensor.AcosPi); - yield return Create(TensorPrimitives.Asin, Tensor.Asin); - yield return Create(TensorPrimitives.Asinh, Tensor.Asinh); - yield return Create(TensorPrimitives.AsinPi, Tensor.AsinPi); - yield return Create(TensorPrimitives.Atan, Tensor.Atan); - yield return Create(TensorPrimitives.Atanh, Tensor.Atanh); - yield return Create(TensorPrimitives.AtanPi, Tensor.AtanPi); - yield return Create(TensorPrimitives.Cbrt, Tensor.Cbrt); - yield return Create(TensorPrimitives.Ceiling, Tensor.Ceiling); - yield return Create(TensorPrimitives.Cos, Tensor.Cos); - yield return Create(TensorPrimitives.Cosh, Tensor.Cosh); - yield return Create(TensorPrimitives.CosPi, Tensor.CosPi); - yield return Create(TensorPrimitives.DegreesToRadians, Tensor.DegreesToRadians); - yield return Create(TensorPrimitives.Exp, Tensor.Exp); - yield return Create(TensorPrimitives.Exp10, Tensor.Exp10); - yield return Create(TensorPrimitives.Exp10M1, Tensor.Exp10M1); - yield return Create(TensorPrimitives.Exp2, Tensor.Exp2); - yield return Create(TensorPrimitives.Exp2M1, Tensor.Exp2M1); - yield return Create(TensorPrimitives.ExpM1, Tensor.ExpM1); - yield return Create(TensorPrimitives.Floor, Tensor.Floor); - yield return Create(TensorPrimitives.LeadingZeroCount, Tensor.LeadingZeroCount); - yield return Create(TensorPrimitives.Log, Tensor.Log); - yield return Create(TensorPrimitives.Log10, Tensor.Log10); - yield return Create(TensorPrimitives.Log10P1, Tensor.Log10P1); - yield return Create(TensorPrimitives.Log2, Tensor.Log2); - yield return Create(TensorPrimitives.Log2P1, Tensor.Log2P1); - yield return Create(TensorPrimitives.LogP1, Tensor.LogP1); - yield return Create(TensorPrimitives.Negate, Tensor.Negate); - yield return Create(TensorPrimitives.OnesComplement, Tensor.OnesComplement); - yield return Create(TensorPrimitives.PopCount, Tensor.PopCount); - yield return Create(TensorPrimitives.RadiansToDegrees, Tensor.RadiansToDegrees); - yield return Create(TensorPrimitives.Reciprocal, Tensor.Reciprocal); - yield return Create(TensorPrimitives.Round, Tensor.Round); - yield return Create(TensorPrimitives.Sigmoid, Tensor.Sigmoid); - yield return Create(TensorPrimitives.Sin, Tensor.Sin); - yield return Create(TensorPrimitives.Sinh, Tensor.Sinh); - yield return Create(TensorPrimitives.SinPi, Tensor.SinPi); - yield return Create(TensorPrimitives.SoftMax, Tensor.SoftMax); - yield return Create(TensorPrimitives.Sqrt, Tensor.Sqrt); - yield return Create(TensorPrimitives.Tan, Tensor.Tan); - yield return Create(TensorPrimitives.Tanh, Tensor.Tanh); - yield return Create(TensorPrimitives.TanPi, Tensor.TanPi); - yield return Create(TensorPrimitives.Truncate, Tensor.Truncate); - - static object[] Create(TensorPrimitivesSpanInSpanOut tensorPrimitivesMethod, TensorSpanInSpanOut tensorOperation) + yield return Create(TensorPrimitives.Abs, Tensor.Abs); + yield return Create(TensorPrimitives.Acos, Tensor.Acos); + yield return Create(TensorPrimitives.Acosh, Tensor.Acosh); + yield return Create(TensorPrimitives.AcosPi, Tensor.AcosPi); + yield return Create(TensorPrimitives.Asin, Tensor.Asin); + yield return Create(TensorPrimitives.Asinh, Tensor.Asinh); + yield return Create(TensorPrimitives.AsinPi, Tensor.AsinPi); + yield return Create(TensorPrimitives.Atan, Tensor.Atan); + yield return Create(TensorPrimitives.Atanh, Tensor.Atanh); + yield return Create(TensorPrimitives.AtanPi, Tensor.AtanPi); + yield return Create(TensorPrimitives.Cbrt, Tensor.Cbrt); + yield return Create(TensorPrimitives.Ceiling, Tensor.Ceiling); + yield return Create(TensorPrimitives.Cos, Tensor.Cos); + yield return Create(TensorPrimitives.Cosh, Tensor.Cosh); + yield return Create(TensorPrimitives.CosPi, Tensor.CosPi); + yield return Create(TensorPrimitives.DegreesToRadians, Tensor.DegreesToRadians); + yield return Create(TensorPrimitives.Exp, Tensor.Exp); + yield return Create(TensorPrimitives.Exp10, Tensor.Exp10); + yield return Create(TensorPrimitives.Exp10M1, Tensor.Exp10M1); + yield return Create(TensorPrimitives.Exp2, Tensor.Exp2); + yield return Create(TensorPrimitives.Exp2M1, Tensor.Exp2M1); + yield return Create(TensorPrimitives.ExpM1, Tensor.ExpM1); + yield return Create(TensorPrimitives.Floor, Tensor.Floor); + yield return Create(TensorPrimitives.LeadingZeroCount, Tensor.LeadingZeroCount); + yield return Create(TensorPrimitives.Log, Tensor.Log); + yield return Create(TensorPrimitives.Log10, Tensor.Log10); + yield return Create(TensorPrimitives.Log10P1, Tensor.Log10P1); + yield return Create(TensorPrimitives.Log2, Tensor.Log2); + yield return Create(TensorPrimitives.Log2P1, Tensor.Log2P1); + yield return Create(TensorPrimitives.LogP1, Tensor.LogP1); + yield return Create(TensorPrimitives.Negate, Tensor.Negate); + yield return Create(TensorPrimitives.OnesComplement, Tensor.OnesComplement); + yield return Create(TensorPrimitives.PopCount, Tensor.PopCount); + yield return Create(TensorPrimitives.RadiansToDegrees, Tensor.RadiansToDegrees); + yield return Create(TensorPrimitives.Reciprocal, Tensor.Reciprocal); + yield return Create(TensorPrimitives.Round, Tensor.Round); + yield return Create(TensorPrimitives.Sigmoid, Tensor.Sigmoid); + yield return Create(TensorPrimitives.Sin, Tensor.Sin); + yield return Create(TensorPrimitives.Sinh, Tensor.Sinh); + yield return Create(TensorPrimitives.SinPi, Tensor.SinPi); + yield return Create(TensorPrimitives.SoftMax, Tensor.SoftMax); + yield return Create(TensorPrimitives.Sqrt, Tensor.Sqrt); + yield return Create(TensorPrimitives.Tan, Tensor.Tan); + yield return Create(TensorPrimitives.Tanh, Tensor.Tanh); + yield return Create(TensorPrimitives.TanPi, Tensor.TanPi); + yield return Create(TensorPrimitives.Truncate, Tensor.Truncate); + yield return Create(TensorPrimitives.ILogB, Tensor.ILogB); + yield return Create(TensorPrimitives.ConvertChecked, Tensor.ConvertChecked); + yield return Create(TensorPrimitives.ConvertSaturating, Tensor.ConvertSaturating); + yield return Create(TensorPrimitives.ConvertTruncating, Tensor.ConvertTruncating); + + static object[] Create(TensorPrimitivesSpanInSpanOut tensorPrimitivesMethod, TensorSpanInSpanOut tensorOperation) => new object[] { tensorPrimitivesMethod, tensorOperation }; } [Theory, MemberData(nameof(SpanInSpanOutData))] - public void TensorExtensionsSpanInSpanOut(TensorPrimitivesSpanInSpanOut tensorPrimitivesOperation, TensorSpanInSpanOut tensorOperation) - where T : INumberBase + public void TensorExtensionsSpanInSpanOut(TensorPrimitivesSpanInSpanOut tensorPrimitivesOperation, TensorSpanInSpanOut tensorOperation) + where TIn : INumberBase + where TOut: INumber { - Assert.All(Helpers.TensorShapes, tensorLength => + Assert.All(Helpers.TensorShapes, (tensorLength, index) => { nint length = CalculateTotalLength(tensorLength); - T[] data = new T[length]; - T[] data2 = new T[length]; - T[] expectedOutput = new T[length]; - FillTensor(data); - TensorSpan x = Tensor.Create(data, tensorLength, []); - TensorSpan destination = Tensor.Create(data2, tensorLength, []); - tensorPrimitivesOperation((ReadOnlySpan)data, expectedOutput); - TensorSpan results = tensorOperation(x, destination); + TIn[] data = new TIn[length]; + TOut[] data2 = new TOut[length]; + TOut[] expectedOutput = new TOut[length]; + + FillTensor(data); + TensorSpan x = Tensor.Create(data, tensorLength, []); + TensorSpan destination = Tensor.Create(data2, tensorLength, []); + tensorPrimitivesOperation((ReadOnlySpan)data, expectedOutput); + TensorSpan tensorResults = tensorOperation(x, destination); - Assert.Equal(tensorLength, results.Lengths); + Assert.Equal(tensorLength, tensorResults.Lengths); nint[] startingIndex = new nint[tensorLength.Length]; // the "Return" value - ReadOnlySpan span = MemoryMarshal.CreateSpan(ref results[startingIndex], (int)length); + ReadOnlySpan span = MemoryMarshal.CreateSpan(ref tensorResults[startingIndex], (int)length); // the "destination" value - ReadOnlySpan destSpan = MemoryMarshal.CreateSpan(ref destination[startingIndex], (int)length); + ReadOnlySpan destSpan = MemoryMarshal.CreateSpan(ref destination[startingIndex], (int)length); for (int i = 0; i < data.Length; i++) { Assert.Equal(expectedOutput[i], span[i]); Assert.Equal(expectedOutput[i], destSpan[i]); } + + // Now test if the source is sliced to be smaller then the destination that the destination is also sliced + // to the correct size. + NRange[] sliceLengths = Helpers.TensorSliceShapes[index].Select(i => new NRange(0, i)).ToArray(); + nint sliceFlattenedLength = CalculateTotalLength(Helpers.TensorSliceShapes[index]); + x = x.Slice(sliceLengths); + TIn[] sliceData = new TIn[sliceFlattenedLength]; + x.FlattenTo(sliceData); + expectedOutput = new TOut[sliceFlattenedLength]; + + if (TensorHelpers.IsContiguousAndDense(x)) + { + tensorPrimitivesOperation((ReadOnlySpan)sliceData, expectedOutput); + } + else + { + int rowLength = (int)Helpers.TensorSliceShapes[index][^1]; + for (int i = 0; i < sliceData.Length; i+= rowLength) + { + tensorPrimitivesOperation(((ReadOnlySpan)sliceData).Slice(i, rowLength), ((Span)expectedOutput).Slice(i, rowLength)); + } + + } + + tensorResults = tensorOperation(x, destination); + + // tensorResults lengths will still be the original tensorLength and not equal to the sliced length since that happened internally/automatically + Assert.Equal(tensorLength, tensorResults.Lengths); + + TensorSpan.Enumerator destEnum = destination.Slice(sliceLengths).GetEnumerator(); + TensorSpan.Enumerator tensorResultsEnum = tensorResults.Slice(sliceLengths).GetEnumerator(); + bool destEnumMove; + bool tensorResultsEnumMove; + + for (int i = 0; i < expectedOutput.Length; i++) + { + destEnumMove = destEnum.MoveNext(); + tensorResultsEnumMove = tensorResultsEnum.MoveNext(); + + Assert.True(destEnumMove); + Assert.True(tensorResultsEnumMove); + Assert.Equal(expectedOutput[i], destEnum.Current); + Assert.Equal(expectedOutput[i], tensorResultsEnum.Current); + } + + // Now test if the source and destination are sliced (so neither is continuous) it works correctly. + destination = destination.Slice(sliceLengths); + x.FlattenTo(sliceData); + expectedOutput = new TOut[sliceFlattenedLength]; + + if (TensorHelpers.IsContiguousAndDense(x)) + { + tensorPrimitivesOperation((ReadOnlySpan)sliceData, expectedOutput); + } + else + { + int rowLength = (int)Helpers.TensorSliceShapes[index][^1]; + for (int i = 0; i < sliceData.Length; i += rowLength) + { + tensorPrimitivesOperation(((ReadOnlySpan)sliceData).Slice(i, rowLength), ((Span)expectedOutput).Slice(i, rowLength)); + } + + } + + tensorResults = tensorOperation(x, destination); + + Assert.Equal(Helpers.TensorSliceShapes[index], tensorResults.Lengths); + + destEnum = destination.GetEnumerator(); + tensorResultsEnum = tensorResults.GetEnumerator(); + + for (int i = 0; i < expectedOutput.Length; i++) + { + destEnumMove = destEnum.MoveNext(); + tensorResultsEnumMove = tensorResultsEnum.MoveNext(); + + Assert.True(destEnumMove); + Assert.True(tensorResultsEnumMove); + Assert.Equal(expectedOutput[i], destEnum.Current); + Assert.Equal(expectedOutput[i], tensorResultsEnum.Current); + } }); } @@ -146,7 +233,7 @@ static object[] Create(TensorPrimitivesSpanInTOut tensorPrimitivesMethod, public void TensorExtensionsSpanInTOut(TensorPrimitivesSpanInTOut tensorPrimitivesOperation, TensorSpanInTOut tensorOperation) where T : INumberBase { - Assert.All(Helpers.TensorShapes, tensorLength => + Assert.All(Helpers.TensorShapes, (tensorLength, index) => { nint length = CalculateTotalLength(tensorLength); T[] data = new T[length]; @@ -157,6 +244,40 @@ public void TensorExtensionsSpanInTOut(TensorPrimitivesSpanInTOut tensorPr T results = tensorOperation(x); Assert.Equal(expectedOutput, results); + + float[] testData = [49.788437f, 32.736755f, -0.25761032f, -46.402596f, 4.5581512f, 21.813591f, 44.976646f, 12.691814f, -44.188023f, 40.35988f, -6.999405f, 4.713642f, 5.274975f, 21.312515f, -12.536407f, -34.888573f, -1.90839f, 28.734451f, -38.64155f, -28.840702f, 7.373543f, 18.600182f, 26.007828f, 0.71430206f, -6.8293495f, -13.327972f, -25.149017f, 9.331852f, 40.87751f, 28.321632f, 42.918175f, 25.213333f, -41.392017f, 36.727768f, 26.49012f, 3.8807983f, 24.933182f, -43.050568f, -42.6283f, 18.01947f, -47.62874f, -49.94487f, -1.036602f, -37.086433f, 32.77098f, -12.903477f, -45.100212f, -20.596504f, 33.67714f, 46.864395f, 44.437485f, -44.092155f, 37.122124f, 25.220505f, 41.994873f, -13.3394165f, -28.193134f, -21.329712f, -36.623306f, 3.3981133f, -26.475079f, 16.339478f, -44.07065f, 36.321762f, -24.63433f, 28.652397f, 4.096817f, 33.29615f, -2.3503838f, -7.509815f, 42.943604f, -32.52115f, -0.20326233f, 29.554626f, 18.044052f]; + nint[] testLengths = [5, 3, 5]; + Tensor testTensor = Tensor.Create(testData, testLengths, []); + float[] testSliceData = new float[75]; + testTensor.FlattenTo(testSliceData); + float testExpectedOutput = TensorPrimitives.Sum((ReadOnlySpan)testSliceData); + float testResults = Tensor.Sum(testTensor); + + + // Now test if the source is sliced to be non contiguous that it still gives expected result. + NRange[] sliceLengths = Helpers.TensorSliceShapes[index].Select(i => new NRange(0, i)).ToArray(); + nint sliceFlattenedLength = CalculateTotalLength(Helpers.TensorSliceShapes[index]); + x = x.Slice(sliceLengths); + T[] sliceData = new T[sliceFlattenedLength]; + x.FlattenTo(sliceData); + + IEnumerator enumerator = x.GetEnumerator(); + bool cont = enumerator.MoveNext(); + ReadOnlySpan span = MemoryMarshal.CreateSpan(ref x.AsReadOnlyTensorSpan()._reference, (int)x.FlattenedLength); + int i = 0; + Assert.True(span.SequenceEqual(sliceData)); + while (cont) + { + Assert.Equal(sliceData[i], enumerator.Current); + Assert.Equal(span[i], enumerator.Current); + Assert.Equal(span[i], sliceData[i++]); + cont = enumerator.MoveNext(); + } + + expectedOutput = tensorPrimitivesOperation((ReadOnlySpan)sliceData); + results = tensorOperation(x); + + Assert.Equal(expectedOutput, results); }); } @@ -184,9 +305,9 @@ static object[] Create(TensorPrimitivesTwoSpanInSpanOut tensorPrimitivesMe public void TensorExtensionsTwoSpanInSpanOut(TensorPrimitivesTwoSpanInSpanOut tensorPrimitivesOperation, TensorTwoSpanInSpanOut tensorOperation) where T : INumberBase { - Assert.All(Helpers.TensorShapes, tensorLength => + Assert.All(Helpers.TensorShapes, (tensorLengths, index) => { - nint length = CalculateTotalLength(tensorLength); + nint length = CalculateTotalLength(tensorLengths); T[] data1 = new T[length]; T[] data2 = new T[length]; T[] destData = new T[length]; @@ -194,14 +315,17 @@ public void TensorExtensionsTwoSpanInSpanOut(TensorPrimitivesTwoSpanInSpanOut FillTensor(data1); FillTensor(data2); - TensorSpan x = Tensor.Create(data1, tensorLength, []); - TensorSpan y = Tensor.Create(data2, tensorLength, []); - TensorSpan destination = Tensor.Create(destData, tensorLength, []); + + + // First test when everything is exact sizes + TensorSpan x = Tensor.Create(data1, tensorLengths, []); + TensorSpan y = Tensor.Create(data2, tensorLengths, []); + TensorSpan destination = Tensor.Create(destData, tensorLengths, []); tensorPrimitivesOperation((ReadOnlySpan)data1, data2, expectedOutput); TensorSpan results = tensorOperation(x, y, destination); - Assert.Equal(tensorLength, results.Lengths); - nint[] startingIndex = new nint[tensorLength.Length]; + Assert.Equal(tensorLengths, results.Lengths); + nint[] startingIndex = new nint[tensorLengths.Length]; // the "Return" value ReadOnlySpan span = MemoryMarshal.CreateSpan(ref results[startingIndex], (int)length); // the "destination" value @@ -212,6 +336,148 @@ public void TensorExtensionsTwoSpanInSpanOut(TensorPrimitivesTwoSpanInSpanOut Assert.Equal(expectedOutput[i], span[i]); Assert.Equal(expectedOutput[i], destSpan[i]); } + + // Now test when both sources are exact sizes but destination is too large and gets sliced internally. + nint[] tempLengths = tensorLengths.Select(i => i + 1).ToArray(); + T[] tempDestData = new T[CalculateTotalLength(tempLengths)]; + destination = Tensor.Create(tempDestData, tempLengths, []); + results = tensorOperation(x, y, destination); + + // Since the slice was internal the result lengths will be the extra large size. + Assert.Equal(tempLengths, results.Lengths); + startingIndex = new nint[tensorLengths.Length]; + + TensorSpan.Enumerator destEnum = destination.Slice(tensorLengths).GetEnumerator(); + TensorSpan.Enumerator tensorResultsEnum = results.Slice(tensorLengths).GetEnumerator(); + bool destEnumMove; + bool tensorResultsEnumMove; + + for (int i = 0; i < expectedOutput.Length; i++) + { + destEnumMove = destEnum.MoveNext(); + tensorResultsEnumMove = tensorResultsEnum.MoveNext(); + + Assert.True(destEnumMove); + Assert.True(tensorResultsEnumMove); + Assert.Equal(expectedOutput[i], destEnum.Current); + Assert.Equal(expectedOutput[i], tensorResultsEnum.Current); + } + + // Now test if the first source is sliced to be smaller than the second (but is broadcast compatible) that broadcasting happens). + int rowLength = (int)Helpers.TensorSliceShapesForBroadcast[index][^1]; + + NRange[] sliceLengths = Helpers.TensorSliceShapesForBroadcast[index].Select(i => new NRange(0, i)).ToArray(); + nint sliceFlattenedLength = CalculateTotalLength(Helpers.TensorSliceShapesForBroadcast[index]); + destination = destination.Slice(tensorLengths); + x.Slice(sliceLengths).BroadcastTo(x); + x.FlattenTo(data1); + + if (TensorHelpers.IsContiguousAndDense(x.Slice(sliceLengths)) && TensorHelpers.IsContiguousAndDense(y)) + { + tensorPrimitivesOperation((ReadOnlySpan)data1, data2, expectedOutput); + } + else + { + for (int i = 0; i < data1.Length; i += rowLength) + { + tensorPrimitivesOperation(((ReadOnlySpan)data1).Slice(i, rowLength), ((ReadOnlySpan)data2).Slice(i, rowLength), ((Span)expectedOutput).Slice(i, rowLength)); + } + + } + + results = tensorOperation(x.Slice(sliceLengths), y, destination); + + // results lengths will still be the original tensorLength + Assert.Equal(tensorLengths, results.Lengths); + + destEnum = destination.GetEnumerator(); + tensorResultsEnum = results.GetEnumerator(); + + for (int i = 0; i < expectedOutput.Length; i++) + { + destEnumMove = destEnum.MoveNext(); + tensorResultsEnumMove = tensorResultsEnum.MoveNext(); + + Assert.True(destEnumMove); + Assert.True(tensorResultsEnumMove); + Assert.Equal(expectedOutput[i], destEnum.Current); + Assert.Equal(expectedOutput[i], tensorResultsEnum.Current); + } + + // Now test if the second source is sliced to be smaller than the first (but is broadcast compatible) that broadcasting happens). + y.Slice(sliceLengths).BroadcastTo(y); + y.FlattenTo(data2); + + if (TensorHelpers.IsContiguousAndDense(x) && TensorHelpers.IsContiguousAndDense(y.Slice(sliceLengths))) + { + tensorPrimitivesOperation((ReadOnlySpan)data1, data2, expectedOutput); + } + else + { + for (int i = 0; i < data2.Length; i += rowLength) + { + tensorPrimitivesOperation(((ReadOnlySpan)data1).Slice(i, rowLength), ((ReadOnlySpan)data2).Slice(i, rowLength), ((Span)expectedOutput).Slice(i, rowLength)); + } + + } + + results = tensorOperation(x, y.Slice(sliceLengths), destination); + + // results lengths will still be the original tensorLength + Assert.Equal(tensorLengths, results.Lengths); + + destEnum = destination.GetEnumerator(); + tensorResultsEnum = results.GetEnumerator(); + + for (int i = 0; i < expectedOutput.Length; i++) + { + destEnumMove = destEnum.MoveNext(); + tensorResultsEnumMove = tensorResultsEnum.MoveNext(); + + Assert.True(destEnumMove); + Assert.True(tensorResultsEnumMove); + Assert.Equal(expectedOutput[i], destEnum.Current); + Assert.Equal(expectedOutput[i], tensorResultsEnum.Current); + } + + // Now test if both sources are sliced to be smaller than the destination that the destination will be sliced automatically + T[] sliceData1 = new T[sliceFlattenedLength]; + T[] sliceData2 = new T[sliceFlattenedLength]; + expectedOutput = new T[sliceFlattenedLength]; + + x.Slice(sliceLengths).FlattenTo(sliceData1); + y.Slice(sliceLengths).FlattenTo(sliceData2); + + if (TensorHelpers.IsContiguousAndDense(x.Slice(sliceLengths)) && TensorHelpers.IsContiguousAndDense(y.Slice(sliceLengths))) + { + tensorPrimitivesOperation((ReadOnlySpan)sliceData1, sliceData2, expectedOutput); + } + else + { + for (int i = 0; i < sliceData1.Length; i += rowLength) + { + tensorPrimitivesOperation(((ReadOnlySpan)sliceData1).Slice(i, rowLength), ((ReadOnlySpan)sliceData2).Slice(i, rowLength), ((Span)expectedOutput).Slice(i, rowLength)); + } + + } + + results = tensorOperation(x.Slice(sliceLengths), y.Slice(sliceLengths), destination); + + Assert.Equal(tensorLengths, results.Lengths); + + destEnum = destination.Slice(sliceLengths).GetEnumerator(); + tensorResultsEnum = results.Slice(sliceLengths).GetEnumerator(); + + for (int i = 0; i < expectedOutput.Length; i++) + { + destEnumMove = destEnum.MoveNext(); + tensorResultsEnumMove = tensorResultsEnum.MoveNext(); + + Assert.True(destEnumMove); + Assert.True(tensorResultsEnumMove); + Assert.Equal(expectedOutput[i], destEnum.Current); + Assert.Equal(expectedOutput[i], tensorResultsEnum.Current); + } }); } @@ -220,7 +486,7 @@ public void TensorExtensionsTwoSpanInSpanOut(TensorPrimitivesTwoSpanInSpanOut public static IEnumerable TwoSpanInFloatOutData() { yield return Create(TensorPrimitives.Distance, Tensor.Distance); - yield return Create(TensorPrimitives.Dot, Tensor.Dot); + //yield return Create(TensorPrimitives.Dot, Tensor.Dot); static object[] Create(TensorPrimitivesTwoSpanInTOut tensorPrimitivesMethod, TensorTwoSpanInTOut tensorOperation) => new object[] { tensorPrimitivesMethod, tensorOperation }; @@ -230,11 +496,13 @@ static object[] Create(TensorPrimitivesTwoSpanInTOut tensorPrimitivesMetho public void TensorExtensionsTwoSpanInFloatOut(TensorPrimitivesTwoSpanInTOut tensorPrimitivesOperation, TensorTwoSpanInTOut tensorOperation) where T : INumberBase { - Assert.All(Helpers.TensorShapes, tensorLength => + Assert.All(Helpers.TensorShapes, (tensorLength, index) => { nint length = CalculateTotalLength(tensorLength); T[] data1 = new T[length]; T[] data2 = new T[length]; + T[] broadcastData1 = new T[length]; + T[] broadcastData2 = new T[length]; FillTensor(data1); FillTensor(data2); @@ -244,6 +512,43 @@ public void TensorExtensionsTwoSpanInFloatOut(TensorPrimitivesTwoSpanInTOut new NRange(0, i)).ToArray(); + TensorSpan broadcastX = Tensor.Create(broadcastData1, tensorLength, []); + x.Slice(sliceLengths).BroadcastTo(broadcastX); + TensorSpan.Enumerator enumerator = broadcastX.GetEnumerator(); + bool cont = enumerator.MoveNext(); + int i = 0; + while (cont) + { + Assert.Equal(broadcastData1[i++], enumerator.Current); + cont = enumerator.MoveNext(); + } + + expectedOutput = tensorPrimitivesOperation((ReadOnlySpan)broadcastData1, data2); + results = tensorOperation(x.Slice(sliceLengths), y); + + Assert.Equal(expectedOutput, results); + + // Now test if the second source is sliced to be non contiguous that it still gives expected result. + + TensorSpan broadcastY = Tensor.Create(broadcastData2, tensorLength, []); + y.Slice(sliceLengths).BroadcastTo(broadcastY); + + enumerator = broadcastY.GetEnumerator(); + cont = enumerator.MoveNext(); + i = 0; + while (cont) + { + Assert.Equal(broadcastData2[i++], enumerator.Current); + cont = enumerator.MoveNext(); + } + + expectedOutput = tensorPrimitivesOperation((ReadOnlySpan)data1, broadcastData2); + results = tensorOperation(x, y.Slice(sliceLengths)); + + Assert.Equal(expectedOutput, results); }); } From 33a17bb1bff702efad8d4ddbc2f394419aa5c9f1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:12:58 -0700 Subject: [PATCH 083/748] [release/9.0] Azure Linux 3.0 and test fixes (#107123) * Change BuildWithFactoryReadDirect to not use RSA+MD5 * Add Azure 3.0 helix test --------- Co-authored-by: Kevin Jones Co-authored-by: Rich Lander --- eng/pipelines/libraries/helix-queues-setup.yml | 1 + .../tests/Pkcs12/KeyBagTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index 3d4185b933888f..5b660a70bf7680 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -68,6 +68,7 @@ jobs: - Ubuntu.2204.Amd64.Open - (Debian.11.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-amd64 - (Mariner.2.0.Amd64.Open)Ubuntu.2204.Amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-helix-amd64 + - (AzureLinux.3.0.Amd64.Open)Ubuntu.2204.Amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-helix-amd64 - (openSUSE.15.2.Amd64.Open)Ubuntu.2204.Amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:opensuse-15.2-helix-amd64 - ${{ if or(ne(parameters.jobParameters.isExtraPlatformsBuild, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: - (Centos.8.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8-helix diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/Pkcs12/KeyBagTests.cs b/src/libraries/System.Security.Cryptography.Pkcs/tests/Pkcs12/KeyBagTests.cs index 2a3ba970c01aef..071a210c79dd55 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/Pkcs12/KeyBagTests.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/Pkcs12/KeyBagTests.cs @@ -29,7 +29,7 @@ public static void BuildWithFactoryReadDirect() Assert.True(rsa2.TrySignData( keyBag.Pkcs8PrivateKey.Span, sig, - HashAlgorithmName.MD5, + HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1, out int sigLen)); @@ -38,7 +38,7 @@ public static void BuildWithFactoryReadDirect() Assert.True(rsa.VerifyData( keyBag.Pkcs8PrivateKey.Span, sig, - HashAlgorithmName.MD5, + HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1)); } } From d0f3235d312f7cf9683012b3fe96b2c6f20a1743 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:38:18 -0700 Subject: [PATCH 084/748] Use the typical MethodTable not the instantiated one. (#107160) Co-authored-by: Aaron R Robinson --- src/coreclr/vm/prestub.cpp | 2 +- .../UnsafeAccessorsTests.Generics.cs | 79 +++++++++++++++---- 2 files changed, 63 insertions(+), 18 deletions(-) diff --git a/src/coreclr/vm/prestub.cpp b/src/coreclr/vm/prestub.cpp index de1f7fd09007ba..0ad45e1110ceb4 100644 --- a/src/coreclr/vm/prestub.cpp +++ b/src/coreclr/vm/prestub.cpp @@ -1294,7 +1294,7 @@ namespace Instantiation targetMethodInst; if (targetType->HasInstantiation()) { - declClassInst = declaration->GetMethodTable()->GetInstantiation(); + declClassInst = declaration->GetMethodTable()->GetTypicalMethodTable()->GetInstantiation(); targetClassInst = targetType->GetTypicalMethodTable()->GetInstantiation(); } if (targetMethod->HasMethodInstantiation()) diff --git a/src/tests/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests.Generics.cs b/src/tests/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests.Generics.cs index d0a40d59c011c4..311550810224c8 100644 --- a/src/tests/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests.Generics.cs +++ b/src/tests/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests.Generics.cs @@ -11,6 +11,14 @@ struct Struct { } +interface I1 { } + +interface I2 { } + +class ClassWithI1 : I1 { } + +class ClassWithI1I2 : I1, I2 { } + public static unsafe class UnsafeAccessorsTestsGenerics { class ClassWithEnum @@ -396,45 +404,82 @@ public static void Verify_Generic_GenericTypeGenericStaticMethod() } } - class ClassWithConstraints + class MethodWithConstraints { - private string M() where T : U, IEquatable + private string M() where T : U, I2 => $"{typeof(T)}|{typeof(U)}"; - private static string SM() where T : U, IEquatable + private static string SM() where T : U, I2 => $"{typeof(T)}|{typeof(U)}"; } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/102942", TestRuntimes.Mono)] - public static void Verify_Generic_ConstraintEnforcement() + public static void Verify_Generic_MethodConstraintEnforcement() { - Console.WriteLine($"Running {nameof(Verify_Generic_ConstraintEnforcement)}"); + Console.WriteLine($"Running {nameof(Verify_Generic_MethodConstraintEnforcement)}"); - Assert.Equal($"{typeof(string)}|{typeof(object)}", CallMethod(new ClassWithConstraints())); - Assert.Equal($"{typeof(string)}|{typeof(object)}", CallStaticMethod(null)); - Assert.Throws(() => CallMethod_NoConstraints(new ClassWithConstraints())); - Assert.Throws(() => CallMethod_MissingConstraint(new ClassWithConstraints())); - Assert.Throws(() => CallStaticMethod_NoConstraints(null)); - Assert.Throws(() => CallStaticMethod_MissingConstraint(null)); + Assert.Equal($"{typeof(ClassWithI1I2)}|{typeof(I1)}", CallMethod(new MethodWithConstraints())); + Assert.Equal($"{typeof(ClassWithI1I2)}|{typeof(I1)}", CallStaticMethod(null)); + Assert.Throws(() => CallMethod_NoConstraints(new MethodWithConstraints())); + Assert.Throws(() => CallMethod_MissingConstraint(new MethodWithConstraints())); + Assert.Throws(() => CallStaticMethod_NoConstraints(null)); + Assert.Throws(() => CallStaticMethod_MissingConstraint(null)); [UnsafeAccessor(UnsafeAccessorKind.Method, Name = "M")] - extern static string CallMethod(ClassWithConstraints c) where V : W, IEquatable; + extern static string CallMethod(MethodWithConstraints c) where V : W, I2; [UnsafeAccessor(UnsafeAccessorKind.Method, Name = "M")] - extern static string CallMethod_NoConstraints(ClassWithConstraints c); + extern static string CallMethod_NoConstraints(MethodWithConstraints c); [UnsafeAccessor(UnsafeAccessorKind.Method, Name = "M")] - extern static string CallMethod_MissingConstraint(ClassWithConstraints c) where V : W; + extern static string CallMethod_MissingConstraint(MethodWithConstraints c) where V : W; [UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "SM")] - extern static string CallStaticMethod(ClassWithConstraints c) where V : W, IEquatable; + extern static string CallStaticMethod(MethodWithConstraints c) where V : W, I2; [UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "SM")] - extern static string CallStaticMethod_NoConstraints(ClassWithConstraints c); + extern static string CallStaticMethod_NoConstraints(MethodWithConstraints c); [UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "SM")] - extern static string CallStaticMethod_MissingConstraint(ClassWithConstraints c) where V : W; + extern static string CallStaticMethod_MissingConstraint(MethodWithConstraints c) where V : W; + } + + class ClassWithConstraints where T : U, I2 + { + private string M() where W : I1 + => $"{typeof(T)}|{typeof(U)}|{typeof(W)}"; + + private static string SM() where X : I1 + => $"{typeof(T)}|{typeof(U)}|{typeof(X)}"; + } + + class AccessorsWithConstraints where A : B, I2 + { + [UnsafeAccessor(UnsafeAccessorKind.Method, Name = "M")] + public extern static string CallMethod(ClassWithConstraints c) where C: I1; + + [UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "SM")] + public extern static string CallStaticMethod(ClassWithConstraints c) where D: I1; + + [UnsafeAccessor(UnsafeAccessorKind.Method, Name = "M")] + public extern static string CallMethod_MissingMethodConstraint(ClassWithConstraints c); + + [UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "SM")] + public extern static string CallStaticMethod_MissingMethodConstraint(ClassWithConstraints c); + } + + [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/102942", TestRuntimes.Mono)] + public static void Verify_Generic_ClassConstraintEnforcement() + { + Console.WriteLine($"Running {nameof(Verify_Generic_ClassConstraintEnforcement)}"); + + Assert.Equal($"{typeof(ClassWithI1I2)}|{typeof(I1)}|{typeof(ClassWithI1)}", AccessorsWithConstraints.CallMethod(new ClassWithConstraints())); + Assert.Equal($"{typeof(ClassWithI1I2)}|{typeof(I1)}|{typeof(ClassWithI1)}", AccessorsWithConstraints.CallStaticMethod(null)); + + Assert.Throws(() => AccessorsWithConstraints.CallMethod_MissingMethodConstraint(new ClassWithConstraints())); + Assert.Throws(() => AccessorsWithConstraints.CallStaticMethod_MissingMethodConstraint(null)); } class Invalid From 31528d082bd760377b8d818fc839a338cd071b1f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2024 17:19:15 -0700 Subject: [PATCH 085/748] Fix string case-insensitive comparisons in Globalization invariant mode (#107311) Co-authored-by: Tarek Mahmoud Sayed --- .../src/System/Globalization/InvariantModeCasing.cs | 2 +- .../Invariant/InvariantMode.cs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/InvariantModeCasing.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/InvariantModeCasing.cs index 809b42ac74c1fd..5c6dfadf073bd2 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/InvariantModeCasing.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/InvariantModeCasing.cs @@ -215,7 +215,7 @@ internal static int CompareStringIgnoreCase(ref char strA, int lengthA, ref char continue; } - return (int)codePointA - (int)codePointB; + return (int)aUpper - (int)bUpper; } return lengthA - lengthB; diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/Invariant/InvariantMode.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/Invariant/InvariantMode.cs index 3b72d1d219cf34..91b098cd505b68 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/Invariant/InvariantMode.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/Invariant/InvariantMode.cs @@ -1257,5 +1257,18 @@ private static byte[] GetExpectedInvariantOrdinalSortKey(ReadOnlySpan inpu return memoryStream.ToArray(); } + + [Fact] + public void TestChainStringComparisons() + { + var s1 = "бал"; + var s2 = "Бан"; + var s3 = "Д"; + + // If s1 < s2 and s2 < s3, then s1 < s3 + Assert.True(string.Compare(s1, s2, StringComparison.OrdinalIgnoreCase) < 0); + Assert.True(string.Compare(s2, s3, StringComparison.OrdinalIgnoreCase) < 0); + Assert.True(string.Compare(s1, s3, StringComparison.OrdinalIgnoreCase) < 0); + } } } From 48fd63c1bd597cf8d69de79bfb1a0ed3a12ff68f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 10:05:52 -0700 Subject: [PATCH 086/748] [release/9.0] Fix encoding for certain k-mask instructions (#107249) * Fix encoding for certain k-mask instructions * Update instr.h * Update Runtime_107146.cs * Update src/coreclr/jit/emitxarch.cpp Co-authored-by: Jakob Botsch Nielsen --------- Co-authored-by: EgorBo Co-authored-by: Jakob Botsch Nielsen Co-authored-by: Jeff Schwartz --- src/coreclr/jit/emitxarch.cpp | 19 ++++++- src/coreclr/jit/emitxarch.h | 1 + src/coreclr/jit/instr.h | 3 +- src/coreclr/jit/instrsxarch.h | 54 +++++++++---------- .../JitBlue/Runtime_107146/Runtime_107146.cs | 48 +++++++++++++++++ .../Runtime_107146/Runtime_107146.csproj | 8 +++ 6 files changed, 104 insertions(+), 29 deletions(-) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_107146/Runtime_107146.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_107146/Runtime_107146.csproj diff --git a/src/coreclr/jit/emitxarch.cpp b/src/coreclr/jit/emitxarch.cpp index 2b98d14183abab..71cafb0d5f4883 100644 --- a/src/coreclr/jit/emitxarch.cpp +++ b/src/coreclr/jit/emitxarch.cpp @@ -49,6 +49,23 @@ bool emitter::IsKInstruction(instruction ins) return (flags & KInstruction) != 0; } +//------------------------------------------------------------------------ +// IsKInstructionWithLBit: Does this instruction require K register and +// LBIT_IN_3BYTE_VEX_PREFIX bit. +// +// Arguments: +// ins - The instruction to check. +// +// Returns: +// `true` if this instruction requires K register and +// LBIT_IN_3BYTE_VEX_PREFIX bit. +// +bool emitter::IsKInstructionWithLBit(instruction ins) +{ + insFlags flags = CodeGenInterface::instInfo[ins]; + return (flags & KInstructionWithLBit) != 0; +} + bool emitter::IsAVXOnlyInstruction(instruction ins) { return (ins >= INS_FIRST_AVX_INSTRUCTION) && (ins <= INS_LAST_AVX_INSTRUCTION); @@ -1495,7 +1512,7 @@ emitter::code_t emitter::AddVexPrefix(instruction ins, code_t code, emitAttr att code |= DEFAULT_3BYTE_VEX_PREFIX; - if (attr == EA_32BYTE) + if ((attr == EA_32BYTE) || IsKInstructionWithLBit(ins)) { // Set L bit to 1 in case of instructions that operate on 256-bits. code |= LBIT_IN_3BYTE_VEX_PREFIX; diff --git a/src/coreclr/jit/emitxarch.h b/src/coreclr/jit/emitxarch.h index 7ff6902613d59c..cc70f02ed36060 100644 --- a/src/coreclr/jit/emitxarch.h +++ b/src/coreclr/jit/emitxarch.h @@ -113,6 +113,7 @@ static bool IsPermuteVar2xInstruction(instruction ins); static bool IsAVXVNNIInstruction(instruction ins); static bool IsBMIInstruction(instruction ins); static bool IsKInstruction(instruction ins); +static bool IsKInstructionWithLBit(instruction ins); static regNumber getBmiRegNumber(instruction ins); static regNumber getSseShiftRegNumber(instruction ins); diff --git a/src/coreclr/jit/instr.h b/src/coreclr/jit/instr.h index 47db1c8304a8a0..5e27dcb9a2d86c 100644 --- a/src/coreclr/jit/instr.h +++ b/src/coreclr/jit/instr.h @@ -213,9 +213,10 @@ enum insFlags : uint64_t Encoding_EVEX = 1ULL << 40, KInstruction = 1ULL << 41, + KInstructionWithLBit = 1ULL << 42, // EVEX feature: embedded broadcast - INS_Flags_EmbeddedBroadcastSupported = 1ULL << 42, + INS_Flags_EmbeddedBroadcastSupported = 1ULL << 43, // TODO-Cleanup: Remove this flag and its usage from TARGET_XARCH INS_FLAGS_DONT_CARE = 0x00ULL, diff --git a/src/coreclr/jit/instrsxarch.h b/src/coreclr/jit/instrsxarch.h index 9d835239ba397f..f365880bcbf053 100644 --- a/src/coreclr/jit/instrsxarch.h +++ b/src/coreclr/jit/instrsxarch.h @@ -610,18 +610,18 @@ INST3(LAST_AVX_INSTRUCTION, "LAST_AVX_INSTRUCTION", IUM_WR, BAD_CODE, BAD_CODE, INST3(FIRST_AVX512_INSTRUCTION, "FIRST_AVX512_INSTRUCTION", IUM_WR, BAD_CODE, BAD_CODE, BAD_CODE, INS_TT_NONE, INS_FLAGS_None) // AVX512F -INST3(kandw, "kandw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x41), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Bitwise logical AND masks -INST3(kandnw, "kandnw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x42), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Bitwise logical AND NOT masks +INST3(kandw, "kandw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x41), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical AND masks +INST3(kandnw, "kandnw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x42), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical AND NOT masks INST3(kmovw_gpr, "kmovw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x92), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Move from and to mask registers INST3(kmovw_msk, "kmovw", IUM_WR, PCKFLT(0x91), BAD_CODE, PCKFLT(0x90), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Move from and to mask registers INST3(knotw, "knotw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x44), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // NOT mask register -INST3(korw, "korw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x45), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Bitwise logical OR masks +INST3(korw, "korw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x45), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical OR masks INST3(kortestw, "kortestw", IUM_RD, BAD_CODE, BAD_CODE, PCKFLT(0x98), INS_TT_NONE, REX_W0 | Encoding_VEX | Resets_OF | Resets_SF | Writes_ZF | Resets_AF | Resets_PF | Writes_CF | KInstruction) // OR masks and set flags INST3(kshiftlw, "kshiftlw", IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0x32), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Shift left mask registers INST3(kshiftrw, "kshiftrw", IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0x30), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Shift right mask registers -INST3(kunpckbw, "kunpckbw", IUM_RD, BAD_CODE, BAD_CODE, PCKDBL(0x4B), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Unpack for mask registers -INST3(kxnorw, "kxnorw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x46), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Bitwise logical XNOR masks -INST3(kxorw, "kxorw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x47), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Bitwise logical XOR masks +INST3(kunpckbw, "kunpckbw", IUM_RD, BAD_CODE, BAD_CODE, PCKDBL(0x4B), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Unpack for mask registers +INST3(kxnorw, "kxnorw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x46), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical XNOR masks +INST3(kxorw, "kxorw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x47), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical XOR masks INST3(valignd, "alignd", IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0x03), INS_TT_FULL, Input_32Bit | REX_W0 | Encoding_EVEX | INS_Flags_IsDstDstSrcAVXInstruction | INS_Flags_EmbeddedBroadcastSupported) // Align doubleword vectors INST3(valignq, "alignq", IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0x03), INS_TT_FULL, Input_64Bit | REX_W1 | Encoding_EVEX | INS_Flags_IsDstDstSrcAVXInstruction | INS_Flags_EmbeddedBroadcastSupported) // Align quadword vectors INST3(vblendmpd, "blendmpd", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0x65), INS_TT_FULL, Input_64Bit | REX_W1 | Encoding_EVEX | INS_Flags_IsDstDstSrcAVXInstruction | INS_Flags_EmbeddedBroadcastSupported) // Blend Float64 vectors using an OpMask control @@ -756,20 +756,20 @@ INST3(vshufi32x4, "shufi32x4", IUM_WR, BAD_CODE, BAD_ INST3(vshufi64x2, "shufi64x2", IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0x43), INS_TT_FULL, Input_64Bit | REX_W1 | Encoding_EVEX | INS_Flags_IsDstDstSrcAVXInstruction | INS_Flags_EmbeddedBroadcastSupported) // Shuffle packed values at 128-bit granularity // AVX512BW -INST3(kaddd, "kaddd", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x4A), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Add two masks -INST3(kaddq, "kaddq", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x4A), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Add two masks -INST3(kandd, "kandd", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x41), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Bitwise logical AND masks -INST3(kandq, "kandq", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x41), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Bitwise logical AND masks -INST3(kandnd, "kandnd", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x42), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Bitwise logical AND NOT masks -INST3(kandnq, "kandnq", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x42), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Bitwise logical AND NOT masks +INST3(kaddd, "kaddd", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x4A), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Add two masks +INST3(kaddq, "kaddq", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x4A), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Add two masks +INST3(kandd, "kandd", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x41), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical AND masks +INST3(kandq, "kandq", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x41), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical AND masks +INST3(kandnd, "kandnd", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x42), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical AND NOT masks +INST3(kandnq, "kandnq", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x42), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical AND NOT masks INST3(kmovd_gpr, "kmovd", IUM_WR, BAD_CODE, BAD_CODE, SSEDBL(0x92), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Move from and to mask registers INST3(kmovd_msk, "kmovd", IUM_WR, PCKDBL(0x91), BAD_CODE, PCKDBL(0x90), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Move from and to mask registers INST3(kmovq_gpr, "kmovq", IUM_WR, BAD_CODE, BAD_CODE, SSEDBL(0x92), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Move from and to mask registers INST3(kmovq_msk, "kmovq", IUM_WR, PCKFLT(0x91), BAD_CODE, PCKFLT(0x90), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Move from and to mask registers INST3(knotd, "knotd", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x44), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // NOT mask register INST3(knotq, "knotq", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x44), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // NOT mask register -INST3(kord, "kord", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x45), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Bitwise logical OR masks -INST3(korq, "korq", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x45), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Bitwise logical OR masks +INST3(kord, "kord", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x45), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical OR masks +INST3(korq, "korq", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x45), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical OR masks INST3(kortestd, "kortestd", IUM_RD, BAD_CODE, BAD_CODE, PCKDBL(0x98), INS_TT_NONE, REX_W1 | Encoding_VEX | Resets_OF | Resets_SF | Writes_ZF | Resets_AF | Resets_PF | Writes_CF | KInstruction) // OR masks and set flags INST3(kortestq, "kortestq", IUM_RD, BAD_CODE, BAD_CODE, PCKFLT(0x98), INS_TT_NONE, REX_W1 | Encoding_VEX | Resets_OF | Resets_SF | Writes_ZF | Resets_AF | Resets_PF | Writes_CF | KInstruction) // OR masks and set flags INST3(kshiftld, "kshiftld", IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0x33), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Shift left mask registers @@ -778,12 +778,12 @@ INST3(kshiftrd, "kshiftrd", IUM_WR, BAD_CODE, BAD_ INST3(kshiftrq, "kshiftrq", IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0x31), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Shift right mask registers INST3(ktestd, "ktestd", IUM_RD, BAD_CODE, BAD_CODE, PCKDBL(0x99), INS_TT_NONE, REX_W1 | Encoding_VEX | Resets_OF | Resets_SF | Writes_ZF | Resets_AF | Resets_PF | Writes_CF | KInstruction) // Packed bit test masks and set flags INST3(ktestq, "ktestq", IUM_RD, BAD_CODE, BAD_CODE, PCKFLT(0x99), INS_TT_NONE, REX_W1 | Encoding_VEX | Resets_OF | Resets_SF | Writes_ZF | Resets_AF | Resets_PF | Writes_CF | KInstruction) // Packed bit test masks and set flags -INST3(kunpckdq, "kunpckdq", IUM_RD, BAD_CODE, BAD_CODE, PCKFLT(0x4B), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Unpack for mask registers -INST3(kunpckwd, "kunpckwd", IUM_RD, BAD_CODE, BAD_CODE, PCKFLT(0x4B), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Unpack for mask registers -INST3(kxnord, "kxnord", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x46), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Bitwise logical XNOR masks -INST3(kxnorq, "kxnorq", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x46), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Bitwise logical XNOR masks -INST3(kxord, "kxord", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x47), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Bitwise logical XOR masks -INST3(kxorq, "kxorq", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x47), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction) // Bitwise logical XOR masks +INST3(kunpckdq, "kunpckdq", IUM_RD, BAD_CODE, BAD_CODE, PCKFLT(0x4B), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Unpack for mask registers +INST3(kunpckwd, "kunpckwd", IUM_RD, BAD_CODE, BAD_CODE, PCKFLT(0x4B), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Unpack for mask registers +INST3(kxnord, "kxnord", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x46), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical XNOR masks +INST3(kxnorq, "kxnorq", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x46), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical XNOR masks +INST3(kxord, "kxord", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x47), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical XOR masks +INST3(kxorq, "kxorq", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x47), INS_TT_NONE, REX_W1 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical XOR masks INST3(vpblendmd, "pblendmd", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0x64), INS_TT_FULL, Input_32Bit | REX_W0 | Encoding_EVEX | INS_Flags_IsDstDstSrcAVXInstruction | INS_Flags_EmbeddedBroadcastSupported) // Blend Byte vectors using an OpMask control INST3(vpblendmw, "pblendmw", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0x66), INS_TT_FULL_MEM, Input_16Bit | REX_W1 | Encoding_EVEX | INS_Flags_IsDstDstSrcAVXInstruction) // Blend Word vectors using an OpMask control INST3(vdbpsadbw, "dbpsadbw", IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0x42), INS_TT_FULL_MEM, Input_8Bit | REX_W0 | Encoding_EVEX | INS_Flags_IsDstDstSrcAVXInstruction) // Double block packed Sum-Absolute-Differences (SAD) on unsigned bytes @@ -824,21 +824,21 @@ INST3(vplzcntd, "plzcntd", IUM_WR, BAD_CODE, BAD_ INST3(vplzcntq, "plzcntq", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0x44), INS_TT_FULL, Input_64Bit | REX_W1 | Encoding_EVEX | INS_Flags_EmbeddedBroadcastSupported) // Count the number of leading zero bits for packed qword values // AVX512DQ -INST3(kaddb, "kaddb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x4A), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Add two masks -INST3(kaddw, "kaddw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x4A), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Add two masks -INST3(kandb, "kandb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x41), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Bitwise logical AND masks -INST3(kandnb, "kandnb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x42), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Bitwise logical AND NOT masks +INST3(kaddb, "kaddb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x4A), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Add two masks +INST3(kaddw, "kaddw", IUM_WR, BAD_CODE, BAD_CODE, PCKFLT(0x4A), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Add two masks +INST3(kandb, "kandb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x41), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical AND masks +INST3(kandnb, "kandnb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x42), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical AND NOT masks INST3(kmovb_gpr, "kmovb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x92), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Move from and to mask registers INST3(kmovb_msk, "kmovb", IUM_WR, PCKDBL(0x91), BAD_CODE, PCKDBL(0x90), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Move from and to mask registers INST3(knotb, "knotb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x44), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // NOT mask register -INST3(korb, "korb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x45), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Bitwise logical OR masks +INST3(korb, "korb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x45), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical OR masks INST3(kortestb, "kortestb", IUM_RD, BAD_CODE, BAD_CODE, PCKDBL(0x98), INS_TT_NONE, REX_W0 | Encoding_VEX | Resets_OF | Resets_SF | Writes_ZF | Resets_AF | Resets_PF | Writes_CF | KInstruction) // OR masks and set flags INST3(kshiftlb, "kshiftlb", IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0x32), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Shift left mask registers INST3(kshiftrb, "kshiftrb", IUM_WR, BAD_CODE, BAD_CODE, SSE3A(0x30), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Shift right mask registers INST3(ktestb, "ktestb", IUM_RD, BAD_CODE, BAD_CODE, PCKDBL(0x99), INS_TT_NONE, REX_W0 | Encoding_VEX | Resets_OF | Resets_SF | Writes_ZF | Resets_AF | Resets_PF | Writes_CF | KInstruction) // Packed bit test masks and set flags INST3(ktestw, "ktestw", IUM_RD, BAD_CODE, BAD_CODE, PCKFLT(0x99), INS_TT_NONE, REX_W0 | Encoding_VEX | Resets_OF | Resets_SF | Writes_ZF | Resets_AF | Resets_PF | Writes_CF | KInstruction) // Packed bit test masks and set flags -INST3(kxnorb, "kxnorb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x46), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Bitwise logical XNOR masks -INST3(kxorb, "kxorb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x47), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction) // Bitwise logical XOR masks +INST3(kxnorb, "kxnorb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x46), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical XNOR masks +INST3(kxorb, "kxorb", IUM_WR, BAD_CODE, BAD_CODE, PCKDBL(0x47), INS_TT_NONE, REX_W0 | Encoding_VEX | KInstruction | KInstructionWithLBit) // Bitwise logical XOR masks INST3(vbroadcastf32x2, "broadcastf32x2", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0x19), INS_TT_TUPLE2, Input_32Bit | REX_W0 | Encoding_EVEX) // Broadcast packed float values read from memory to entire register INST3(vbroadcasti32x2, "broadcasti32x2", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0x59), INS_TT_TUPLE2, Input_32Bit | REX_W0 | Encoding_EVEX) // Broadcast packed integer values read from memory to entire register INST3(vbroadcastf32x8, "broadcastf32x8", IUM_WR, BAD_CODE, BAD_CODE, SSE38(0x1B), INS_TT_TUPLE8, Input_32Bit | REX_W0 | Encoding_EVEX) // Broadcast packed float values read from memory to entire register diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_107146/Runtime_107146.cs b/src/tests/JIT/Regression/JitBlue/Runtime_107146/Runtime_107146.cs new file mode 100644 index 00000000000000..c24f3f2ca202ba --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_107146/Runtime_107146.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. + +// Generated by Fuzzlyn v2.4 on 2024-08-29 16:28:05 +// Run on X64 Windows +// Seed: 6081642137933547738-vectort,vector128,vector256,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86avx512fx64,x86bmi1,x86bmi1x64,x86bmi2,x86bmi2x64,x86fma,x86lzcnt,x86lzcntx64,x86pclmulqdq,x86popcnt,x86popcntx64,x86sse,x86ssex64,x86sse2,x86sse2x64,x86sse3,x86sse41,x86sse41x64,x86sse42,x86sse42x64,x86ssse3,x86x86base +// Reduced from 192.6 KiB to 0.8 KiB in 00:27:23 +// Exits with error: +// Fatal error. System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception. +// at Program.Main(Fuzzlyn.ExecutionServer.IRuntime) +// at Fuzzlyn.ExecutionServer.Program.g__RunAndGetResultAsync|1_0(Byte[], <>c__DisplayClass1_0 ByRef) +// at Fuzzlyn.ExecutionServer.Program.RunPairAsync(System.Runtime.Loader.AssemblyLoadContext, Fuzzlyn.ExecutionServer.ProgramPair) +// at Fuzzlyn.ExecutionServer.Program+<>c__DisplayClass0_0.
b__0() +// +using System; +using System.Numerics; +using System.Runtime.Intrinsics; +using System.Runtime.Intrinsics.X86; +using Xunit; + +public class Runtime_107146 +{ + private static float[] s_24 = new float[100]; + private static Vector256 s_25; + private static sbyte[] s_26 = new sbyte[100]; + private static Vector256 s_29; + + [Fact] + public static void TestEntryPoint() + { + if (!Avx512BW.VL.IsSupported) + { + return; + } + + for (int vr15 = 0; vr15 < 2; vr15++) + { + s_26[0] = 0; + float vr16 = s_24[0]--; + System.Console.WriteLine(s_25); + System.Console.WriteLine(System.BitConverter.SingleToUInt32Bits(vr16)); + var vr17 = (byte)Popcnt.PopCount(1); + var vr18 = Vector256.Create(vr17); + var vr19 = Vector256.Create(1); + s_29 = Avx512BW.VL.CompareLessThan(vr18, vr19); + } + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_107146/Runtime_107146.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_107146/Runtime_107146.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_107146/Runtime_107146.csproj @@ -0,0 +1,8 @@ + + + True + + + + + From 35fcf4ae436e270cb1d765e6b72495e37c62ad0b Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Wed, 4 Sep 2024 10:22:13 -0700 Subject: [PATCH 087/748] Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2530472 (#106995) * Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2524571 * Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2524571 --- .../gen/Resources/xlf/Strings.cs.xlf | 2 +- .../gen/Resources/xlf/Strings.de.xlf | 2 +- .../gen/Resources/xlf/Strings.es.xlf | 2 +- .../gen/Resources/xlf/Strings.fr.xlf | 2 +- .../gen/Resources/xlf/Strings.it.xlf | 2 +- .../gen/Resources/xlf/Strings.ja.xlf | 2 +- .../gen/Resources/xlf/Strings.ko.xlf | 2 +- .../gen/Resources/xlf/Strings.pl.xlf | 2 +- .../gen/Resources/xlf/Strings.pt-BR.xlf | 2 +- .../gen/Resources/xlf/Strings.ru.xlf | 2 +- .../gen/Resources/xlf/Strings.tr.xlf | 2 +- .../gen/Resources/xlf/Strings.zh-Hans.xlf | 2 +- .../gen/Resources/xlf/Strings.zh-Hant.xlf | 2 +- .../gen/Resources/xlf/Strings.cs.xlf | 4 ++-- .../gen/Resources/xlf/Strings.de.xlf | 4 ++-- .../gen/Resources/xlf/Strings.es.xlf | 4 ++-- .../gen/Resources/xlf/Strings.fr.xlf | 4 ++-- .../gen/Resources/xlf/Strings.it.xlf | 4 ++-- .../gen/Resources/xlf/Strings.ja.xlf | 4 ++-- .../gen/Resources/xlf/Strings.ko.xlf | 4 ++-- .../gen/Resources/xlf/Strings.pl.xlf | 4 ++-- .../gen/Resources/xlf/Strings.pt-BR.xlf | 4 ++-- .../gen/Resources/xlf/Strings.ru.xlf | 4 ++-- .../gen/Resources/xlf/Strings.tr.xlf | 4 ++-- .../gen/Resources/xlf/Strings.zh-Hans.xlf | 4 ++-- .../gen/Resources/xlf/Strings.zh-Hant.xlf | 4 ++-- .../gen/Common/Resources/xlf/Strings.cs.xlf | 8 ++++---- .../gen/Common/Resources/xlf/Strings.de.xlf | 8 ++++---- .../gen/Common/Resources/xlf/Strings.es.xlf | 8 ++++---- .../gen/Common/Resources/xlf/Strings.fr.xlf | 8 ++++---- .../gen/Common/Resources/xlf/Strings.it.xlf | 8 ++++---- .../gen/Common/Resources/xlf/Strings.ja.xlf | 8 ++++---- .../gen/Common/Resources/xlf/Strings.ko.xlf | 8 ++++---- .../gen/Common/Resources/xlf/Strings.pl.xlf | 8 ++++---- .../gen/Common/Resources/xlf/Strings.pt-BR.xlf | 8 ++++---- .../gen/Common/Resources/xlf/Strings.ru.xlf | 8 ++++---- .../gen/Common/Resources/xlf/Strings.tr.xlf | 8 ++++---- .../gen/Common/Resources/xlf/Strings.zh-Hans.xlf | 8 ++++---- .../gen/Common/Resources/xlf/Strings.zh-Hant.xlf | 8 ++++---- .../System.Text.Json/gen/Resources/xlf/Strings.cs.xlf | 4 ++-- .../System.Text.Json/gen/Resources/xlf/Strings.de.xlf | 4 ++-- .../System.Text.Json/gen/Resources/xlf/Strings.es.xlf | 4 ++-- .../System.Text.Json/gen/Resources/xlf/Strings.fr.xlf | 4 ++-- .../System.Text.Json/gen/Resources/xlf/Strings.it.xlf | 4 ++-- .../System.Text.Json/gen/Resources/xlf/Strings.ja.xlf | 4 ++-- .../System.Text.Json/gen/Resources/xlf/Strings.ko.xlf | 4 ++-- .../System.Text.Json/gen/Resources/xlf/Strings.pl.xlf | 4 ++-- .../System.Text.Json/gen/Resources/xlf/Strings.pt-BR.xlf | 4 ++-- .../System.Text.Json/gen/Resources/xlf/Strings.ru.xlf | 4 ++-- .../System.Text.Json/gen/Resources/xlf/Strings.tr.xlf | 4 ++-- .../gen/Resources/xlf/Strings.zh-Hans.xlf | 4 ++-- .../gen/Resources/xlf/Strings.zh-Hant.xlf | 4 ++-- .../gen/Resources/xlf/Strings.cs.xlf | 2 +- .../gen/Resources/xlf/Strings.de.xlf | 2 +- .../gen/Resources/xlf/Strings.es.xlf | 2 +- .../gen/Resources/xlf/Strings.fr.xlf | 2 +- .../gen/Resources/xlf/Strings.it.xlf | 2 +- .../gen/Resources/xlf/Strings.ja.xlf | 2 +- .../gen/Resources/xlf/Strings.ko.xlf | 2 +- .../gen/Resources/xlf/Strings.pl.xlf | 2 +- .../gen/Resources/xlf/Strings.pt-BR.xlf | 2 +- .../gen/Resources/xlf/Strings.ru.xlf | 2 +- .../gen/Resources/xlf/Strings.tr.xlf | 2 +- .../gen/Resources/xlf/Strings.zh-Hans.xlf | 2 +- .../gen/Resources/xlf/Strings.zh-Hant.xlf | 2 +- 65 files changed, 130 insertions(+), 130 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.cs.xlf b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.cs.xlf index 83051b0cb0f124..a9049c6c3a55db 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.cs.xlf +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.cs.xlf @@ -29,7 +29,7 @@ The project's language version has to be at least 'C# 12'. - The project's language version has to be at least 'C# 12'. + Jazyková verze projektu musí být alespoň C# 12 diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.de.xlf b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.de.xlf index 92e4c190e79164..6ab4079f505969 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.de.xlf +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.de.xlf @@ -29,7 +29,7 @@ The project's language version has to be at least 'C# 12'. - The project's language version has to be at least 'C# 12'. + Die Sprachversion des Projekts muss mindestens "C# 12" sein. diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.es.xlf b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.es.xlf index b8fe16411da300..c3256d3dd97673 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.es.xlf +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.es.xlf @@ -29,7 +29,7 @@ The project's language version has to be at least 'C# 12'. - The project's language version has to be at least 'C# 12'. + La versión del lenguaje del proyecto debe ser al menos "C# 12". diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.fr.xlf b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.fr.xlf index 2e3dd48653412c..34c8eff9842f1a 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.fr.xlf +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.fr.xlf @@ -29,7 +29,7 @@ The project's language version has to be at least 'C# 12'. - The project's language version has to be at least 'C# 12'. + La version de langage du projet doit être au moins « C# 12 ». diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.it.xlf b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.it.xlf index cb6ec6870fd296..a4edccfaeba916 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.it.xlf +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.it.xlf @@ -29,7 +29,7 @@ The project's language version has to be at least 'C# 12'. - The project's language version has to be at least 'C# 12'. + La versione del linguaggio del progetto deve essere almeno 'C# 12'. diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.ja.xlf b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.ja.xlf index b0666fc51b4f10..3fc756914150fb 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.ja.xlf +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.ja.xlf @@ -29,7 +29,7 @@ The project's language version has to be at least 'C# 12'. - The project's language version has to be at least 'C# 12'. + プロジェクトã®è¨€èªžãƒãƒ¼ã‚¸ãƒ§ãƒ³ã¯å°‘ãªãã¨ã‚‚ 'C# 12' ã§ã‚ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚ diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.ko.xlf b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.ko.xlf index 27b46b186c4d34..e5fac78816501d 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.ko.xlf +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.ko.xlf @@ -29,7 +29,7 @@ The project's language version has to be at least 'C# 12'. - The project's language version has to be at least 'C# 12'. + 프로ì íŠ¸ì˜ ì–¸ì–´ ë²„ì „ì€ 'C# 12' ì´ìƒì´ì–´ì•¼ 합니다. diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.pl.xlf b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.pl.xlf index f5dbcf57ca1b0a..a3bfda7961accf 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.pl.xlf @@ -29,7 +29,7 @@ The project's language version has to be at least 'C# 12'. - The project's language version has to be at least 'C# 12'. + Wersja jÄ™zykowa projektu musi mieć wartość co najmniej „C# 12â€. diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.pt-BR.xlf b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.pt-BR.xlf index d49640a054faf1..9ae94770e0876a 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.pt-BR.xlf +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.pt-BR.xlf @@ -29,7 +29,7 @@ The project's language version has to be at least 'C# 12'. - The project's language version has to be at least 'C# 12'. + A versão da linguagem do projeto deve ser no mínimo 'C# 12'. diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.ru.xlf b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.ru.xlf index d7600b0e8508f4..ac093757f66aca 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.ru.xlf +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.ru.xlf @@ -29,7 +29,7 @@ The project's language version has to be at least 'C# 12'. - The project's language version has to be at least 'C# 12'. + ВерÑÐ¸Ñ Ñзыка проекта должна быть не ниже "C# 12". diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.tr.xlf b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.tr.xlf index 68c9338e78121f..6cd1157d71daf3 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.tr.xlf +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.tr.xlf @@ -29,7 +29,7 @@ The project's language version has to be at least 'C# 12'. - The project's language version has to be at least 'C# 12'. + Projenin dil sürümü en az 'C# 12' olmalıdır. diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.zh-Hans.xlf b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.zh-Hans.xlf index 019385b2ce2192..fe5aac5bf4505b 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.zh-Hans.xlf @@ -29,7 +29,7 @@ The project's language version has to be at least 'C# 12'. - The project's language version has to be at least 'C# 12'. + 项目的语言版本必须至少为 "C# 12"。 diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.zh-Hant.xlf b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.zh-Hant.xlf index 3e4d3549b316f0..5ce4ed9a5d76ce 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Resources/xlf/Strings.zh-Hant.xlf @@ -29,7 +29,7 @@ The project's language version has to be at least 'C# 12'. - The project's language version has to be at least 'C# 12'. + 專案的語言版本必須至少為 'C# 12'。 diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.cs.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.cs.xlf index eb8dd19b8c71a1..db9efa93236cc2 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.cs.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.cs.xlf @@ -134,12 +134,12 @@ Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use - Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use + Třída {0} má parametr primárního konstruktoru typu Microsoft.Extensions.Logging.ILogger, který je skrytý polem ve třídÄ› nebo základní třídÄ›, což brání jeho použití. {Locked="Microsoft.Extensions.Logging.ILogger"} Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field - Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field + Parametr primárního konstruktoru typu Microsoft.Extensions.Logging.ILogger je skrytý polem. {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.de.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.de.xlf index b508628ac5ec47..1a557ac1669fcd 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.de.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.de.xlf @@ -134,12 +134,12 @@ Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use - Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use + Die Klasse „{0}“ weist einen primären Konstruktorparameter vom Typ „Microsoft.Extensions.Logging.ILogger“ auf, der von einem Feld in der Klasse oder einer Basisklasse ausgeblendet wird, wodurch die Verwendung verhindert wird. {Locked="Microsoft.Extensions.Logging.ILogger"} Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field - Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field + Der primäre Konstruktorparameter vom Typ „Microsoft.Extensions.Logging.ILogger“ wird durch ein Feld ausgeblendet. {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.es.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.es.xlf index fd199f459d96aa..c67ec41ff91cc8 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.es.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.es.xlf @@ -134,12 +134,12 @@ Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use - Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use + La clase '{0}' tiene un parámetro de constructor principal de tipo Microsoft.Extensions.Logging.ILogger oculto por un campo de la clase o una clase base, lo que impide su uso {Locked="Microsoft.Extensions.Logging.ILogger"} Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field - Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field + Un campo oculta el parámetro de constructor principal de tipo Microsoft.Extensions.Logging.ILogger {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.fr.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.fr.xlf index ac019c9dabf7c9..bb73608d9d0382 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.fr.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.fr.xlf @@ -134,12 +134,12 @@ Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use - Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use + La classe « ’{0} » a un paramètre de constructeur principal de type Microsoft.Extensions.Logging.ILogger qui est masqué par un champ de la classe ou une classe de base, ce qui empêche son utilisation {Locked="Microsoft.Extensions.Logging.ILogger"} Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field - Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field + Le paramètre de constructeur principal de type Microsoft.Extensions.Logging.ILogger est masqué par un champ {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.it.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.it.xlf index dc2f02184e1b60..d4bd8eb5a895c3 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.it.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.it.xlf @@ -134,12 +134,12 @@ Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use - Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use + La classe '{0}' ha un parametro del costruttore primario di tipo Microsoft.Extensions.Logging.ILogger nascosto da un campo nella classe o una classe di base, impedendone l'uso {Locked="Microsoft.Extensions.Logging.ILogger"} Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field - Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field + Il parametro del costruttore primario di tipo Microsoft.Extensions.Logging.ILogger è nascosto da un campo {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ja.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ja.xlf index 3f0127050182cb..1f19c136e50db5 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ja.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ja.xlf @@ -134,12 +134,12 @@ Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use - Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use + クラス '{0}' ã«ã¯ã€ã‚¯ãƒ©ã‚¹ã¾ãŸã¯åŸºæœ¬ã‚¯ãƒ©ã‚¹ã®ãƒ•ィールドã«ã‚ˆã£ã¦éžè¡¨ç¤ºã«ãªã£ã¦ã„ã‚‹åž‹ Microsoft.Extensions.Logging.ILogger ã®ãƒ—ライマリ コンストラクター パラメーターãŒã‚ã‚‹ãŸã‚ã€ä½¿ç”¨ã§ãã¾ã›ã‚“ {Locked="Microsoft.Extensions.Logging.ILogger"} Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field - Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field + åž‹ Microsoft.Extensions.Logging.ILogger ã®ãƒ—ライマリ コンストラクター パラメーターã¯ãƒ•ィールドã«ã‚ˆã£ã¦éžè¡¨ç¤ºã«ãªã£ã¦ã„ã¾ã™ {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ko.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ko.xlf index 5bb9507b8591c1..94a4654cf41a68 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ko.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ko.xlf @@ -134,12 +134,12 @@ Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use - Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use + í´ëž˜ìФ '{0}'ì—는 í´ëž˜ìФ ë˜ëŠ” 기본 í´ëž˜ìŠ¤ì˜ í•„ë“œì— ì˜í•´ 숨겨진 Microsoft.Extensions.Logging.ILogger 형ì‹ì˜ 기본 ìƒì„±ìž 매개 변수가 있으므로 해당 매개 변수를 사용할 수 없습니다. {Locked="Microsoft.Extensions.Logging.ILogger"} Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field - Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field + í•„ë“œì— ì˜í•´ Microsoft.Extensions.Logging.ILogger 형ì‹ì˜ 기본 ìƒì„±ìž 매개 변수가 숨겨집니다. {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pl.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pl.xlf index 0c014dd5317e0e..48dcc267ff34f2 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pl.xlf @@ -134,12 +134,12 @@ Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use - Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use + Klasa „{0}†ma podstawowy parametr konstruktora typu Microsoft.Extensions.Logging.ILogger, który jest ukryty przez pole w klasie lub klasie podstawowej, co uniemożliwia jego użycie. {Locked="Microsoft.Extensions.Logging.ILogger"} Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field - Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field + Parametr podstawowy konstruktora typu Microsoft.Extensions.Logging.ILogger jest ukryty przez pole {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pt-BR.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pt-BR.xlf index 6a4a35d1acc52b..c698b2fc61d947 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pt-BR.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.pt-BR.xlf @@ -134,12 +134,12 @@ Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use - Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use + A classe "{0}" tem um parâmetro de construtor primário do tipo Microsoft.Extensions.Logging.ILogger que está oculto por um campo na classe ou uma classe base, impedindo o seu uso {Locked="Microsoft.Extensions.Logging.ILogger"} Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field - Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field + O parâmetro primário de construtor do tipo Microsoft.Extensions.Logging.ILogger está oculto por um campo {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ru.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ru.xlf index 053970d8886038..4e59b9fd9b04a5 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ru.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.ru.xlf @@ -134,12 +134,12 @@ Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use - Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use + КлаÑÑ "{0}" имеет первичный параметр конÑтруктора типа Microsoft.Extensions.Logging.ILogger который Ñкрыт полем в Ñтом клаÑÑе или базовом клаÑÑе, что препÑÑ‚Ñтвует его иÑпользованию {Locked="Microsoft.Extensions.Logging.ILogger"} Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field - Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field + Параметр оÑновного конÑтруктора типа Microsoft.Extensions.Logging.ILogger Ñкрыт полем {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.tr.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.tr.xlf index 03f094a1607380..b92fc16b8c2aba 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.tr.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.tr.xlf @@ -134,12 +134,12 @@ Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use - Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use + '{0}' sınıfı, sınıf veya temel sınıf alanı tarafından gizlenen ve bu türün kullanımına engel olan Microsoft.Extensions.Logging.ILogger türünde birincil oluÅŸturucu parametresine sahip {Locked="Microsoft.Extensions.Logging.ILogger"} Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field - Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field + Microsoft.Extensions.Logging.ILogger türündeki birincil oluÅŸturucu parametresi bir alan tarafından gizleniyor {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hans.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hans.xlf index 2217d0a4cc9887..6f70cbcdd9b34e 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hans.xlf @@ -134,12 +134,12 @@ Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use - Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use + 类“{0}â€å…·æœ‰ Microsoft.Extensions.Logging.ILogger ç±»åž‹çš„ä¸»æž„é€ å‡½æ•°å‚æ•°ï¼Œè¯¥å‚数被类或基类中的字段éšè—以防使用 {Locked="Microsoft.Extensions.Logging.ILogger"} Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field - Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field + Microsoft.Extensions.Logging.ILogger ç±»åž‹çš„ä¸»æž„é€ å‡½æ•°å‚æ•°è¢«å­—段éšè— {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hant.xlf b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hant.xlf index 6044c601d92513..810bdfe157fede 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/gen/Resources/xlf/Strings.zh-Hant.xlf @@ -134,12 +134,12 @@ Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use - Class '{0}' has a primary constructor parameter of type Microsoft.Extensions.Logging.ILogger that is hidden by a field in the class or a base class, preventing its use + 類別 '{0}' 具有類型 Microsoft.Extensions.Logging.ILogger 的主è¦å»ºæ§‹å‡½å¼åƒæ•¸ï¼Œå…¶å·²ç”±é¡žåˆ¥æˆ–基底類別中的欄ä½éš±è—,因此無法使用 {Locked="Microsoft.Extensions.Logging.ILogger"} Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field - Primary constructor parameter of type Microsoft.Extensions.Logging.ILogger is hidden by a field + 類型 Microsoft.Extensions.Logging.ILogger 的主è¦å»ºæ§‹å‡½å¼åƒæ•¸ç”±æŸæ¬„ä½éš±è— {Locked="Microsoft.Extensions.Logging.ILogger"} diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf index a27704743998bb..08e92ac26a5c47 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf @@ -9,7 +9,7 @@ This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. - This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. + Tento typ implementuje minimálnÄ› jeden typ s atributem GeneratedComInterfaceAttribute nebo má jeho základní typ atribut GeneratedComClassAttribute. PÅ™idejte generatedComClassAttribute, aby bylo možné pÅ™edat tento typ modelu COM a zpřístupnit rozhraní COM pro typy s atributem GeneratedComClassAttribute z objektů tohoto typu. @@ -69,12 +69,12 @@ The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios - The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios + Typ {0} má základní rozhraní {1} definované v jiném sestavení. To může v nÄ›kterých případech způsobit Å™adu obtížnÄ› diagnostikovatelných problémů. Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported - Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported + Zadání atributu GeneratedComInterfaceAttribute u rozhraní, které má základní rozhraní definované v jiném sestavení, není podporováno. @@ -504,7 +504,7 @@ Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. - Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. + Objekty zaÅ™azené z VARIANT jako parametry in ve voláních nespravovaných na spravované nebudou šířit zpÄ›t aktualizovaný výsledek, a to ani v případÄ›, že VARIANT je varianta VT_BYREF. K šíření aktualizované hodnoty zpÄ›t k volajícímu použijte místo parametru in parametr ref. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.de.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.de.xlf index 05b494628443e6..787fa64fdcc10d 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.de.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.de.xlf @@ -9,7 +9,7 @@ This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. - This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. + Dieser Typ implementiert mindestens einen Typ mit dem GeneratedComInterfaceAttribute-Attribut, oder sein Basistyp weist das GeneratedComClassAttribute-Attribut auf. Fügen Sie „GeneratedComClassAttribute“ hinzu, um die Übergabe dieses Typs an COM zu ermöglichen und die COM-Schnittstellen für die Typen mit dem „GeneratedComInterfaceAttribute“ aus Objekten dieses Typs verfügbar zu machen. @@ -69,12 +69,12 @@ The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios - The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios + Für den Typ „{0}“ ist eine Basisschnittstelle „{1}“ in einer anderen Assembly definiert. Dies kann in einigen Szenarien eine Vielzahl von Problemen verursachen, die schwer zu diagnostizieren sind. Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported - Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported + Das Angeben von „GeneratedComInterfaceAttribute“ für eine Schnittstelle mit einer in einer anderen Assembly definierten Basisschnittstelle wird nicht unterstützt. @@ -504,7 +504,7 @@ Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. - Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. + Objekte, die aus VARIANTEN als in-Parameter in nicht verwalteten Aufrufen gemarshallt werden, werden nicht an das aktualisierte Ergebnis verteilt, auch wenn VARIANTE eine VT_BYREF-Variante ist. Verwenden Sie einen ref-Parameter anstelle eines in-Parameters, um den aktualisierten Wert wieder an den Aufrufer zu übergeben. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.es.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.es.xlf index 58a124e36da262..40fe7056997fcc 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.es.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.es.xlf @@ -9,7 +9,7 @@ This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. - This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. + Este tipo implementa al menos un tipo con el atributo 'GeneratedComInterfaceAttribute' o su tipo base tiene el atributo 'GeneratedComClassAttribute'. Agregue 'GeneratedComClassAttribute' para habilitar el paso de este tipo a COM y exponer las interfaces COM para los tipos con 'GeneratedComInterfaceAttribute' a partir de objetos de este tipo. @@ -69,12 +69,12 @@ The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios - The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios + El tipo '{0}' tiene una interfaz base '{1}' definida en un ensamblado diferente. Esto puede causar diversos problemas difíciles de diagnosticar en algunos escenarios. Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported - Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported + No se admite especificar 'GeneratedComInterfaceAttribute' en una interfaz que tenga una interfaz base definida en otro ensamblado @@ -504,7 +504,7 @@ Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. - Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. + Los objetos serializados a partir de VARIANTES como parámetros 'in' en llamadas no administradas a administradas no propagarán el resultado actualizado, incluso si VARIANTE es una variante VT_BYREF. Use un parámetro 'ref' en lugar de un parámetro 'in' para volver a propagar el valor actualizado al llamador. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.fr.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.fr.xlf index c0bdf3dcb16ad8..8fdb9e66b2f816 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.fr.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.fr.xlf @@ -9,7 +9,7 @@ This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. - This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. + Ce type implémente au moins un type avec l’attribut « GeneratedComInterfaceAttribute » ou son type de base a l’attribut « GeneratedComClassAttribute ». Ajoutez le « GeneratedComClassAttribute » pour activer le passage de ce type à COM et exposer les interfaces COM pour les types avec le « GeneratedComInterfaceAttribute » des objets de ce type. @@ -69,12 +69,12 @@ The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios - The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios + Le type « {0} » a une interface de base « {1} » définie dans un autre assembly. Cela peut entraîner de nombreux problèmes difficiles à diagnostiquer dans certains scénarios Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported - Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported + La spécification de ’GeneratedComInterfaceAttribute’ sur une interface pour laquelle une interface de base est définie dans un autre assembly n’est pas prise en charge @@ -504,7 +504,7 @@ Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. - Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. + Les objets marshallés à partir de VARIANT en tant que paramètres « in » dans les appels non gérés à gérés ne propageront pas le résultat mis à jour, même si le VARIANT est une variante de VT_BYREF. Utilisez un paramètre « ref » au lieu d’un paramètre « in » pour propager la valeur mise à jour à l’appelant. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.it.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.it.xlf index 9c152bcfa03c39..2a5f152ed18c65 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.it.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.it.xlf @@ -9,7 +9,7 @@ This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. - This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. + Questo tipo implementa almeno un tipo con l'attributo 'GeneratedComInterfaceAttribute' o il relativo tipo di base ha l'attributo 'GeneratedComClassAttribute'. Aggiungere l’attributo 'GeneratedComClassAttribute' per consentire il passaggio di questo tipo a COM e l'esposizione delle interfacce COM per i tipi con l’attributo 'GeneratedComInterfaceAttribute' dagli oggetti di questo tipo. @@ -69,12 +69,12 @@ The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios - The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios + Il tipo '{0}' ha un'interfaccia di base '{1}' definita in un assembly diverso. Ciò può causare una vasta gamma di problemi difficili da diagnosticare in alcuni scenari Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported - Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported + La specifica dell’attributo 'GeneratedComInterfaceAttribute' in un'interfaccia che ha un'interfaccia di base definita in un altro assembly non è supportata @@ -504,7 +504,7 @@ Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. - Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. + Gli oggetti di cui è stato eseguito il marshalling da VARIANT come parametri 'in' nelle chiamate da non gestito a gestito non verranno propagati nuovamente al risultato aggiornato, anche se VARIANT è una variante VT_BYREF. Usare un parametro 'ref' invece di un parametro 'in' per propagare nuovamente il valore aggiornato al chiamante. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ja.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ja.xlf index e4e5b7e0bd1ebd..999325fdc4e6b4 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ja.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ja.xlf @@ -9,7 +9,7 @@ This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. - This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. + ã“ã®åž‹ã¯ã€'GeneratedComInterfaceAttribute' 属性をæŒã¤å°‘ãªãã¨ã‚‚ 1 ã¤ã®åž‹ã‚’実装ã—ã¾ã™ã€‚ã¾ãŸã¯ãã®åŸºæœ¬åž‹ã« 'GeneratedComClassAttribute' 属性ãŒã‚りã¾ã™ã€‚'GeneratedComClassAttribute' を追加ã—ã¦ã€ã“ã®åž‹ã‚’ COM ã«æ¸¡ã—ã€ã“ã®åž‹ã®ã‚ªãƒ–ジェクトã‹ã‚‰ 'GeneratedComInterfaceAttribute' ã‚’æŒã¤åž‹ã® COM インターフェイスを公開ã§ãるよã†ã«ã—ã¾ã™ã€‚ @@ -69,12 +69,12 @@ The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios - The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios + åž‹ '{0}' ã«ã¯ã€åˆ¥ã®ã‚¢ã‚»ãƒ³ãƒ–リã§å®šç¾©ã•れã¦ã„る基本インターフェイス '{1}' ãŒã‚りã¾ã™ã€‚ã“れã«ã‚ˆã‚Šã€ä¸€éƒ¨ã®ã‚·ãƒŠãƒªã‚ªã§å•題を診断ã™ã‚‹ã“ã¨ãŒå›°é›£ã«ãªã‚‹ã•ã¾ã–ã¾ãªå¯èƒ½æ€§ãŒã‚りã¾ã™ Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported - Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported + 別ã®ã‚¢ã‚»ãƒ³ãƒ–リã§å®šç¾©ã•れã¦ã„る基本インターフェイスをæŒã¤ã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ェイス㧠'GeneratedComInterfaceAttribute' を指定ã™ã‚‹ã“ã¨ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“ @@ -504,7 +504,7 @@ Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. - Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. + アンマãƒãƒ¼ã‚¸ã‹ã‚‰ãƒžãƒãƒ¼ã‚¸ãƒ‰ã¸ã®å‘¼ã³å‡ºã—ã§ VARIANT ã‹ã‚‰ 'in' パラメーターã¨ã—ã¦ãƒžãƒ¼ã‚·ãƒ£ãƒªãƒ³ã‚°ã•れãŸã‚ªãƒ–ジェクトã¯ã€VARIANT ㌠VT_BYREF ãƒãƒªã‚¢ãƒ³ãƒˆã§ã‚ã£ã¦ã‚‚ã€æ›´æ–°ã•れãŸçµæžœã«å映ã•れã¾ã›ã‚“。更新ã•れãŸå€¤ã‚’呼ã³å‡ºã—å…ƒã«å映ã™ã‚‹ã«ã¯ã€'in' パラメーターã®ä»£ã‚り㫠'ref' パラメーターを使用ã—ã¦ãã ã•ã„。 diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ko.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ko.xlf index b5c19585d13f59..10f9cf84afe3ab 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ko.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ko.xlf @@ -9,7 +9,7 @@ This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. - This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. + ì´ ìœ í˜•ì€ 'GeneratedComInterfaceAttribute' íŠ¹ì„±ì„ ê°–ëŠ” 하나 ì´ìƒì˜ ìœ í˜•ì„ êµ¬í˜„í•˜ê±°ë‚˜ 기본 ìœ í˜•ì— 'GeneratedComClassAttribute' íŠ¹ì„±ì´ ìžˆìŠµë‹ˆë‹¤. 'GeneratedComClassAttribute'를 추가하여 ì´ ìœ í˜•ì„ COMì— ì „ë‹¬í•˜ê³  ì´ ìœ í˜•ì˜ ê°œì²´ì—서 'GeneratedComInterfaceAttribute'ê°€ 있는 ìœ í˜•ì— ëŒ€í•´ COM ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 노출할 수 있ë„ë¡ í•©ë‹ˆë‹¤. @@ -69,12 +69,12 @@ The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios - The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios + '{0}' ìœ í˜•ì— ë‹¤ë¥¸ 어셈블리ì—서 ì •ì˜ëœ 기본 ì¸í„°íŽ˜ì´ìФ '{1}'ì´(ê°€) 있습니다. ì¼ë¶€ 시나리오ì—서는 ì´ë¡œ ì¸í•´ 진단하기 어려운 다양한 문제가 ë°œìƒí•  수 있습니다. Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported - Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported + 다른 ì–´ì…ˆë¸”ë¦¬ì— ì •ì˜ëœ 기본 ì¸í„°íŽ˜ì´ìŠ¤ê°€ 있는 ì¸í„°íŽ˜ì´ìФì—서 'GeneratedComInterfaceAttribute'를 지정하는 ê²ƒì€ ì§€ì›ë˜ì§€ 않습니다. @@ -504,7 +504,7 @@ Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. - Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. + 관리ë˜ì§€ 않는 호출ì—서 관리ë˜ëŠ” í˜¸ì¶œë¡œì˜ VARIANTì—서 'in' 매개 변수로 마샬ë§ëœ 개체는 VARIANTê°€ VT_BYREF ë³€í˜•ì¸ ê²½ìš°ì—ë„ ì—…ë°ì´íŠ¸ëœ ê²°ê³¼ë¥¼ 다시 전파하지 않습니다. 'in' 매개 변수 대신 'ref' 매개 변수를 사용하여 ì—…ë°ì´íŠ¸ëœ ê°’ì„ í˜¸ì¶œìžì—게 다시 전파합니다. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf index 2405d7a821b9a9..55c27cde0e5387 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf @@ -9,7 +9,7 @@ This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. - This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. + Ten typ implementuje co najmniej jeden typ z atrybutem „GeneratedComInterfaceAttribute†lub jego typ podstawowy ma atrybut „GeneratedComClassAttributeâ€. Dodaj atrybut „GeneratedComClassAttributeâ€, aby umożliwić przekazywanie tego typu do modelu COM i uwidacznianie interfejsów COM dla typów z atrybutem „GeneratedComInterfaceAttribute†z obiektów tego typu. @@ -69,12 +69,12 @@ The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios - The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios + Typ „{0}†ma interfejs podstawowy „{1}†zdefiniowany w innym zestawie. Może to powodować różne trudne do zdiagnozowania problemy w niektórych scenariuszach Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported - Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported + OkreÅ›lanie atrybutu „GeneratedComInterfaceAttribute†dla interfejsu, który ma interfejs podstawowy zdefiniowany w innym zespole, nie jest obsÅ‚ugiwane @@ -504,7 +504,7 @@ Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. - Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. + Obiekty przekazywane z obiektów VARIANT jako parametry „w†w wywoÅ‚aniach niezarzÄ…dzanych do zarzÄ…dzanych nie bÄ™dÄ… propagować z powrotem zaktualizowanego wyniku, nawet jeÅ›li parametr VARIANT jest wariantem VT_BYREF. Użyj parametru „ref†zamiast parametru „wâ€, aby propagować zaktualizowanÄ… wartość z powrotem do obiektu wywoÅ‚ujÄ…cego. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pt-BR.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pt-BR.xlf index e1969dc8b8ab50..9446ca11ff9b27 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pt-BR.xlf @@ -9,7 +9,7 @@ This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. - This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. + Este tipo implementa pelo menos um tipo com o atributo "GeneratedComInterfaceAttribute" ou o seu tipo base tem o atributo "GeneratedComClassAttribute". Adicione o 'GeneratedComClassAttribute' para habilitar a passagem desse tipo para COM e expor as interfaces COM para os tipos com o 'GeneratedComInterfaceAttribute' de objetos desse tipo. @@ -69,12 +69,12 @@ The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios - The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios + O tipo "{0}" tem uma interface base "{1}" definida em um assembly diferente. Isso pode causar uma variedade de problemas difíceis de diagnosticar em alguns cenários Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported - Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported + Não há suporte para a especificação de "GeneratedComInterfaceAttribute" em uma interface que tem uma interface base definida em outro assembly @@ -504,7 +504,7 @@ Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. - Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. + Objetos marshalled de VARIANTs como parâmetros "in" em chamadas não gerenciadas para gerenciadas não propagam de volta o resultado atualizado, mesmo que VARIANT seja uma variante VT_BYREF. Use um parâmetro "ref" em vez de um parâmetro "in" para propagar o valor atualizado de volta para o chamador. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ru.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ru.xlf index d98f485c3e77a7..394a0e09d2a127 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ru.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ru.xlf @@ -9,7 +9,7 @@ This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. - This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. + Этот тип реализует по крайней мере один тип Ñ Ð°Ñ‚Ñ€Ð¸Ð±ÑƒÑ‚Ð¾Ð¼ "GeneratedComInterfaceAttribute", или его базовый тип Ñодержит атрибут "GeneratedComClassAttribute". Добавьте "GeneratedComClassAttribute", чтобы разрешить передачу Ñтого типа в COM и предоÑтавление COM-интерфейÑов Ð´Ð»Ñ Ñ‚Ð¸Ð¿Ð¾Ð² Ñ "GeneratedComInterfaceAttribute" из объектов Ñтого типа. @@ -69,12 +69,12 @@ The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios - The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios + Тип "{0}" иÑпользует базовый Ð¸Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñ "{1}", определенный в другой Ñборке. Это может вызвать множеÑтво ÑложноÑтей при диагноÑтике проблем в некоторых ÑценариÑÑ… Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported - Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported + Указание "GeneratedComInterfaceAttribute" в интерфейÑе, Ð´Ð»Ñ ÐºÐ¾Ñ‚Ð¾Ñ€Ð¾Ð³Ð¾ базовый Ð¸Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñ Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½ в другой Ñборке, не поддерживаетÑÑ @@ -504,7 +504,7 @@ Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. - Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. + Объекты, маршалированные из VARIANT в качеÑтве параметров "in" в вызовах Ñ Ð¿ÐµÑ€ÐµÑ…Ð¾Ð´Ð¾Ð¼ от неуправлÑемых к управлÑемым, не будут раÑпроÑтранÑтьÑÑ Ð¾Ð±Ñ€Ð°Ñ‚Ð½Ð¾ на обновленный результат, даже еÑли VARIANT ÑвлÑетÑÑ Ð²Ð°Ñ€Ð¸Ð°Ð½Ñ‚Ð¾Ð¼ VT_BYREF. ИÑпользуйте параметр "ref" вмеÑто параметра "in", чтобы раÑпроÑтранить обновленное значение обратно на вызывающую Ñторону. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.tr.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.tr.xlf index cb79284da8216f..6d7c166203d76d 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.tr.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.tr.xlf @@ -9,7 +9,7 @@ This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. - This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. + Bu tür, 'GeneratedComInterfaceAttribute' özniteliÄŸine sahip en az bir türü uygular veya temel türü 'GeneratedComClassAttribute' özniteliÄŸine sahiptir. Bu türü COM'a geçirmeyi ve bu türdeki nesnelerden 'GeneratedComInterfaceAttribute' içeren türler için COM arabirimlerini açığa çıkarmayı etkinleÅŸtirmek için 'GeneratedComClassAttribute' ekleyin. @@ -69,12 +69,12 @@ The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios - The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios + '{0}' tipinin farklı bir derlemede tanımlanmış bir temel arayüzü '{1}' vardır. Bu, bazı senaryolarda tanılaması zor çeÅŸitli sorunlara neden olabilir Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported - Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported + BaÅŸka bir bütünleÅŸtirilmiÅŸ kodda tanımlanmış bir temel arabirime sahip arabirimde 'GeneratedComInterfaceAttribute' belirtilmesi desteklenmez @@ -504,7 +504,7 @@ Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. - Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. + Yönetilmeyenden yönetilene yapılan çaÄŸrılarda 'in' parametresi olarak kullanılan VARIANT'lardan hazırlanma iÅŸlemiyle elde edilen nesneler, VARIANT çeÅŸidi VT_BYREF olsa bile güncelleÅŸtirilmiÅŸ sonucu geri yaymaz. GüncelleÅŸtirilmiÅŸ deÄŸeri çağırana geri yayma için 'in' parametresi yerine bir 'ref' parametresi kullanın. diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hans.xlf index bfaa9c0b22c78d..2df445d4f9feba 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -9,7 +9,7 @@ This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. - This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. + 此类型至少实现了一ç§å…·æœ‰ 'GeneratedComInterfaceAttribute' 属性的类型,或其基本类型具有 'GeneratedComClassAttribute' 属性。添加 'GeneratedComClassAttribute' 以å…许将此类型传递到 COM,并公开具有此类型的对象的 'GeneratedComInterfaceAttribute' 的类型的 COM 接å£ã€‚ @@ -69,12 +69,12 @@ The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios - The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios + 类型“{0}â€å…·æœ‰åœ¨å…¶ä»–程åºé›†ä¸­å®šä¹‰çš„基接å£â€œ{1}â€ã€‚在æŸäº›æƒ…况下,å¯èƒ½ä¼šå¯¼è‡´å„ç§éš¾ä»¥è¯Šæ–­é—®é¢˜ Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported - Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported + 䏿”¯æŒåœ¨å¦ä¸€ä¸ªè¿›ç¨‹é›†ä¸­å®šä¹‰äº†åŸºç¡€æŽ¥å£çš„æŽ¥å£ä¸ŠæŒ‡å®š 'GeneratedComInterfaceAttribute' @@ -504,7 +504,7 @@ Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. - Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. + åœ¨éžæ‰˜ç®¡åˆ°æ‰˜ç®¡è°ƒç”¨ä¸­ä»Ž VARIANT å°é€ä¸ºâ€œinâ€å‚数的对象ä¸ä¼šä¼ å›žæ›´æ–°åŽçš„结果,å³ä½¿ VARIANT 是 VT_BYREF å˜é‡ä¹Ÿæ˜¯å¦‚此。使用 "ref "傿•°ä»£æ›¿ "in "傿•°ï¼Œå°†æ›´æ–°åŽçš„值传回调用方。 diff --git a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hant.xlf index c8880476fda354..07248b19e3e7e5 100644 --- a/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -9,7 +9,7 @@ This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. - This type implements at least one type with the 'GeneratedComInterfaceAttribute' attribute or its base type has the 'GeneratedComClassAttribute' attribute. Add the 'GeneratedComClassAttribute' to enable passing this type to COM and exposing the COM interfaces for the types with the 'GeneratedComInterfaceAttribute' from objects of this type. + 此類型會實作至少一個類型,具有 'GeneratedComInterfaceAttribute' 屬性或其基底類型有 'GeneratedComClassAttribute' 屬性。新增 'GeneratedComClassAttribute' 以啟用將此類型傳éžåˆ° COM,並公開具有此類型物件之 'GeneratedComInterfaceAttribute' 類型的 COM 介é¢ã€‚ @@ -69,12 +69,12 @@ The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios - The type '{0}' has a base interface '{1}' defined in a different assembly. This can cause a variety of difficult to diagnose issues in some scenarios + 類型 '{0}' 已有在ä¸åŒçµ„ä»¶ä¸­å®šç¾©çš„åŸºç¤Žä»‹é¢ '{1}'。在æŸäº›æƒ…æ³ä¸‹ï¼Œé€™å¯èƒ½æœƒé€ æˆå„種難以診斷的å•題 Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported - Specifying 'GeneratedComInterfaceAttribute' on an interface that has a base interface defined in another assembly is not supported + 䏿”¯æ´åœ¨å·²æ–¼å¦ä¸€å€‹çµ„件中定義基礎介é¢çš„介é¢ä¸ŠæŒ‡å®š 'GeneratedComInterfaceAttribute' @@ -504,7 +504,7 @@ Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. - Objects marshalled from VARIANTs as 'in' parameters in unmanaged-to-managed calls will not propagate back the updated result, even if the VARIANT is a VT_BYREF variant. Use a 'ref' parameter instead of an 'in' parameter to propagate the updated value back to the caller. + åœ¨æœªå—æŽ§å°å—控呼å«ä¸­ï¼Œå¾ž VARIANT å°é€è™•ç†ç‚º 'in' åƒæ•¸çš„ç‰©ä»¶å°‡ä¸æœƒå‚³æ’­å›žæ›´æ–°çš„çµæžœï¼Œå³ä½¿ VARIANT 是 VT_BYREF 變數亦然。使用 'ref' åƒæ•¸è€Œéž 'in' åƒæ•¸ï¼Œä»¥å°‡æ›´æ–°çš„值傳播回呼å«è€…。 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 10a4b772a005d3..49ede1a3986cd0 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 @@ -144,12 +144,12 @@ The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. - The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. + Typ {0} zahrnuje ref-like parametr vlastnosti, pole nebo konstruktoru {1}. Pro vlastnost, pole nebo konstruktor se nevygeneruje žádný zdrojový kód. Type includes ref like property, field or constructor parameter. - Type includes ref like property, field or constructor parameter. + Typ zahrnuje ref-like parametr vlastnosti, pole nebo konstruktoru. 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 fbec6a988af348..35bfee5db3fbd9 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 @@ -144,12 +144,12 @@ The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. - The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. + Der Typ „{0}“ enthält die Verweise wie Eigenschaft, Feld oder Konstruktorparameter „{1}“. Für die Eigenschaft, das Feld oder den Konstruktor wird kein Quellcode generiert. Type includes ref like property, field or constructor parameter. - Type includes ref like property, field or constructor parameter. + Der Typ enthält Verweise wie Eigenschaft, Feld oder Konstruktorparameter. 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 068c218f73142f..3fdbb1b2f07fe5 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 @@ -144,12 +144,12 @@ The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. - The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. + El tipo "{0}" incluye una referencia como propiedad, campo o parámetro de constructor "{1}". No se generará código fuente para la propiedad, campo o constructor. Type includes ref like property, field or constructor parameter. - Type includes ref like property, field or constructor parameter. + El tipo incluye una referencia como propiedad, campo o parámetro de constructor. 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 7f22492403d44f..1704ce42aeb52d 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 @@ -144,12 +144,12 @@ The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. - The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. + Le type « {0} » inclut le ref comme propriété, champ ou paramètre de constructeur « {1} ». Aucun code source ne sera généré pour la propriété, le champ ou le constructeur. Type includes ref like property, field or constructor parameter. - Type includes ref like property, field or constructor parameter. + Le type comprend des éléments tels que des propriétés, des champs ou des paramètres de construction. 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 cae8ac97938d29..c44dbd4a4cc5fa 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 @@ -144,12 +144,12 @@ The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. - The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. + Il tipo '{0}' include un riferimento come la proprietà, il campo o il parametro del costruttore '{1}'. Non verrà generato codice sorgente per la proprietà, il campo o il costruttore. Type includes ref like property, field or constructor parameter. - Type includes ref like property, field or constructor parameter. + Il tipo include un riferimento come la proprietà, il campo o il parametro del costruttore. 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 1ddb45583e3a24..ef07d1387562b0 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 @@ -144,12 +144,12 @@ The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. - The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. + åž‹ '{0}' ã«ã¯ã€ãƒ—ロパティã€ãƒ•ィールドã€ã‚³ãƒ³ã‚¹ãƒˆãƒ©ã‚¯ã‚¿ãƒ¼ パラメーター '{1}' ãªã©ã® ref ãŒå«ã¾ã‚Œã¾ã™ã€‚プロパティã€ãƒ•ィールドã€ã¾ãŸã¯ã‚³ãƒ³ã‚¹ãƒˆãƒ©ã‚¯ã‚¿ãƒ¼ã®ã‚½ãƒ¼ã‚¹ コードã¯ç”Ÿæˆã•れã¾ã›ã‚“。 Type includes ref like property, field or constructor parameter. - Type includes ref like property, field or constructor parameter. + åž‹ã«ã¯ã€ãƒ—ロパティã€ãƒ•ィールドã€ã‚³ãƒ³ã‚¹ãƒˆãƒ©ã‚¯ã‚¿ãƒ¼ パラメーターãªã©ã® ref ãŒå«ã¾ã‚Œã¾ã™ã€‚ 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 0aa409cc9f661e..615789e0daae07 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 @@ -144,12 +144,12 @@ The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. - The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. + '{0}' 형ì‹ì—는 ì†ì„±, 필드 ë˜ëŠ” ìƒì„±ìž 매개 변수 '{1}'와 ê°™ì€ refê°€ í¬í•¨ë©ë‹ˆë‹¤. ì†ì„±, 필드 ë˜ëŠ” ìƒì„±ìžì— 대한 소스 코드가 ìƒì„±ë˜ì§€ 않습니다. Type includes ref like property, field or constructor parameter. - Type includes ref like property, field or constructor parameter. + 형ì‹ì—는 ì†ì„±, 필드 ë˜ëŠ” ìƒì„±ìž 매개 변수와 ê°™ì€ refê°€ í¬í•¨ë©ë‹ˆë‹¤. 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 c8eef43ef7debd..ef4fd7d87655c2 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 @@ -144,12 +144,12 @@ The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. - The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. + Typ „{0}†zawiera parametr ref, taki jak wÅ‚aÅ›ciwość, pole lub konstruktor „{1}â€. Nie zostanie wygenerowany kod źródÅ‚owy dla wÅ‚aÅ›ciwoÅ›ci, pola lub konstruktora. Type includes ref like property, field or constructor parameter. - Type includes ref like property, field or constructor parameter. + Typ zawiera parametr wÅ‚aÅ›ciwoÅ›ci, pola lub konstruktora typu ref. 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 d2ae1c3c28a8cc..3a76db6711dc19 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 @@ -144,12 +144,12 @@ The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. - The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. + O tipo "{0}" inclui a propriedade ref like, campo ou parâmetro de construtor "{1}". Nenhum código-fonte será gerado para a propriedade, campo ou construtor. Type includes ref like property, field or constructor parameter. - Type includes ref like property, field or constructor parameter. + O tipo inclui propriedade ref like, campo ou parâmetro de construtor. 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 ffc7012e2fbce4..b40f42392e4b98 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 @@ -144,12 +144,12 @@ The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. - The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. + Тип "{0}" Ñодержит ÑÑылку, например ÑвойÑтво, поле или параметр конÑтруктора "{1}". Ð”Ð»Ñ ÑвойÑтва, Ð¿Ð¾Ð»Ñ Ð¸Ð»Ð¸ конÑтруктора не будет Ñоздан иÑходный код. Type includes ref like property, field or constructor parameter. - Type includes ref like property, field or constructor parameter. + Тип Ñодержит ÑÑылку, например ÑвойÑтво, поле или параметр конÑтруктора. 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 2082f57da492c9..6c843de0282ff5 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 @@ -144,12 +144,12 @@ The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. - The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. + '{0}' türü; özellik, alan veya oluÅŸturucu parametresi '{1}' gibi baÅŸvuru içeriyor. Özellik, alan veya oluÅŸturucu için kaynak kodu üretilmeyecek. Type includes ref like property, field or constructor parameter. - Type includes ref like property, field or constructor parameter. + Tür; özellik, alan veya oluÅŸturucu parametresi gibi baÅŸvuru içeriyor. 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 34e4c4ff7c0f0c..b5b714c3d13d22 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 @@ -144,12 +144,12 @@ The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. - The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. + 类型“{0}â€åŒ…括属性ã€å­—æ®µæˆ–æž„é€ å‡½æ•°å‚æ•°â€œ{1}â€ç­‰å¼•用。ä¸ä¼šä¸ºå±žæ€§ã€å­—æ®µæˆ–æž„é€ å‡½æ•°ç”Ÿæˆæºä»£ç ã€‚ Type includes ref like property, field or constructor parameter. - Type includes ref like property, field or constructor parameter. + 类型包括属性ã€å­—æ®µæˆ–æž„é€ å‡½æ•°å‚æ•°ç­‰å¼•用。 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 64c1dca8a98695..ac3fd35f8414b6 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 @@ -144,12 +144,12 @@ The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. - The type '{0}' includes the ref like property, field or constructor parameter '{1}'. No source code will be generated for the property, field or constructor. + 類型 '{0}' åŒ…å« refï¼Œä¾‹å¦‚å±¬æ€§ã€æ¬„使ˆ–建構函å¼åƒæ•¸ '{1}'ã€‚ä¸æœƒé‡å°å±¬æ€§ã€æ¬„使ˆ–建構函å¼ç”¢ç”ŸåŽŸå§‹ç¨‹å¼ç¢¼ã€‚ Type includes ref like property, field or constructor parameter. - Type includes ref like property, field or constructor parameter. + é¡žåž‹åŒ…å« refï¼Œä¾‹å¦‚å±¬æ€§ã€æ¬„使ˆ–建構函å¼åƒæ•¸ã€‚ diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.cs.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.cs.xlf index 2e61d27f87bbe9..8e760ca35b1b2b 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.cs.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.cs.xlf @@ -194,7 +194,7 @@ GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. - GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. + Metoda nebo vlastnost GeneratedRegexAttribute musí být ÄásteÄná, bez parametrů, neobecná, neabstraktní a návratová metoda Regex. Pokud jde o vlastnost, musí být také get-only. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.de.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.de.xlf index a12e021643bf9b..100134d0071727 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.de.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.de.xlf @@ -194,7 +194,7 @@ GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. - GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. + Die GeneratedRegexAttribute-Methode oder -Eigenschaft muss partiell, parameterlos, nicht generisch, nicht abstrakt sein und RegEx zurückgeben. Wenn eine Eigenschaft, muss sie auch "get-only" sein. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.es.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.es.xlf index 238c1575abbdc2..d7c03679c8ab8e 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.es.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.es.xlf @@ -194,7 +194,7 @@ GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. - GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. + El método o la propiedad GeneratedRegexAttribute deben ser parciales, sin parámetros, no genéricos, no abstractos y devolver Regex. Si es una propiedad, también debe ser get-only. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.fr.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.fr.xlf index 018a3365524e66..b15715902c04da 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.fr.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.fr.xlf @@ -194,7 +194,7 @@ GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. - GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. + La méthode ou la propriété GeneratedRegexAttribute doit être partielle, sans paramètre, non générique, non abstraite et renvoyer Regex. S'il s'agit d'une propriété, elle doit également être accessible en mode « get-only ». diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.it.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.it.xlf index 88fe403103f6f5..4e358b5ac56da5 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.it.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.it.xlf @@ -194,7 +194,7 @@ GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. - GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. + Il metodo o la proprietà GeneratedRegexAttribute deve essere parziale, senza parametri, non generica, non astratta e restituire Regex. Se una proprietà, deve anche essere di sola lettura. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ja.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ja.xlf index d70376e4e91b01..0c1e4d8c8425cc 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ja.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ja.xlf @@ -194,7 +194,7 @@ GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. - GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. + GeneratedRegexAttribute メソッドã¾ãŸã¯ãƒ—ロパティã¯ã€éƒ¨åˆ†ã€ãƒ‘ラメーターãªã—ã€éžã‚¸ã‚§ãƒãƒªãƒƒã‚¯ã€éžæŠ½è±¡ã€ãŠã‚ˆã³æ­£è¦è¡¨ç¾ã‚’è¿”ã™å¿…è¦ãŒã‚りã¾ã™ã€‚プロパティã®å ´åˆã¯ã€å–得専用ã«ã™ã‚‹å¿…è¦ã‚‚ã‚りã¾ã™ã€‚ diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ko.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ko.xlf index 225d0046e35abd..7220be3cedff89 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ko.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ko.xlf @@ -194,7 +194,7 @@ GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. - GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. + GeneratedRegexAttribute 메서드 ë˜ëŠ” ì†ì„±ì€ 부분ì ì´ê³ , 매개 변수가 없고, ì œë„¤ë¦­ì´ ì•„ë‹ˆê³ , ì¶”ìƒì ì´ì§€ 않아야 하고, Regex를 반환해야 합니다. ì†ì„±ì¸ 경우 get ì „ìš©ì´ì–´ì•¼ 합니다. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pl.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pl.xlf index 6f17bf3567e4e9..3d89e74c1e9560 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pl.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pl.xlf @@ -194,7 +194,7 @@ GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. - GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. + Metoda lub wÅ‚aÅ›ciwość GeneratedRegexAttribute musi być częściowa, bezparametrowa, niegeneryczna, nieabstrakcyjna i zwracać wyrażenie regularne. JeÅ›li wÅ‚aÅ›ciwość, musi być również tylko do pobrania. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pt-BR.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pt-BR.xlf index a0d662d659b004..989368e8e2a424 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pt-BR.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.pt-BR.xlf @@ -194,7 +194,7 @@ GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. - GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. + O método ou a propriedade GeneratedRegexAttribute deve ser parcial, sem parâmetros, não genérico, não abstrato e retornar Regex. Se uma propriedade, ela também deve ser get-only. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ru.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ru.xlf index a1189794ac3f1f..c3aef678ed7a72 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ru.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.ru.xlf @@ -194,7 +194,7 @@ GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. - GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. + Метод или ÑвойÑтво GeneratedRegexAttribute должны быть чаÑтичными, без параметров, неуниверÑальными, неабÑтрактными и возвращать регулÑрное выражение. ЕÑли Ñто ÑвойÑтво, оно также должно быть доÑтупно только Ð´Ð»Ñ Ð¿Ð¾Ð»ÑƒÑ‡ÐµÐ½Ð¸Ñ. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.tr.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.tr.xlf index be0b3cc6c917fd..ca98e167e5847c 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.tr.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.tr.xlf @@ -194,7 +194,7 @@ GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. - GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. + GeneratedRegexAttribute yöntemi veya özelliÄŸi kısmi ve parametresiz olmalı, genel amaçlı ve soyut olmamalı ve Normal İfade döndürmelidir. Bir özellikse, aynı zamanda yalnızca okunabilir olmalıdır. diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hans.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hans.xlf index a93e213ce043d8..dba4ffd1f33afc 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hans.xlf @@ -194,7 +194,7 @@ GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. - GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. + GeneratedRegexAttribute æ–¹æ³•æˆ–å±žæ€§å¿…é¡»æ˜¯åˆ†éƒ¨ã€æ— å‚æ•°ã€éžæ³›åž‹ã€éžæŠ½è±¡ä¸”返回 Regex。如果是属性,则它必须也是 get-only 属性。 diff --git a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hant.xlf b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hant.xlf index 6e339af00b10ce..045632ce88b81f 100644 --- a/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/libraries/System.Text.RegularExpressions/gen/Resources/xlf/Strings.zh-Hant.xlf @@ -194,7 +194,7 @@ GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. - GeneratedRegexAttribute method or property must be partial, parameterless, non-generic, non-abstract, and return Regex. If a property, it must also be get-only. + GeneratedRegexAttribute 方法或屬性必須是部分ã€ç„¡åƒæ•¸ã€éžæ³›åž‹ã€éžæŠ½è±¡ï¼Œä¸¦å‚³å›ž Regex。如果是屬性,它也必須是 get-only。 From c192ae8bd860cfbed4755cadb0996c0b4b6e6808 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 10:23:45 -0700 Subject: [PATCH 088/748] [release/9.0] Update dependencies from dotnet/roslyn-analyzers (#107314) * Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20240821.1 Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers From Version 3.11.0-beta1.24415.1 -> To Version 3.11.0-beta1.24421.1 * Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20240829.1 Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers From Version 3.11.0-beta1.24421.1 -> To Version 3.11.0-beta1.24429.1 * Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20240825.2 Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers From Version 3.11.0-beta1.24429.1 -> To Version 3.11.0-beta1.24425.2 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 763aca271d8f7c..7a5ad733033890 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -368,13 +368,13 @@ https://github.com/dotnet/roslyn d30a570bb6c9b2f204db9e6ee65fc5316449fd4e - + https://github.com/dotnet/roslyn-analyzers - fdb9965ce68c1f4e1c0ff301488adf9caa958615 + 930872ad8817ff59fbb4454e79edf738904d173a - + https://github.com/dotnet/roslyn-analyzers - fdb9965ce68c1f4e1c0ff301488adf9caa958615 + 930872ad8817ff59fbb4454e79edf738904d173a diff --git a/eng/Versions.props b/eng/Versions.props index 2ba171e2f03a38..a39b54bc410089 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -34,8 +34,8 @@ - 3.11.0-beta1.24415.1 - 9.0.0-preview.24415.1 + 3.11.0-beta1.24425.2 + 9.0.0-preview.24425.2 - + https://github.com/dotnet/emsdk - 84d642485896a97e0e443be75345c6bb1469a338 + c136d56093029c7dc696fd9cc15a4381077390f4 diff --git a/eng/Versions.props b/eng/Versions.props index a39b54bc410089..3c93e3ead99f16 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -239,7 +239,7 @@ Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-9_0_100_Transport --> - 9.0.0-rc.2.24422.4 + 9.0.0-rc.2.24453.3 $(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion) 1.1.87-gba258badda From d02256fdf799097a9765ca2f225bd94e008c9dd9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 10:26:35 -0700 Subject: [PATCH 090/748] [release/9.0] Update dependencies from dotnet/arcade (#106923) * Update dependencies from https://github.com/dotnet/arcade build 20240823.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XliffTasks , Microsoft.DotNet.XUnitAssert , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 9.0.0-beta.24421.7 -> To Version 9.0.0-beta.24423.2 * Update dependencies from https://github.com/dotnet/arcade build 20240826.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XliffTasks , Microsoft.DotNet.XUnitAssert , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 9.0.0-beta.24423.2 -> To Version 9.0.0-beta.24426.3 * Update dependencies from https://github.com/dotnet/arcade build 20240829.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XliffTasks , Microsoft.DotNet.XUnitAssert , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 9.0.0-beta.24426.3 -> To Version 9.0.0-beta.24429.3 * Update dependencies from https://github.com/dotnet/arcade build 20240829.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XliffTasks , Microsoft.DotNet.XUnitAssert , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 9.0.0-beta.24429.3 -> To Version 9.0.0-beta.24429.5 * Update dependencies from https://github.com/dotnet/arcade build 20240903.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XliffTasks , Microsoft.DotNet.XUnitAssert , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 9.0.0-beta.24429.5 -> To Version 9.0.0-beta.24453.1 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 84 ++++++++++---------- eng/Versions.props | 32 ++++---- eng/common/core-templates/job/job.yml | 5 -- eng/common/internal/Tools.csproj | 1 + eng/common/templates-official/job/job.yml | 14 ++++ eng/common/templates/job/job.yml | 96 +++++++++++------------ global.json | 6 +- 7 files changed, 120 insertions(+), 118 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 71069823f180d6..2ba82b7c640940 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -88,87 +88,87 @@ - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 https://github.com/dotnet/runtime-assets @@ -328,9 +328,9 @@ https://github.com/dotnet/xharness 9794254fa909ff5adc46326e9b54009793f61dcd - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization diff --git a/eng/Versions.props b/eng/Versions.props index 3c93e3ead99f16..70f19636470d6f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -83,22 +83,22 @@ 9.0.100-rc.1.24409.1 - 9.0.0-beta.24421.7 - 9.0.0-beta.24421.7 - 9.0.0-beta.24421.7 - 9.0.0-beta.24421.7 - 2.9.0-beta.24421.7 - 9.0.0-beta.24421.7 - 2.9.0-beta.24421.7 - 9.0.0-beta.24421.7 - 9.0.0-beta.24421.7 - 9.0.0-beta.24421.7 - 9.0.0-beta.24421.7 - 9.0.0-beta.24421.7 - 9.0.0-beta.24421.7 - 9.0.0-beta.24421.7 - 9.0.0-beta.24421.7 - 9.0.0-beta.24421.7 + 9.0.0-beta.24453.1 + 9.0.0-beta.24453.1 + 9.0.0-beta.24453.1 + 9.0.0-beta.24453.1 + 2.9.0-beta.24453.1 + 9.0.0-beta.24453.1 + 2.9.0-beta.24453.1 + 9.0.0-beta.24453.1 + 9.0.0-beta.24453.1 + 9.0.0-beta.24453.1 + 9.0.0-beta.24453.1 + 9.0.0-beta.24453.1 + 9.0.0-beta.24453.1 + 9.0.0-beta.24453.1 + 9.0.0-beta.24453.1 + 9.0.0-beta.24453.1 1.4.0 diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml index c732bee9f4a6f3..ba53ebfbd51334 100644 --- a/eng/common/core-templates/job/job.yml +++ b/eng/common/core-templates/job/job.yml @@ -33,11 +33,6 @@ parameters: artifactPublishSteps: [] runAsPublic: false -# Sbom related params - enableSbom: true - PackageVersion: 9.0.0 - BuildDropPath: '$(Build.SourcesDirectory)/artifacts' - # 1es specific parameters is1ESPipeline: '' diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj index e925952d56664e..32f79dfb3402c0 100644 --- a/eng/common/internal/Tools.csproj +++ b/eng/common/internal/Tools.csproj @@ -4,6 +4,7 @@ net472 false + false diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml index 0c2928d5c799eb..3d16b41c78c189 100644 --- a/eng/common/templates-official/job/job.yml +++ b/eng/common/templates-official/job/job.yml @@ -1,8 +1,22 @@ +parameters: +# Sbom related params + enableSbom: true + PackageVersion: 9.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + jobs: - template: /eng/common/core-templates/job/job.yml parameters: is1ESPipeline: true + componentGovernanceSteps: + - ${{ 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 }} + publishArtifacts: false + # publish artifacts # for 1ES managed templates, use the templateContext.output to handle multiple outputs. templateContext: diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 8da477dd69f066..07d317bf8f9a4c 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -19,71 +19,63 @@ jobs: steps: - ${{ each step in parameters.steps }}: - ${{ step }} - + componentGovernanceSteps: - - 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 + - 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: ${{ parameters.disableComponentGovernance }} - componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} - - - ${{ 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 }} - publishArtifacts: false - + disableComponentGovernance: true + ${{ else }}: + disableComponentGovernance: ${{ parameters.disableComponentGovernance }} + componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} artifactPublishSteps: - - ${{ if ne(parameters.artifacts.publish, '') }}: - - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: - - template: /eng/common/core-templates/steps/publish-build-artifacts.yml - parameters: - is1ESPipeline: false - args: - displayName: Publish pipeline artifacts - pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts' - publishLocation: Container - artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} - continueOnError: true - condition: always() - - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: - - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml - parameters: - is1ESPipeline: false - args: - targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' - artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} - displayName: 'Publish logs' - continueOnError: true - condition: always() - sbomEnabled: false # we don't need SBOM for logs - - - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: - template: /eng/common/core-templates/steps/publish-build-artifacts.yml parameters: is1ESPipeline: false args: - displayName: Publish Logs - pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + displayName: Publish pipeline artifacts + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts' publishLocation: Container - artifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} continueOnError: true condition: always() - - - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml parameters: is1ESPipeline: false args: - targetPath: '$(Build.SourcesDirectory)\eng\common\BuildConfiguration' - artifactName: 'BuildConfiguration' - displayName: 'Publish build retry configuration' + targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' + artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} + displayName: 'Publish logs' continueOnError: true - sbomEnabled: false # we don't need SBOM for BuildConfiguration + condition: always() + sbomEnabled: false # we don't need SBOM for logs + + - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: false + args: + displayName: Publish Logs + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + publishLocation: Container + artifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + continueOnError: true + condition: always() + + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: false + args: + targetPath: '$(Build.SourcesDirectory)\eng\common\BuildConfiguration' + artifactName: 'BuildConfiguration' + displayName: 'Publish build retry configuration' + continueOnError: true + sbomEnabled: false # we don't need SBOM for BuildConfiguration diff --git a/global.json b/global.json index 8a60777bc71358..e8b6c544ced98f 100644 --- a/global.json +++ b/global.json @@ -8,9 +8,9 @@ "dotnet": "9.0.100-preview.7.24407.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24421.7", - "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.24421.7", - "Microsoft.DotNet.SharedFramework.Sdk": "9.0.0-beta.24421.7", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24453.1", + "Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.24453.1", + "Microsoft.DotNet.SharedFramework.Sdk": "9.0.0-beta.24453.1", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0", "Microsoft.NET.Sdk.IL": "9.0.0-rc.1.24410.5" From a0847e72b03e1867dc9ebe6b81aae9040a50d607 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:22:05 -0700 Subject: [PATCH 091/748] [release/9.0] Fix bug in validating unused bits (#107321) * Fix bug in validating unused bits * Fix another failure * Update src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Base64Url/Base64UrlValidator.cs Co-authored-by: Stephen Toub --------- Co-authored-by: Buyaa Namnan Co-authored-by: Buyaa Namnan Co-authored-by: Stephen Toub --- .../tests/Base64/Base64ValidationUnitTests.cs | 23 ++++++++++ .../Base64Url/Base64UrlValidationUnitTests.cs | 12 +++++ .../Text/Base64Url/Base64UrlValidator.cs | 46 +++++++++---------- 3 files changed, 58 insertions(+), 23 deletions(-) diff --git a/src/libraries/System.Memory/tests/Base64/Base64ValidationUnitTests.cs b/src/libraries/System.Memory/tests/Base64/Base64ValidationUnitTests.cs index 62b978c60c5e1a..f95399ae420919 100644 --- a/src/libraries/System.Memory/tests/Base64/Base64ValidationUnitTests.cs +++ b/src/libraries/System.Memory/tests/Base64/Base64ValidationUnitTests.cs @@ -9,6 +9,29 @@ namespace System.Buffers.Text.Tests { public class Base64ValidationUnitTests : Base64TestBase { + [Theory] + [InlineData("= ")] + [InlineData("= =")] + [InlineData("+ +=")] + [InlineData("A=")] + [InlineData("A==")] + [InlineData("44==")] + [InlineData(" A==")] + [InlineData("AAAAA ==")] + [InlineData("\tLLLL\t=\r")] + [InlineData("6066=")] + [InlineData("6066==")] + [InlineData("SM==")] + [InlineData("SM =")] + [InlineData("s\rEs\r\r==")] + public void BasicValidationEdgeCaseScenario(string base64UrlText) + { + Assert.False(Base64.IsValid(base64UrlText.AsSpan(), out int decodedLength)); + Assert.Equal(0, decodedLength); + Span dest = new byte[Base64.GetMaxDecodedFromUtf8Length(base64UrlText.Length)]; + Assert.Equal(OperationStatus.InvalidData, Base64.DecodeFromUtf8(base64UrlText.ToUtf8Span(), dest, out _, out _)); + } + [Fact] public void BasicValidationBytes() { diff --git a/src/libraries/System.Memory/tests/Base64Url/Base64UrlValidationUnitTests.cs b/src/libraries/System.Memory/tests/Base64Url/Base64UrlValidationUnitTests.cs index 0ee3abcd9153a2..092d45d2370d17 100644 --- a/src/libraries/System.Memory/tests/Base64Url/Base64UrlValidationUnitTests.cs +++ b/src/libraries/System.Memory/tests/Base64Url/Base64UrlValidationUnitTests.cs @@ -10,6 +10,7 @@ namespace System.Buffers.Text.Tests public class Base64UrlValidationUnitTests : Base64TestBase { [Theory] + [InlineData("=")] [InlineData("==")] [InlineData("-%")] [InlineData("A=")] @@ -19,10 +20,17 @@ public class Base64UrlValidationUnitTests : Base64TestBase [InlineData("AAAAA ==")] [InlineData("\tLLLL\t=\r")] [InlineData("6066=")] + [InlineData("6066==")] + [InlineData("SM==")] + [InlineData("SM=")] + [InlineData("sEs==")] + [InlineData("s\rEs\r\r==")] public void BasicValidationEdgeCaseScenario(string base64UrlText) { Assert.False(Base64Url.IsValid(base64UrlText.AsSpan(), out int decodedLength)); Assert.Equal(0, decodedLength); + Span dest = new byte[Base64Url.GetMaxDecodedLength(base64UrlText.Length)]; + Assert.Equal(OperationStatus.InvalidData, Base64Url.DecodeFromChars(base64UrlText.AsSpan(), dest, out _, out _)); } [Fact] @@ -258,6 +266,10 @@ public void ValidateWithPaddingReturnsCorrectCountChars(string utf8WithByteToBeI Assert.True(Base64Url.IsValid(utf8BytesWithByteToBeIgnored)); Assert.True(Base64Url.IsValid(utf8BytesWithByteToBeIgnored, out int decodedLength)); Assert.Equal(expectedLength, decodedLength); + + Span dest = new byte[Base64Url.GetMaxDecodedLength(utf8WithByteToBeIgnored.Length)]; + Assert.Equal(OperationStatus.Done, Base64Url.DecodeFromChars(utf8WithByteToBeIgnored.AsSpan(), dest, out _, out decodedLength)); + Assert.Equal(expectedLength, decodedLength); } [Theory] diff --git a/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Base64Url/Base64UrlValidator.cs b/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Base64Url/Base64UrlValidator.cs index bc95ab0f054cd2..3cd8bf5c679f2a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Base64Url/Base64UrlValidator.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Base64Url/Base64UrlValidator.cs @@ -1,8 +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.Diagnostics; using System.Runtime.CompilerServices; -using static System.Buffers.Text.Base64Helper; namespace System.Buffers.Text { @@ -94,33 +94,33 @@ public bool ValidateAndDecodeLength(char lastChar, int length, int paddingCount, [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool ValidateAndDecodeLength(byte lastChar, int length, int paddingCount, out int decodedLength) { - // Padding is optional for Base64Url, so need to account remainder. If remainder is 1, then it's invalid. -#if NET - (uint whole, uint remainder) = uint.DivRem((uint)(length), 4); - if (remainder == 1 || (remainder > 1 && (remainder - paddingCount == 1 || paddingCount == remainder))) - { - decodedLength = 0; - return false; - } - - decodedLength = (int)((whole * 3) + (remainder > 0 ? remainder - 1 : 0) - paddingCount); -#else + // Padding is optional for Base64Url, so need to account remainder. int remainder = (int)((uint)length % 4); - if (remainder == 1 || (remainder > 1 && (remainder - paddingCount == 1 || paddingCount == remainder))) + + if (paddingCount != 0) { - decodedLength = 0; - return false; + length -= paddingCount; + remainder = (int)((uint)length % 4); + + // if there is a padding, there should be remainder and the sum of remainder and padding should not exceed 4 + if (remainder == 0 || remainder + paddingCount > 4) + { + decodedLength = 0; + return false; + } } - decodedLength = (length >> 2) * 3 + (remainder > 0 ? remainder - 1 : 0) - paddingCount; -#endif - int decoded = default(Base64DecoderByte).DecodingMap[lastChar]; - if (((remainder == 3 || paddingCount == 1) && (decoded & 0x03) != 0) || - ((remainder == 2 || paddingCount == 2) && (decoded & 0x0F) != 0)) + decodedLength = (length >> 2) * 3 + (remainder > 0 ? remainder - 1 : 0); + + if (remainder > 0) { - // unused lower bits are not 0, reject input - decodedLength = 0; - return false; + int decoded = default(Base64UrlDecoderByte).DecodingMap[lastChar]; + switch (remainder) + { + case 1: return false; // 1 byte is not decodable => invalid. + case 2: return ((decoded & 0x0F) == 0); // if unused lower 4 bits are set to 0 + case 3: return ((decoded & 0x03) == 0); // if unused lower 2 bits are set to 0 + } } return true; From 2875fda693bd9e50e66b2514df99ebb334c7b4b3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:28:05 -0700 Subject: [PATCH 092/748] [release/9.0] Fix calling property setter In in the Configuration source generator (#107329) * Fix calling property setterIn in the Configuration source generator * Fix indentation * delta change --------- Co-authored-by: Tarek Mahmoud Sayed --- .../gen/Emitter/CoreBindingHelpers.cs | 43 +++++++++++++------ .../ConfigurationBinderTests.TestClasses.cs | 14 ++++++ .../tests/Common/ConfigurationBinderTests.cs | 28 ++++++++++++ .../Version1/Bind.generated.txt | 12 ++++++ .../Version1/Bind_Instance.generated.txt | 12 ++++++ .../Bind_Instance_BinderOptions.generated.txt | 12 ++++++ .../Version1/Bind_Key_Instance.generated.txt | 12 ++++++ .../Version1/Get.generated.txt | 12 ++++++ .../Version1/Get_T.generated.txt | 12 ++++++ .../Get_T_BinderOptions.generated.txt | 12 ++++++ .../Version1/BindConfiguration.generated.txt | 4 ++ ...gurationWithConfigureActions.generated.txt | 4 ++ .../Version1/Bind_T.generated.txt | 4 ++ .../Bind_T_BinderOptions.generated.txt | 4 ++ .../Version1/Configure_T.generated.txt | 12 ++++++ .../Configure_T_BinderOptions.generated.txt | 12 ++++++ .../Version1/Configure_T_name.generated.txt | 12 ++++++ ...nfigure_T_name_BinderOptions.generated.txt | 12 ++++++ .../net462/Version1/Collections.generated.txt | 20 +++++++++ .../Version1/UnsupportedTypes.generated.txt | 12 ++++++ .../Version1/Bind.generated.txt | 12 ++++++ .../Version1/Bind_Instance.generated.txt | 12 ++++++ .../Bind_Instance_BinderOptions.generated.txt | 12 ++++++ .../Version1/Bind_Key_Instance.generated.txt | 12 ++++++ .../Version1/Get.generated.txt | 12 ++++++ .../Version1/Get_T.generated.txt | 12 ++++++ .../Get_T_BinderOptions.generated.txt | 12 ++++++ .../Version1/BindConfiguration.generated.txt | 4 ++ ...gurationWithConfigureActions.generated.txt | 4 ++ .../Version1/Bind_T.generated.txt | 4 ++ .../Bind_T_BinderOptions.generated.txt | 4 ++ .../Version1/Configure_T.generated.txt | 12 ++++++ .../Configure_T_BinderOptions.generated.txt | 12 ++++++ .../Version1/Configure_T_name.generated.txt | 12 ++++++ ...nfigure_T_name_BinderOptions.generated.txt | 12 ++++++ .../Version1/Collections.generated.txt | 20 +++++++++ .../Version1/UnsupportedTypes.generated.txt | 12 ++++++ 37 files changed, 431 insertions(+), 14 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Emitter/CoreBindingHelpers.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Emitter/CoreBindingHelpers.cs index 3433544bf9ee74..10dcb779a928dd 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Emitter/CoreBindingHelpers.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Emitter/CoreBindingHelpers.cs @@ -968,15 +968,31 @@ private void EmitBindingLogicForComplexMember( initKind = InitializationKind.SimpleAssignment; } - Action? writeOnSuccess = !canSet - ? null - : bindedValueIdentifier => - { - if (memberAccessExpr != bindedValueIdentifier) - { - _writer.WriteLine($"{memberAccessExpr} = {bindedValueIdentifier};"); - } - }; + Action? writeOnSuccess = !canSet + ? null + : (bindedValueIdentifier, tempIdentifierStoringExpr) => + { + if (memberAccessExpr != bindedValueIdentifier) + { + _writer.WriteLine($"{memberAccessExpr} = {bindedValueIdentifier};"); + + if (tempIdentifierStoringExpr is not null) + { + _writer.WriteLine($"{tempIdentifierStoringExpr}"); + } + + if (member.CanGet && _typeIndex.CanInstantiate(effectiveMemberType)) + { + EmitEndBlock(); + EmitStartBlock("else"); + _writer.WriteLine($"{memberAccessExpr} = {memberAccessExpr};"); + } + } + else + { + _writer.WriteLine($"{tempIdentifierStoringExpr}"); + } + }; EmitBindingLogic( effectiveMemberType, @@ -994,7 +1010,7 @@ private void EmitBindingLogic( string configArgExpr, InitializationKind initKind, ValueDefaulting valueDefaulting, - Action? writeOnSuccess = null) + Action? writeOnSuccess = null) { if (!_typeIndex.HasBindableMembers(type)) { @@ -1022,15 +1038,14 @@ private void EmitBindingLogic( } else if (initKind is InitializationKind.None && type.IsValueType) { - EmitBindingLogic(tempIdentifier, InitializationKind.Declaration); - _writer.WriteLine($"{memberAccessExpr} = {tempIdentifier};"); + EmitBindingLogic(tempIdentifier, InitializationKind.Declaration, $"{memberAccessExpr} = {tempIdentifier};"); } else { EmitBindingLogic(memberAccessExpr, initKind); } - void EmitBindingLogic(string instanceToBindExpr, InitializationKind initKind) + void EmitBindingLogic(string instanceToBindExpr, InitializationKind initKind, string? tempIdentifierStoringExpr = null) { string bindCoreCall = $@"{nameof(MethodsToGen_CoreBindingHelper.BindCore)}({configArgExpr}, ref {instanceToBindExpr}, defaultValueIfNotFound: {FormatDefaultValueIfNotFound()}, {Identifier.binderOptions});"; @@ -1060,7 +1075,7 @@ void EmitBindingLogic(string instanceToBindExpr, InitializationKind initKind) void EmitBindCoreCall() { _writer.WriteLine(bindCoreCall); - writeOnSuccess?.Invoke(instanceToBindExpr); + writeOnSuccess?.Invoke(instanceToBindExpr, tempIdentifierStoringExpr); } string FormatDefaultValueIfNotFound() => valueDefaulting == ValueDefaulting.CallSetter ? "true" : "false"; diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.TestClasses.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.TestClasses.cs index 74de2804741042..31278be1121952 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.TestClasses.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.TestClasses.cs @@ -198,6 +198,20 @@ public record TypeWithRecursionThroughCollections public List? List { get; set; } } + public class TypeWithValueMutatorPropertySetter + { + private string _value = "Uninitialized"; + public string Value + { + get { return _value; } + set + { + _value = value == "Uninitialized" ? "Initialized" : value; + } + } + public ISet SomeSet { get; set; } = new HashSet(StringComparer.OrdinalIgnoreCase); + } + public record RecordWithArrayParameter(string[] Array); public readonly record struct ReadonlyRecordStructTypeOptions(string Color, int Length); diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs index 9e95c80643ed20..b1f4ffb264a920 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs @@ -1625,6 +1625,34 @@ public void BindToRecursiveTypesTest() Assert.Equal(1, instance.List[1].Values.Count); } + /// + /// This test ensures that the property setter is invoked during binding, even when there is no configuration for the property. + /// + [Fact] + public void PropertySetterCalledTest() + { + string jsonConfig = @"{ + ""Configuration"": { + ""SomeSet"": [ + ""path"" + ] + } + }"; + + var configuration = new ConfigurationBuilder() + .AddJsonStream(new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(jsonConfig))) + .Build(); + + TypeWithValueMutatorPropertySetter t1 = new(); + Assert.Equal(0, t1.SomeSet.Count); + Assert.Equal("Uninitialized", t1.Value); + + TypeWithValueMutatorPropertySetter t2 = configuration.GetSection("Configuration").Get()!; + Assert.Equal(1, t2.SomeSet.Count); + Assert.True(t2.SomeSet.Contains("path")); + Assert.Equal("Initialized", t2.Value); + } + [Fact] public void CanBindReadonlyRecordStructOptions() { diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind.generated.txt index 6b35d5b73afd4f..eafca53839991b 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind.generated.txt @@ -159,6 +159,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section2, ref temp4, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp4; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section5) { @@ -167,6 +171,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp7; } + else + { + instance.MyDictionary = instance.MyDictionary; + } if (AsConfigWithChildren(configuration.GetSection("MyComplexDictionary")) is IConfigurationSection section8) { @@ -175,6 +183,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyComplexDictionary = temp10; } + else + { + instance.MyComplexDictionary = instance.MyComplexDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind_Instance.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind_Instance.generated.txt index ed6db21e40afc9..b8114b76f70dc3 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind_Instance.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind_Instance.generated.txt @@ -123,6 +123,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section2, ref temp4, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp4; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section5) { @@ -131,6 +135,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp7; } + else + { + instance.MyDictionary = instance.MyDictionary; + } if (AsConfigWithChildren(configuration.GetSection("MyComplexDictionary")) is IConfigurationSection section8) { @@ -139,6 +147,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyComplexDictionary = temp10; } + else + { + instance.MyComplexDictionary = instance.MyComplexDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind_Instance_BinderOptions.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind_Instance_BinderOptions.generated.txt index c8abf9d79fb7da..7eaabd7a89ab23 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind_Instance_BinderOptions.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind_Instance_BinderOptions.generated.txt @@ -123,6 +123,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section2, ref temp4, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp4; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section5) { @@ -131,6 +135,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp7; } + else + { + instance.MyDictionary = instance.MyDictionary; + } if (AsConfigWithChildren(configuration.GetSection("MyComplexDictionary")) is IConfigurationSection section8) { @@ -139,6 +147,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyComplexDictionary = temp10; } + else + { + instance.MyComplexDictionary = instance.MyComplexDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind_Key_Instance.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind_Key_Instance.generated.txt index ee106169a27ee1..ed66e64fde8f9c 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind_Key_Instance.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Bind_Key_Instance.generated.txt @@ -123,6 +123,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section2, ref temp4, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp4; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section5) { @@ -131,6 +135,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp7; } + else + { + instance.MyDictionary = instance.MyDictionary; + } if (AsConfigWithChildren(configuration.GetSection("MyComplexDictionary")) is IConfigurationSection section8) { @@ -139,6 +147,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyComplexDictionary = temp10; } + else + { + instance.MyComplexDictionary = instance.MyComplexDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Get.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Get.generated.txt index 61b94ba858cb02..5745fe8f16ace8 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Get.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Get.generated.txt @@ -157,6 +157,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp7; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyArray")) is IConfigurationSection section8) { @@ -165,6 +169,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyArray = temp10; } + else + { + instance.MyArray = instance.MyArray; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section11) { @@ -173,6 +181,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section11, ref temp13, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp13; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } public static void BindCore(IConfiguration configuration, ref global::Program.MyClass2 instance, bool defaultValueIfNotFound, BinderOptions? binderOptions) diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Get_T.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Get_T.generated.txt index 205783d6a98214..a4bf3676be7418 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Get_T.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Get_T.generated.txt @@ -138,6 +138,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section4, ref temp6, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp6; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyArray")) is IConfigurationSection section7) { @@ -146,6 +150,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section7, ref temp9, defaultValueIfNotFound: false, binderOptions); instance.MyArray = temp9; } + else + { + instance.MyArray = instance.MyArray; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section10) { @@ -154,6 +162,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section10, ref temp12, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp12; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Get_T_BinderOptions.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Get_T_BinderOptions.generated.txt index 8b4644d2b27c91..0ea405142fe29b 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Get_T_BinderOptions.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ConfigurationBinder/Version1/Get_T_BinderOptions.generated.txt @@ -138,6 +138,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section4, ref temp6, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp6; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyArray")) is IConfigurationSection section7) { @@ -146,6 +150,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section7, ref temp9, defaultValueIfNotFound: false, binderOptions); instance.MyArray = temp9; } + else + { + instance.MyArray = instance.MyArray; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section10) { @@ -154,6 +162,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section10, ref temp12, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp12; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/BindConfiguration.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/BindConfiguration.generated.txt index 12dc3a77b0ed3f..a5fa9894a9e57a 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/BindConfiguration.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/BindConfiguration.generated.txt @@ -141,6 +141,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section3, ref temp5, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp5; } + else + { + instance.MyList = instance.MyList; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/BindConfigurationWithConfigureActions.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/BindConfigurationWithConfigureActions.generated.txt index 103423d5b0bcd5..8ed59c5e13746e 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/BindConfigurationWithConfigureActions.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/BindConfigurationWithConfigureActions.generated.txt @@ -141,6 +141,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section3, ref temp5, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp5; } + else + { + instance.MyList = instance.MyList; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/Bind_T.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/Bind_T.generated.txt index 4ca0ba31f4aca6..a74b4934b12ab4 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/Bind_T.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/Bind_T.generated.txt @@ -147,6 +147,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section3, ref temp5, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp5; } + else + { + instance.MyList = instance.MyList; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/Bind_T_BinderOptions.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/Bind_T_BinderOptions.generated.txt index a8cc253765c046..efafd0eb6a5b1e 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/Bind_T_BinderOptions.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/OptionsBuilder/Version1/Bind_T_BinderOptions.generated.txt @@ -141,6 +141,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section3, ref temp5, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp5; } + else + { + instance.MyList = instance.MyList; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T.generated.txt index 417f221d0aabd2..b379e4993ea2e9 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T.generated.txt @@ -174,6 +174,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp7; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyList2")) is IConfigurationSection section8) { @@ -182,6 +186,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyList2 = temp10; } + else + { + instance.MyList2 = instance.MyList2; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section11) { @@ -190,6 +198,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section11, ref temp13, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp13; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T_BinderOptions.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T_BinderOptions.generated.txt index 98580f73b919fb..8a52959bc613ec 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T_BinderOptions.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T_BinderOptions.generated.txt @@ -174,6 +174,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp7; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyList2")) is IConfigurationSection section8) { @@ -182,6 +186,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyList2 = temp10; } + else + { + instance.MyList2 = instance.MyList2; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section11) { @@ -190,6 +198,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section11, ref temp13, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp13; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T_name.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T_name.generated.txt index 25d182f7ac1fb9..2ab4a08cd8fb14 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T_name.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T_name.generated.txt @@ -174,6 +174,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp7; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyList2")) is IConfigurationSection section8) { @@ -182,6 +186,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyList2 = temp10; } + else + { + instance.MyList2 = instance.MyList2; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section11) { @@ -190,6 +198,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section11, ref temp13, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp13; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T_name_BinderOptions.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T_name_BinderOptions.generated.txt index 7e4337e45c1432..4d87b2e4d2d1b9 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T_name_BinderOptions.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/ServiceCollection/Version1/Configure_T_name_BinderOptions.generated.txt @@ -168,6 +168,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp7; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyList2")) is IConfigurationSection section8) { @@ -176,6 +180,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyList2 = temp10; } + else + { + instance.MyList2 = instance.MyList2; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section11) { @@ -184,6 +192,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section11, ref temp13, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp13; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/Version1/Collections.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/Version1/Collections.generated.txt index c261c340aaf256..b0f90ddf5b4165 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/Version1/Collections.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/Version1/Collections.generated.txt @@ -145,6 +145,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section1, ref temp3, defaultValueIfNotFound: false, binderOptions); instance.CustomDictionary = temp3; } + else + { + instance.CustomDictionary = instance.CustomDictionary; + } if (AsConfigWithChildren(configuration.GetSection("CustomList")) is IConfigurationSection section4) { @@ -153,6 +157,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section4, ref temp6, defaultValueIfNotFound: false, binderOptions); instance.CustomList = temp6; } + else + { + instance.CustomList = instance.CustomList; + } if (AsConfigWithChildren(configuration.GetSection("IReadOnlyList")) is IConfigurationSection section7) { @@ -161,6 +169,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section7, ref temp9, defaultValueIfNotFound: false, binderOptions); instance.IReadOnlyList = temp9; } + else + { + instance.IReadOnlyList = instance.IReadOnlyList; + } if (AsConfigWithChildren(configuration.GetSection("IReadOnlyDictionary")) is IConfigurationSection section10) { @@ -169,6 +181,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section10, ref temp12, defaultValueIfNotFound: false, binderOptions); instance.IReadOnlyDictionary = temp12; } + else + { + instance.IReadOnlyDictionary = instance.IReadOnlyDictionary; + } if (AsConfigWithChildren(configuration.GetSection("CollectionStructExplicit")) is IConfigurationSection section13) { @@ -178,6 +194,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration instance.CollectionStructExplicit = temp15; temp14 = temp15; } + else + { + instance.CollectionStructExplicit = instance.CollectionStructExplicit; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/Version1/UnsupportedTypes.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/Version1/UnsupportedTypes.generated.txt index 9f784cc0193ddb..4cdd6685f6ac79 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/Version1/UnsupportedTypes.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/net462/Version1/UnsupportedTypes.generated.txt @@ -159,6 +159,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section4, ref temp6, defaultValueIfNotFound: false, binderOptions); instance.List = temp6; } + else + { + instance.List = instance.List; + } if (AsConfigWithChildren(configuration.GetSection("Array")) is IConfigurationSection section7) { @@ -167,6 +171,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section7, ref temp9, defaultValueIfNotFound: false, binderOptions); instance.Array = temp9; } + else + { + instance.Array = instance.Array; + } if (AsConfigWithChildren(configuration.GetSection("Record")) is IConfigurationSection section10) { @@ -175,6 +183,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section10, ref temp12, defaultValueIfNotFound: false, binderOptions); instance.Record = temp12; } + else + { + instance.Record = instance.Record; + } } public static global::Record InitializeRecordAction(IConfiguration configuration, BinderOptions? binderOptions) diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind.generated.txt index baca17797df7aa..85ebf4c500e360 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind.generated.txt @@ -150,6 +150,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section2, ref temp4, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp4; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section5) { @@ -158,6 +162,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp7; } + else + { + instance.MyDictionary = instance.MyDictionary; + } if (AsConfigWithChildren(configuration.GetSection("MyComplexDictionary")) is IConfigurationSection section8) { @@ -166,6 +174,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyComplexDictionary = temp10; } + else + { + instance.MyComplexDictionary = instance.MyComplexDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind_Instance.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind_Instance.generated.txt index 55fc88c6e54f7d..f090695e031bfc 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind_Instance.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind_Instance.generated.txt @@ -120,6 +120,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section2, ref temp4, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp4; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section5) { @@ -128,6 +132,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp7; } + else + { + instance.MyDictionary = instance.MyDictionary; + } if (AsConfigWithChildren(configuration.GetSection("MyComplexDictionary")) is IConfigurationSection section8) { @@ -136,6 +144,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyComplexDictionary = temp10; } + else + { + instance.MyComplexDictionary = instance.MyComplexDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind_Instance_BinderOptions.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind_Instance_BinderOptions.generated.txt index a1c971d891ea53..fae095fdf9047c 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind_Instance_BinderOptions.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind_Instance_BinderOptions.generated.txt @@ -120,6 +120,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section2, ref temp4, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp4; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section5) { @@ -128,6 +132,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp7; } + else + { + instance.MyDictionary = instance.MyDictionary; + } if (AsConfigWithChildren(configuration.GetSection("MyComplexDictionary")) is IConfigurationSection section8) { @@ -136,6 +144,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyComplexDictionary = temp10; } + else + { + instance.MyComplexDictionary = instance.MyComplexDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind_Key_Instance.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind_Key_Instance.generated.txt index b3aa0044f92289..ec1527b06b9302 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind_Key_Instance.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Bind_Key_Instance.generated.txt @@ -120,6 +120,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section2, ref temp4, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp4; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section5) { @@ -128,6 +132,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp7; } + else + { + instance.MyDictionary = instance.MyDictionary; + } if (AsConfigWithChildren(configuration.GetSection("MyComplexDictionary")) is IConfigurationSection section8) { @@ -136,6 +144,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyComplexDictionary = temp10; } + else + { + instance.MyComplexDictionary = instance.MyComplexDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Get.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Get.generated.txt index 25f336d16d22da..b1c4087f510f3e 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Get.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Get.generated.txt @@ -154,6 +154,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp7; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyArray")) is IConfigurationSection section8) { @@ -162,6 +166,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyArray = temp10; } + else + { + instance.MyArray = instance.MyArray; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section11) { @@ -170,6 +178,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section11, ref temp13, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp13; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } public static void BindCore(IConfiguration configuration, ref global::Program.MyClass2 instance, bool defaultValueIfNotFound, BinderOptions? binderOptions) diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Get_T.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Get_T.generated.txt index ae367c81fd0682..438b31ea5a373b 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Get_T.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Get_T.generated.txt @@ -135,6 +135,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section4, ref temp6, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp6; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyArray")) is IConfigurationSection section7) { @@ -143,6 +147,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section7, ref temp9, defaultValueIfNotFound: false, binderOptions); instance.MyArray = temp9; } + else + { + instance.MyArray = instance.MyArray; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section10) { @@ -151,6 +159,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section10, ref temp12, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp12; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Get_T_BinderOptions.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Get_T_BinderOptions.generated.txt index 938d15f5734da5..e3b4d79b987a49 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Get_T_BinderOptions.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ConfigurationBinder/Version1/Get_T_BinderOptions.generated.txt @@ -135,6 +135,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section4, ref temp6, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp6; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyArray")) is IConfigurationSection section7) { @@ -143,6 +147,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section7, ref temp9, defaultValueIfNotFound: false, binderOptions); instance.MyArray = temp9; } + else + { + instance.MyArray = instance.MyArray; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section10) { @@ -151,6 +159,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section10, ref temp12, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp12; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/BindConfiguration.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/BindConfiguration.generated.txt index 3bf1c7fffb3d17..2f96ede4aa3fb0 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/BindConfiguration.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/BindConfiguration.generated.txt @@ -132,6 +132,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section3, ref temp5, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp5; } + else + { + instance.MyList = instance.MyList; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/BindConfigurationWithConfigureActions.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/BindConfigurationWithConfigureActions.generated.txt index 68fd25284f96d0..96ede4c24d3614 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/BindConfigurationWithConfigureActions.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/BindConfigurationWithConfigureActions.generated.txt @@ -132,6 +132,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section3, ref temp5, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp5; } + else + { + instance.MyList = instance.MyList; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/Bind_T.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/Bind_T.generated.txt index 79b3242d6bda99..340cfa41f749ce 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/Bind_T.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/Bind_T.generated.txt @@ -138,6 +138,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section3, ref temp5, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp5; } + else + { + instance.MyList = instance.MyList; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/Bind_T_BinderOptions.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/Bind_T_BinderOptions.generated.txt index 8451a8071657a7..640cb5b5afeedf 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/Bind_T_BinderOptions.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/OptionsBuilder/Version1/Bind_T_BinderOptions.generated.txt @@ -132,6 +132,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section3, ref temp5, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp5; } + else + { + instance.MyList = instance.MyList; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T.generated.txt index 4acfc2c04b2a44..3f926839b122f8 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T.generated.txt @@ -168,6 +168,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp7; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyList2")) is IConfigurationSection section8) { @@ -176,6 +180,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyList2 = temp10; } + else + { + instance.MyList2 = instance.MyList2; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section11) { @@ -184,6 +192,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section11, ref temp13, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp13; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T_BinderOptions.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T_BinderOptions.generated.txt index 99c67141401cdd..0dd10a3677ff6a 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T_BinderOptions.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T_BinderOptions.generated.txt @@ -168,6 +168,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp7; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyList2")) is IConfigurationSection section8) { @@ -176,6 +180,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyList2 = temp10; } + else + { + instance.MyList2 = instance.MyList2; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section11) { @@ -184,6 +192,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section11, ref temp13, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp13; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T_name.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T_name.generated.txt index 07fa717a301681..bdc65cf2f22fd7 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T_name.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T_name.generated.txt @@ -168,6 +168,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp7; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyList2")) is IConfigurationSection section8) { @@ -176,6 +180,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyList2 = temp10; } + else + { + instance.MyList2 = instance.MyList2; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section11) { @@ -184,6 +192,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section11, ref temp13, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp13; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T_name_BinderOptions.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T_name_BinderOptions.generated.txt index 20a36e76d994df..9b3ee20e9cd67c 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T_name_BinderOptions.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/ServiceCollection/Version1/Configure_T_name_BinderOptions.generated.txt @@ -162,6 +162,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section5, ref temp7, defaultValueIfNotFound: false, binderOptions); instance.MyList = temp7; } + else + { + instance.MyList = instance.MyList; + } if (AsConfigWithChildren(configuration.GetSection("MyList2")) is IConfigurationSection section8) { @@ -170,6 +174,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section8, ref temp10, defaultValueIfNotFound: false, binderOptions); instance.MyList2 = temp10; } + else + { + instance.MyList2 = instance.MyList2; + } if (AsConfigWithChildren(configuration.GetSection("MyDictionary")) is IConfigurationSection section11) { @@ -178,6 +186,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section11, ref temp13, defaultValueIfNotFound: false, binderOptions); instance.MyDictionary = temp13; } + else + { + instance.MyDictionary = instance.MyDictionary; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/Version1/Collections.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/Version1/Collections.generated.txt index 8c25f92341eba5..8fed2d02c2075f 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/Version1/Collections.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/Version1/Collections.generated.txt @@ -142,6 +142,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section1, ref temp3, defaultValueIfNotFound: false, binderOptions); instance.CustomDictionary = temp3; } + else + { + instance.CustomDictionary = instance.CustomDictionary; + } if (AsConfigWithChildren(configuration.GetSection("CustomList")) is IConfigurationSection section4) { @@ -150,6 +154,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section4, ref temp6, defaultValueIfNotFound: false, binderOptions); instance.CustomList = temp6; } + else + { + instance.CustomList = instance.CustomList; + } if (AsConfigWithChildren(configuration.GetSection("IReadOnlyList")) is IConfigurationSection section7) { @@ -158,6 +166,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section7, ref temp9, defaultValueIfNotFound: false, binderOptions); instance.IReadOnlyList = temp9; } + else + { + instance.IReadOnlyList = instance.IReadOnlyList; + } if (AsConfigWithChildren(configuration.GetSection("IReadOnlyDictionary")) is IConfigurationSection section10) { @@ -166,6 +178,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section10, ref temp12, defaultValueIfNotFound: false, binderOptions); instance.IReadOnlyDictionary = temp12; } + else + { + instance.IReadOnlyDictionary = instance.IReadOnlyDictionary; + } if (AsConfigWithChildren(configuration.GetSection("CollectionStructExplicit")) is IConfigurationSection section13) { @@ -175,6 +191,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration instance.CollectionStructExplicit = temp15; temp14 = temp15; } + else + { + instance.CollectionStructExplicit = instance.CollectionStructExplicit; + } } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/Version1/UnsupportedTypes.generated.txt b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/Version1/UnsupportedTypes.generated.txt index 509dbb05c39c81..0b119b30f4eb17 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/Version1/UnsupportedTypes.generated.txt +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/Baselines/netcoreapp/Version1/UnsupportedTypes.generated.txt @@ -153,6 +153,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section4, ref temp6, defaultValueIfNotFound: false, binderOptions); instance.List = temp6; } + else + { + instance.List = instance.List; + } if (AsConfigWithChildren(configuration.GetSection("Array")) is IConfigurationSection section7) { @@ -161,6 +165,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section7, ref temp9, defaultValueIfNotFound: false, binderOptions); instance.Array = temp9; } + else + { + instance.Array = instance.Array; + } if (AsConfigWithChildren(configuration.GetSection("Record")) is IConfigurationSection section10) { @@ -169,6 +177,10 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration BindCore(section10, ref temp12, defaultValueIfNotFound: false, binderOptions); instance.Record = temp12; } + else + { + instance.Record = instance.Record; + } } public static global::Record InitializeRecordAction(IConfiguration configuration, BinderOptions? binderOptions) From dbd8c9d22fb3a762c0621ffe6ee7e0f045f61a35 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:35:12 -0700 Subject: [PATCH 093/748] [release/9.0] Update size of LDAP `BerVal.bv_len` struct on unix (#107295) * Update size of LDAP 'BerVal.bv_len' struct on unix * Use nint instead of IntPtr * Use CLong instead of nint --------- Co-authored-by: Steve Harter --- .../Common/src/Interop/Interop.Ldap.cs | 6 ++-- .../Protocols/Interop/LdapPal.Linux.cs | 2 +- .../Protocols/Interop/SafeHandles.Linux.cs | 2 +- .../Protocols/common/BerConverter.cs | 20 ++++++------ .../Protocols/common/DirectoryControl.cs | 4 +-- .../Protocols/ldap/LdapConnection.cs | 32 +++++++++---------- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/libraries/Common/src/Interop/Interop.Ldap.cs b/src/libraries/Common/src/Interop/Interop.Ldap.cs index 4020dd0fe89bbb..90c0ba997cd962 100644 --- a/src/libraries/Common/src/Interop/Interop.Ldap.cs +++ b/src/libraries/Common/src/Interop/Interop.Ldap.cs @@ -182,14 +182,14 @@ internal struct LDAP_TIMEVAL [StructLayout(LayoutKind.Sequential)] internal sealed class BerVal { - public int bv_len; - public IntPtr bv_val = IntPtr.Zero; + public CLong bv_len; + public nint bv_val = nint.Zero; #if NET [CustomMarshaller(typeof(BerVal), MarshalMode.ManagedToUnmanagedIn, typeof(PinningMarshaller))] internal static unsafe class PinningMarshaller { - public static ref int GetPinnableReference(BerVal managed) => ref (managed is null ? ref Unsafe.NullRef() : ref managed.bv_len); + public static ref CLong GetPinnableReference(BerVal managed) => ref (managed is null ? ref Unsafe.NullRef() : ref managed.bv_len); // All usages in our currently supported scenarios will always go through GetPinnableReference public static int* ConvertToUnmanaged(BerVal _) => throw new UnreachableException(); 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 15b3cd86effafb..f364b8e44e19e3 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 @@ -128,7 +128,7 @@ internal static unsafe int BindToDirectory(ConnectionHandle ld, string who, stri passwordPtr = LdapPal.StringToPtr(passwd); BerVal passwordBerval = new BerVal { - bv_len = MemoryMarshal.CreateReadOnlySpanFromNullTerminated((byte*)passwordPtr).Length, + bv_len = new CLong(MemoryMarshal.CreateReadOnlySpanFromNullTerminated((byte*)passwordPtr).Length), bv_val = passwordPtr, }; 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 24d660de645fd8..70d25cb99f2346 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 @@ -65,7 +65,7 @@ internal SafeBerHandle(BerVal value) : base(true) // In Linux if bv_val is null ber_init will segFault instead of returning IntPtr.Zero. // In Linux if bv_len is 0 ber_init returns a valid pointer which will then fail when trying to use it, // so we fail early by throwing exception if this is the case. - if (value.bv_val == IntPtr.Zero || value.bv_len == 0) + if (value.bv_val == IntPtr.Zero || value.bv_len.Value == 0) { throw new BerConversionException(); } diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.cs index 13f7b8b0963a78..9b1bca575a151a 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.cs @@ -269,15 +269,15 @@ public static byte[] Encode(string format, params object[] value) Marshal.PtrToStructure(flattenptr, binaryValue); } - if (binaryValue == null || binaryValue.bv_len == 0) + if (binaryValue == null || binaryValue.bv_len.Value == 0) { encodingResult = Array.Empty(); } else { - encodingResult = new byte[binaryValue.bv_len]; + encodingResult = new byte[binaryValue.bv_len.Value]; - Marshal.Copy(binaryValue.bv_val, encodingResult, 0, binaryValue.bv_len); + Marshal.Copy(binaryValue.bv_val, encodingResult, 0, (int)binaryValue.bv_len.Value); } } finally @@ -315,12 +315,12 @@ internal static object[] TryDecode(string format, byte[] value, out bool decodeS if (value == null) { - berValue.bv_len = 0; + berValue.bv_len = new CLong(0); berValue.bv_val = IntPtr.Zero; } else { - berValue.bv_len = value.Length; + berValue.bv_len = new CLong(value.Length); berValue.bv_val = Marshal.AllocHGlobal(value.Length); Marshal.Copy(value, 0, berValue.bv_val, value.Length); } @@ -499,8 +499,8 @@ private static byte[] DecodingByteArrayHelper(SafeBerHandle berElement, char fmt { Marshal.PtrToStructure(result, binaryValue); - byteArray = new byte[binaryValue.bv_len]; - Marshal.Copy(binaryValue.bv_val, byteArray, 0, binaryValue.bv_len); + byteArray = new byte[binaryValue.bv_len.Value]; + Marshal.Copy(binaryValue.bv_val, byteArray, 0, (int)binaryValue.bv_len.Value); } } else @@ -540,7 +540,7 @@ private static unsafe int EncodingMultiByteArrayHelper(SafeBerHandle berElement, if (byteArray != null) { - managedBervalArray[i].bv_len = byteArray.Length; + managedBervalArray[i].bv_len = new CLong(byteArray.Length); managedBervalArray[i].bv_val = Marshal.AllocHGlobal(byteArray.Length); Marshal.Copy(byteArray, 0, managedBervalArray[i].bv_val, byteArray.Length); } @@ -607,8 +607,8 @@ private static byte[][] DecodingMultiByteArrayHelper(SafeBerHandle berElement, c BerVal ber = new BerVal(); Marshal.PtrToStructure(tempPtr, ber); - byte[] berArray = new byte[ber.bv_len]; - Marshal.Copy(ber.bv_val, berArray, 0, ber.bv_len); + byte[] berArray = new byte[ber.bv_len.Value]; + Marshal.Copy(ber.bv_val, berArray, 0, (int)ber.bv_len.Value); binaryList.Add(berArray); diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/DirectoryControl.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/DirectoryControl.cs index f47bc50318b946..ba0f714b2b02f0 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/DirectoryControl.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/DirectoryControl.cs @@ -756,8 +756,8 @@ public override unsafe byte[] GetValue() _directoryControlValue = null; if (value != null) { - _directoryControlValue = new byte[value.bv_len]; - Marshal.Copy(value.bv_val, _directoryControlValue, 0, value.bv_len); + _directoryControlValue = new byte[value.bv_len.Value]; + Marshal.Copy(value.bv_val, _directoryControlValue, 0, (int)value.bv_len.Value); } } finally diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.cs index 4be0407a9eea9b..1125bfd568d385 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.cs @@ -629,7 +629,7 @@ private unsafe int SendRequestHelper(DirectoryRequest request, ref int messageID berValuePtr = new BerVal { - bv_len = byteArray.Length, + bv_len = new CLong(byteArray.Length), bv_val = Marshal.AllocHGlobal(byteArray.Length) }; Marshal.Copy(byteArray, 0, berValuePtr.bv_val, byteArray.Length); @@ -695,7 +695,7 @@ private unsafe int SendRequestHelper(DirectoryRequest request, ref int messageID { berValuePtr = new BerVal() { - bv_len = val.Length, + bv_len = new CLong(val.Length), bv_val = Marshal.AllocHGlobal(val.Length) }; Marshal.Copy(val, 0, berValuePtr.bv_val, val.Length); @@ -1222,7 +1222,7 @@ internal static LdapControl[] BuildControlArray(DirectoryControlCollection contr // Get the control type. ldctl_oid = LdapPal.StringToPtr(((DirectoryControl)controlList[i]).Type), - // Get the control cricality. + // Get the control criticality. ldctl_iscritical = ((DirectoryControl)controlList[i]).IsCritical }; @@ -1234,7 +1234,7 @@ internal static LdapControl[] BuildControlArray(DirectoryControlCollection contr // Treat the control value as null. managedControls[i].ldctl_value = new BerVal { - bv_len = 0, + bv_len = new CLong(0), bv_val = IntPtr.Zero }; } @@ -1242,10 +1242,10 @@ internal static LdapControl[] BuildControlArray(DirectoryControlCollection contr { managedControls[i].ldctl_value = new BerVal { - bv_len = byteControlValue.Length, + bv_len = new CLong(byteControlValue.Length), bv_val = Marshal.AllocHGlobal(sizeof(byte) * byteControlValue.Length) }; - Marshal.Copy(byteControlValue, 0, managedControls[i].ldctl_value.bv_val, managedControls[i].ldctl_value.bv_len); + Marshal.Copy(byteControlValue, 0, managedControls[i].ldctl_value.bv_val, (int)managedControls[i].ldctl_value.bv_len.Value); } } } @@ -1330,13 +1330,13 @@ internal static unsafe LdapMod[] BuildAttributes(CollectionBase directoryAttribu berValues[j] = new BerVal() { - bv_len = byteArray.Length, + bv_len = new CLong(byteArray.Length), bv_val = Marshal.AllocHGlobal(byteArray.Length) }; // need to free the memory allocated on the heap when we are done ptrToFree.Add(berValues[j].bv_val); - Marshal.Copy(byteArray, 0, berValues[j].bv_val, berValues[j].bv_len); + Marshal.Copy(byteArray, 0, berValues[j].bv_val, (int)berValues[j].bv_len.Value); } } @@ -1485,10 +1485,10 @@ internal async ValueTask ConstructResponseAsync(int messageId { val = new BerVal(); Marshal.PtrToStructure(requestValue, val); - if (val.bv_len != 0 && val.bv_val != IntPtr.Zero) + if (val.bv_len.Value != 0 && val.bv_val != IntPtr.Zero) { - requestValueArray = new byte[val.bv_len]; - Marshal.Copy(val.bv_val, requestValueArray, 0, val.bv_len); + requestValueArray = new byte[val.bv_len.Value]; + Marshal.Copy(val.bv_val, requestValueArray, 0, (int)val.bv_len.Value); } } @@ -1806,10 +1806,10 @@ internal DirectoryAttribute ConstructAttribute(IntPtr entryMessage, IntPtr attri BerVal bervalue = new BerVal(); Marshal.PtrToStructure(tempPtr, bervalue); byte[] byteArray; - if (bervalue.bv_len > 0 && bervalue.bv_val != IntPtr.Zero) + if (bervalue.bv_len.Value > 0 && bervalue.bv_val != IntPtr.Zero) { - byteArray = new byte[bervalue.bv_len]; - Marshal.Copy(bervalue.bv_val, byteArray, 0, bervalue.bv_len); + byteArray = new byte[bervalue.bv_len.Value]; + Marshal.Copy(bervalue.bv_val, byteArray, 0, (int)bervalue.bv_len.Value); attribute.Add(byteArray); } @@ -1944,8 +1944,8 @@ private static DirectoryControl ConstructControl(IntPtr controlPtr) Debug.Assert(control.ldctl_oid != IntPtr.Zero); string controlType = LdapPal.PtrToString(control.ldctl_oid); - byte[] bytes = new byte[control.ldctl_value.bv_len]; - Marshal.Copy(control.ldctl_value.bv_val, bytes, 0, control.ldctl_value.bv_len); + byte[] bytes = new byte[control.ldctl_value.bv_len.Value]; + Marshal.Copy(control.ldctl_value.bv_val, bytes, 0, (int)control.ldctl_value.bv_len.Value); bool criticality = control.ldctl_iscritical; From d4bce383a52c10b2dfd4061c027fe41430f2425f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 12:59:47 -0700 Subject: [PATCH 094/748] [release/9.0] Ensure that Vector128.CreateSequence works on x86 for non-constant 64-bit inputs (#107147) * Ensure that Vector128.CreateSequence works on x86 for non-constant 64-bit inputs * Update Runtime_106372.cs --------- Co-authored-by: Tanner Gooding Co-authored-by: Jeff Schwartz --- src/coreclr/jit/hwintrinsicxarch.cpp | 19 ++++++++------ .../JitBlue/Runtime_106372/Runtime_106372.cs | 25 +++++++++++++++++++ .../Runtime_106372/Runtime_106372.csproj | 8 ++++++ 3 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106372/Runtime_106372.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_106372/Runtime_106372.csproj diff --git a/src/coreclr/jit/hwintrinsicxarch.cpp b/src/coreclr/jit/hwintrinsicxarch.cpp index afc27d12fb7675..07cdba3ae64863 100644 --- a/src/coreclr/jit/hwintrinsicxarch.cpp +++ b/src/coreclr/jit/hwintrinsicxarch.cpp @@ -2338,16 +2338,19 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic, } } - if (varTypeIsLong(simdBaseType) && !impStackTop(0).val->OperIsConst()) + if (varTypeIsLong(simdBaseType)) { - // When op2 is a constant, we can skip the multiplication allowing us to always - // generate better code. However, if it isn't then we need to fallback in the - // cases where multiplication isn't supported. - - if ((simdSize != 64) && !canUseEvexEncoding()) + if (!impStackTop(0).val->OperIsConst()) { - // TODO-XARCH-CQ: We should support long/ulong multiplication - break; + // When op2 is a constant, we can skip the multiplication allowing us to always + // generate better code. However, if it isn't then we need to fallback in the + // cases where multiplication isn't supported. + + if ((simdSize != 64) && !canUseEvexEncoding()) + { + // TODO-XARCH-CQ: We should support long/ulong multiplication + break; + } } #if defined(TARGET_X86) diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106372/Runtime_106372.cs b/src/tests/JIT/Regression/JitBlue/Runtime_106372/Runtime_106372.cs new file mode 100644 index 00000000000000..9f983740eb2ca9 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106372/Runtime_106372.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. + +using System; +using System.Runtime.Intrinsics; +using Xunit; + +// Found by Antigen +// Reduced from 161.42 KB to 874 B. +// Further reduced by hand. +// +// Assert failure(PID 35056 [0x000088f0], Thread: 28500 [0x6f54]): Assertion failed 'unreached' in 'TestClass:Method0():this' during 'Importation' (IL size 116; hash 0x46e9aa75; Tier0) +// File: C:\wk\runtime\src\coreclr\jit\gentree.cpp:22552 +// Image: C:\wk\runtime\artifacts\tests\coreclr\windows.x86.Checked\Tests\Core_Root\corerun.exe + +public class Runtime_106372 +{ + static long s_long_11 = 1; + + public static void TestEntryPoint() + { + Vector128 result = Vector128.CreateSequence(s_long_11, -2); + Assert.Equal(Vector128.Create(+1L, -1L), result); + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_106372/Runtime_106372.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_106372/Runtime_106372.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_106372/Runtime_106372.csproj @@ -0,0 +1,8 @@ + + + True + + + + + From ea363cc8269f588cbaa9aee1cf78cfba92efb92b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 12:59:59 -0700 Subject: [PATCH 095/748] Ensure required properties are validated before invoking the deserialization constructor. (#107126) Co-authored-by: Eirik Tsarpalis --- ...ParameterizedConstructorConverter.Large.cs | 3 --- ...ParameterizedConstructorConverter.Small.cs | 2 -- ...ctWithParameterizedConstructorConverter.cs | 17 +++++++++++++---- .../tests/Common/RequiredKeywordTests.cs | 19 +++++++++++++++++++ .../Serialization/RequiredKeywordTests.cs | 1 + 5 files changed, 33 insertions(+), 9 deletions(-) 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 6aa1117eefac8e..b65c994abd1eea 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 @@ -28,9 +28,6 @@ protected sealed override bool ReadAndCacheConstructorArgument(scoped ref ReadSt } ((object[])state.Current.CtorArgumentState!.Arguments)[jsonParameterInfo.Position] = arg!; - - // if this is required property IgnoreNullTokensOnRead will always be false because we don't allow for both to be true - state.Current.MarkRequiredPropertyAsRead(jsonParameterInfo.MatchingProperty); } return success; diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.Small.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.Small.cs index b6ad9089c48106..292f19b3d0ff29 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.Small.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.Small.cs @@ -80,8 +80,6 @@ private static bool TryRead( ThrowHelper.ThrowJsonException_ConstructorParameterDisallowNull(info.Name, state.Current.JsonTypeInfo.Type); } } - - state.Current.MarkRequiredPropertyAsRead(jsonParameterInfo.MatchingProperty); } arg = value; diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.cs index 6ae225b57457fb..f18b9060acf1fc 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.cs @@ -58,6 +58,11 @@ internal sealed override bool OnTryRead(ref Utf8JsonReader reader, Type typeToCo ReadConstructorArguments(ref state, ref reader, options); + // We've read all ctor parameters and properties, + // validate that all required parameters were provided + // before calling the constructor which may throw. + state.Current.ValidateAllRequiredPropertiesAreRead(jsonTypeInfo); + obj = (T)CreateObject(ref state.Current); jsonTypeInfo.OnDeserializing?.Invoke(obj); @@ -192,6 +197,11 @@ internal sealed override bool OnTryRead(ref Utf8JsonReader reader, Type typeToCo return false; } + // We've read all ctor parameters and properties, + // validate that all required parameters were provided + // before calling the constructor which may throw. + state.Current.ValidateAllRequiredPropertiesAreRead(jsonTypeInfo); + obj = (T)CreateObject(ref state.Current); if ((state.Current.MetadataPropertyNames & MetadataPropertyName.Id) != 0) @@ -219,9 +229,6 @@ internal sealed override bool OnTryRead(ref Utf8JsonReader reader, Type typeToCo if (propValue is not null || !jsonPropertyInfo.IgnoreNullTokensOnRead || default(T) is not null) { jsonPropertyInfo.Set(obj, propValue); - - // if this is required property IgnoreNullTokensOnRead will always be false because we don't allow for both to be true - state.Current.MarkRequiredPropertyAsRead(jsonPropertyInfo); } } else @@ -249,7 +256,6 @@ internal sealed override bool OnTryRead(ref Utf8JsonReader reader, Type typeToCo } jsonTypeInfo.OnDeserialized?.Invoke(obj); - state.Current.ValidateAllRequiredPropertiesAreRead(jsonTypeInfo); // Unbox Debug.Assert(obj != null); @@ -606,6 +612,9 @@ protected static bool TryLookupConstructorParameter( out bool useExtensionProperty, createExtensionProperty: false); + // Mark the property as read from the payload if required. + state.Current.MarkRequiredPropertyAsRead(jsonPropertyInfo); + jsonParameterInfo = jsonPropertyInfo.AssociatedParameter; if (jsonParameterInfo != null) { diff --git a/src/libraries/System.Text.Json/tests/Common/RequiredKeywordTests.cs b/src/libraries/System.Text.Json/tests/Common/RequiredKeywordTests.cs index 22c50becfa020c..9b70145773653d 100644 --- a/src/libraries/System.Text.Json/tests/Common/RequiredKeywordTests.cs +++ b/src/libraries/System.Text.Json/tests/Common/RequiredKeywordTests.cs @@ -727,6 +727,25 @@ public static IEnumerable InheritedPersonWithRequiredMembersSetsRequir }; } + [Fact] + public async Task ClassWithNullValidatingConstructor_ValidatesRequiredParameterBeforeCallingCtor() + { + // Regression test for https://github.com/dotnet/runtime/issues/107065 + JsonSerializerOptions options = new(Serializer.DefaultOptions) { RespectRequiredConstructorParameters = true }; + JsonException ex = await Assert.ThrowsAsync(() => Serializer.DeserializeWrapper("{}", options)); + Assert.Null(ex.InnerException); + } + + public class ClassWithNullValidatingConstructor + { + public ClassWithNullValidatingConstructor(string value) + { + Value = value ?? throw new ArgumentNullException(nameof(value)); + } + + public string Value { get; } + } + private static JsonTypeInfo GetTypeInfo(JsonSerializerOptions options) { options.TypeInfoResolver ??= JsonSerializerOptions.Default.TypeInfoResolver; diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/RequiredKeywordTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/RequiredKeywordTests.cs index 0515f0553bc42a..045ee191d7caba 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/RequiredKeywordTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/RequiredKeywordTests.cs @@ -33,6 +33,7 @@ public RequiredKeywordTests_SourceGen() [JsonSerializable(typeof(ClassWithRequiredKeywordAndJsonRequiredCustomAttribute))] [JsonSerializable(typeof(ClassWithCustomRequiredPropertyName))] [JsonSerializable(typeof(DerivedClassWithRequiredInitOnlyProperty))] + [JsonSerializable(typeof(ClassWithNullValidatingConstructor))] internal sealed partial class RequiredKeywordTestsContext : JsonSerializerContext { } From af1b39a3d8bb2221ab1021f20ba6f87ef9c5c9ef Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Wed, 4 Sep 2024 13:18:24 -0700 Subject: [PATCH 096/748] [release/9.0] Fix RunClassConstructor trim warning for Nullable (#107039) * Clean up RunClassConstructor test - Fix test name - Run it in ILC tests - Check warnings in analyzer tests * Fix RunClassConstructor intrinsic for Nullable --------- Co-authored-by: Jeff Schwartz --- .../ILCompiler.Trimming.Tests/TestCases/TestSuites.cs | 1 + .../src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs | 2 ++ .../test/ILLink.RoslynAnalyzer.Tests/ReflectionTests.cs | 6 ++++++ .../ReflectionTests.g.cs | 6 ------ ...ructorUsedViaReflection.cs => RunClassConstructor.cs} | 9 ++++++++- 5 files changed, 17 insertions(+), 7 deletions(-) rename src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/{RunClassConstructorUsedViaReflection.cs => RunClassConstructor.cs} (95%) diff --git a/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCases/TestSuites.cs b/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCases/TestSuites.cs index d4156edab60cf5..1adbd655afa5d4 100644 --- a/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCases/TestSuites.cs +++ b/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCases/TestSuites.cs @@ -74,6 +74,7 @@ public void Reflection (string t) case "ParametersUsedViaReflection": case "UnsafeAccessor": case "TypeUsedViaReflection": + case "RunClassConstructor": Run (t); break; default: diff --git a/src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs b/src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs index 902103f4af9444..bce23ec2c2f0d9 100644 --- a/src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs +++ b/src/tools/illink/src/ILLink.Shared/TrimAnalysis/HandleCallAction.cs @@ -293,6 +293,8 @@ ValueWithDynamicallyAccessedMembers valueWithDynamicallyAccessedMembers } else if (typeHandleValue is RuntimeTypeHandleForValueWithDynamicallyAccessedMembers damAnnotatedHandle && (damAnnotatedHandle.UnderlyingTypeValue.DynamicallyAccessedMemberTypes & DynamicallyAccessedMemberTypes.NonPublicConstructors) != 0) { // No action needed, NonPublicConstructors keeps the static constructor on the type + } else if (typeHandleValue is RuntimeTypeHandleForNullableSystemTypeValue) { + // No action needed, RunClassConstructor does not run the class constructor of the underlying type of Nullable } else { _diagnosticContext.AddDiagnostic (DiagnosticId.UnrecognizedTypeInRuntimeHelpersRunClassConstructor, calledMethod.GetDisplayName ()); } diff --git a/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/ReflectionTests.cs b/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/ReflectionTests.cs index c3cae702e3e929..f9abc684c0f24f 100644 --- a/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/ReflectionTests.cs +++ b/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/ReflectionTests.cs @@ -160,6 +160,12 @@ public Task PropertiesUsedViaReflection () return RunTest (); } + [Fact] + public Task RunClassConstructor () + { + return RunTest (); + } + [Fact] public Task RuntimeReflectionExtensionsCalls () { diff --git a/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/ReflectionTests.g.cs b/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/ReflectionTests.g.cs index fa45ca4ce1687f..7c6ee277555df1 100644 --- a/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/ReflectionTests.g.cs +++ b/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/ReflectionTests.g.cs @@ -55,12 +55,6 @@ public Task ParametersUsedViaReflection () return RunTest (allowMissingWarnings: true); } - [Fact] - public Task RunClassConstructorUsedViaReflection () - { - return RunTest (allowMissingWarnings: true); - } - [Fact] public Task TypeHierarchyLibraryModeSuppressions () { diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructorUsedViaReflection.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructor.cs similarity index 95% rename from src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructorUsedViaReflection.cs rename to src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructor.cs index 18ed715e5f7c7f..20812c86edf305 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructorUsedViaReflection.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructor.cs @@ -8,7 +8,7 @@ namespace Mono.Linker.Tests.Cases.Reflection { [SetupCSharpCompilerToUse ("csc")] [ExpectedNoWarnings] - public class RunClassConstructorUsedViaReflection + public class RunClassConstructor { public static void Main () { @@ -21,6 +21,7 @@ public static void Main () TestPublicConstructorDataFlowType (); TestIfElseUsingRuntimeTypeHandle (1); TestIfElseUsingType (1); + TestNullableValueType (); } [Kept] @@ -125,6 +126,12 @@ static void TestIfElseUsingType (int i) RuntimeHelpers.RunClassConstructor (myType.TypeHandle); } + [Kept] + static void TestNullableValueType () + { + RuntimeHelpers.RunClassConstructor (typeof (int?).TypeHandle); + } + [Kept] [KeptMember (".cctor()")] class OnlyUsedViaReflection From 810c806836ee3080ed81e2bb3ac2496d83a71b86 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 15:29:06 -0600 Subject: [PATCH 097/748] Disable MemoryStream_SeekOverflow_Throws (#107298) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: David Cantú --- .../tests/System.IO.Tests/MemoryStream/MemoryStreamTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Runtime/tests/System.IO.Tests/MemoryStream/MemoryStreamTests.cs b/src/libraries/System.Runtime/tests/System.IO.Tests/MemoryStream/MemoryStreamTests.cs index baa158060cfc40..ae2961f111a2dd 100644 --- a/src/libraries/System.Runtime/tests/System.IO.Tests/MemoryStream/MemoryStreamTests.cs +++ b/src/libraries/System.Runtime/tests/System.IO.Tests/MemoryStream/MemoryStreamTests.cs @@ -104,6 +104,7 @@ from bufferContext in [MemberData(nameof(MemoryStream_PositionOverflow_Throws_MemberData))] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "https://github.com/dotnet/runtime/issues/92467")] [ActiveIssue("https://github.com/dotnet/runtime/issues/100225", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoRuntime), nameof(PlatformDetection.IsWindows), nameof(PlatformDetection.IsX64Process))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/100558", TestPlatforms.Linux)] public void MemoryStream_SeekOverflow_Throws(SeekMode mode, int bufferSize, int origin) { byte[] buffer = new byte[bufferSize]; From c7de65f0cc3d159a6d00a037cf93e3f1ea44c684 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 15:29:22 -0600 Subject: [PATCH 098/748] Fix docs file names and add validation (#107359) Co-authored-by: Eric StJohn --- eng/intellisense.targets | 2 +- src/libraries/sfx.proj | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/eng/intellisense.targets b/eng/intellisense.targets index 7e1cb0054d3115..b412e33e4de6ae 100644 --- a/eng/intellisense.targets +++ b/eng/intellisense.targets @@ -11,7 +11,7 @@ $(IntellisensePackageXmlFilePathFromNetFolder) $(IntellisensePackageXmlFilePathFromDotNetPlatExtFolder) - $(IntermediateOutputPath)$(TargetName).intellisense-package.xml + $([MSBuild]::NormalizePath('$(IntermediateOutputPath)', 'intellisense-package', '$(TargetName).xml')) $(NoWarn);CS1591 diff --git a/src/libraries/sfx.proj b/src/libraries/sfx.proj index 9b174d57c90f0a..cb04ad97f3b230 100644 --- a/src/libraries/sfx.proj +++ b/src/libraries/sfx.proj @@ -73,6 +73,27 @@ UseHardlinksIfPossible="true" /> + + + + <_expectedRef Include="@(NetCoreAppLibrary)" Condition="!$([System.String]::new('%(Identity)').StartsWith('System.Private'))" /> + <_expectedSharedFrameworkFile Include="@(_expectedRefs->'$(MicrosoftNetCoreAppRefPackRefDir)%(Identity).dll')" /> + + + <_expectedDoc Include="@(_expectedRefs)" Exclude="netstandard;@(NetFxReference)" /> + <_expectedSharedFrameworkFile Include="@(_expectedDoc->'$(MicrosoftNetCoreAppRefPackRefDir)%(Identity).xml')" /> + + + <_expectedLib Include="@(NetCoreAppLibrary)" Exclude="System.Private.CoreLib" /> + <_expectedSharedFrameworkFile Include="@(_expectedLib->'$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)%(Identity).dll')" /> + + <_missingSharedFrameworkFile Include="@(_expectedSharedFrameworkFile)" Exclude="@(_expectedSharedFrameworkFile->Exists())" /> + + + + + From e73e023d99a1c17e8814036a7bca6c8146b90432 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 15:31:56 -0600 Subject: [PATCH 099/748] Disable NoCallback_RevokedCertificate_NoRevocationChecking_Succeeds test on Alpine (#107035) Co-authored-by: Radek Zikmund --- .../System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs | 1 + 1 file changed, 1 insertion(+) 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 c72425ef3dbd7a..4dc2eb3fcfdeaf 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs @@ -229,6 +229,7 @@ public async Task NoCallback_BadCertificate_ThrowsException(string url) [OuterLoop("Uses external servers")] [ConditionalFact(nameof(ClientSupportsDHECipherSuites))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/106634", typeof(PlatformDetection), nameof(PlatformDetection.IsAlpine))] public async Task NoCallback_RevokedCertificate_NoRevocationChecking_Succeeds() { using (HttpClient client = CreateHttpClient()) From 058be4f97dbd39ba6a6854ffd55f327ac4780396 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 17:19:55 -0700 Subject: [PATCH 100/748] [release/9.0] Fix meter/instrument filtering in MetricsEventSource (#107373) * Fix meter/instrument filtering in MetricsEventSource * Address the feedback --------- Co-authored-by: Tarek Mahmoud Sayed --- .../src/System/Diagnostics/Metrics/MetricsEventSource.cs | 6 ------ .../tests/MetricEventSourceTests.cs | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) 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 b6c05113bbc6f2..70b74e9613f069 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 @@ -649,12 +649,6 @@ private void ParseSpecs(string? metricsSpecs) return; } - if (metricsSpecs.Length == 0) - { - _aggregationManager!.IncludeAll(); - return; - } - string[] specStrings = metricsSpecs.Split(s_instrumentSeparators, StringSplitOptions.RemoveEmptyEntries); foreach (string specString in specStrings) { diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/MetricEventSourceTests.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/MetricEventSourceTests.cs index e622e38da8d74c..46ace10f708615 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/MetricEventSourceTests.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/MetricEventSourceTests.cs @@ -249,7 +249,7 @@ public void SingleListener_Wildcard() Counter c3 = meter3.CreateCounter("counter3"); EventWrittenEventArgs[] events; - using (MetricsEventListener listener = new MetricsEventListener(_output, MetricsEventListener.TimeSeriesValues, isShared: true, IntervalSecs, "")) + using (MetricsEventListener listener = new MetricsEventListener(_output, MetricsEventListener.TimeSeriesValues, isShared: true, IntervalSecs, "*")) { listener.WaitForCollectionStop(s_waitForEventTimeout, 1); c.Add(5); @@ -1788,7 +1788,7 @@ private static void AssertInstrumentPublishingEventsPresent(EventWrittenEventArg Assert.Equal(Helpers.FormatTags(i.Tags), e.InstrumentTags); Assert.Equal(Helpers.FormatTags(i.Meter.Tags), e.MeterTags); Assert.Equal(Helpers.FormatObjectHash(i.Meter.Scope), e.ScopeHash); - Assert.True(e.InstrumentId > 0); + Assert.True(e.InstrumentId >= 0); // It is possible getting Id 0 with InstrumentPublished event when measurements are not enabling (e.g. CounterRateValuePublished event) } Assert.Equal(expectedInstruments.Length, publishEvents.Length); From 84ec6ab1e682eef624d1ddb92500fe67d06ebd3d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 09:06:27 -0600 Subject: [PATCH 101/748] [release/9.0] Run stress pipelines on release/9.0 (#107356) * Run stress pipelines on release/9.0 * Fix Windows HttpStress runs on pipelines (#107178) * Use docker compose workaround from SslStress in HttpStress * Attempt 2 * Attempt 3 --------- Co-authored-by: Anton Firszov --------- Co-authored-by: Radek Zikmund Co-authored-by: Radek Zikmund <32671551+rzikm@users.noreply.github.com> Co-authored-by: Anton Firszov --- eng/pipelines/libraries/stress/http.yml | 9 ++++++++- eng/pipelines/libraries/stress/ssl.yml | 1 + .../StressTests/HttpStress/run-docker-compose.ps1 | 12 ++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/libraries/stress/http.yml b/eng/pipelines/libraries/stress/http.yml index ee772d0da0e95c..3290eda51ae02f 100644 --- a/eng/pipelines/libraries/stress/http.yml +++ b/eng/pipelines/libraries/stress/http.yml @@ -12,6 +12,7 @@ schedules: include: - main - release/8.0 + - release/9.0 variables: - template: ../variables.yml @@ -99,7 +100,10 @@ extends: displayName: Docker NanoServer timeoutInMinutes: 150 variables: - DUMPS_SHARE_MOUNT_ROOT: "C:/dumps-share" + # This will get assigned to the DUMPS_SHARE_MOUNT_ROOT environment + # variable in the stress test script. We need to keep the + # DUMPS_SHARE_MOUNT_ROOT variable empty during the build step. + DUMPS_SHARE_MOUNT_ROOT_PATH: "C:/dumps-share" # The 1es-windows-2022-open image has an issue where the Chocolatey-installed V1 docker-compose takes precendence over the # V2 docker-compose required by the stress tests, see: https://github.com/actions/runner-images/issues/7080 @@ -140,6 +144,7 @@ extends: - powershell: | cd '$(httpStressProject)' + $env:DUMPS_SHARE_MOUNT_ROOT = $env:DUMPS_SHARE_MOUNT_ROOT_PATH $env:CLIENT_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/client/3.0" $env:SERVER_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/server/3.0" New-Item -Force $env:CLIENT_DUMPS_SHARE -ItemType Directory @@ -152,6 +157,7 @@ extends: - powershell: | cd '$(httpStressProject)' + $env:DUMPS_SHARE_MOUNT_ROOT = $env:DUMPS_SHARE_MOUNT_ROOT_PATH $env:CLIENT_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/client/2.0" $env:SERVER_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/server/2.0" New-Item -Force $env:CLIENT_DUMPS_SHARE -ItemType Directory @@ -164,6 +170,7 @@ extends: - powershell: | cd '$(httpStressProject)' + $env:DUMPS_SHARE_MOUNT_ROOT = $env:DUMPS_SHARE_MOUNT_ROOT_PATH $env:CLIENT_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/client/1.1" $env:SERVER_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/server/1.1" New-Item -Force $env:CLIENT_DUMPS_SHARE -ItemType Directory diff --git a/eng/pipelines/libraries/stress/ssl.yml b/eng/pipelines/libraries/stress/ssl.yml index 602e5bcf73d109..230a2bef377304 100644 --- a/eng/pipelines/libraries/stress/ssl.yml +++ b/eng/pipelines/libraries/stress/ssl.yml @@ -12,6 +12,7 @@ schedules: include: - main - release/8.0 + - release/9.0 variables: - template: ../variables.yml diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/run-docker-compose.ps1 b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/run-docker-compose.ps1 index 2b16072e2e6b70..67e28756d9dfd3 100755 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/run-docker-compose.ps1 +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/run-docker-compose.ps1 @@ -16,6 +16,14 @@ Param( $REPO_ROOT_DIR = $(git -C "$PSScriptRoot" rev-parse --show-toplevel) $COMPOSE_FILE = "$PSScriptRoot/docker-compose.yml" +# This is a workaround for an issue with 1es-windows-2022-open, which should be eventually removed. +# See comments in /eng/pipelines/libraries/stress/ssl.yml for more info. +$dockerComposeCmd = $env:DOCKER_COMPOSE_CMD +if (!(Test-Path $dockerComposeCmd)) +{ + $dockerComposeCmd = "docker-compose" +} + # Build runtime libraries and place in a docker image if ($buildCurrentLibraries) @@ -60,7 +68,7 @@ if ($useWindowsContainers) $originalErrorPreference = $ErrorActionPreference $ErrorActionPreference = 'Continue' try { - docker-compose --log-level DEBUG --file "$COMPOSE_FILE" build $BUILD_ARGS.Split() 2>&1 | ForEach-Object { "$_" } + & $dockerComposeCmd --log-level DEBUG --file "$COMPOSE_FILE" build $BUILD_ARGS.Split() 2>&1 | ForEach-Object { "$_" } if ($LASTEXITCODE -ne 0) { throw "docker-compose exited with error code $LASTEXITCODE" } @@ -89,5 +97,5 @@ if (!$buildOnly) $env:HTTPSTRESS_CLIENT_ARGS = $clientStressArgs $env:HTTPSTRESS_SERVER_ARGS = $serverStressArgs - docker-compose --file "$COMPOSE_FILE" up --abort-on-container-exit + & $dockerComposeCmd --file "$COMPOSE_FILE" up --abort-on-container-exit } From f8a5fd9c90cb1da67d30442f93991c51d9402362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?= <1175054+carlossanlop@users.noreply.github.com> Date: Wed, 4 Sep 2024 17:32:10 -0700 Subject: [PATCH 102/748] Update to zlib-ng 2.2.1, excluding the folders: - docs/ - test/ - arch/s390/self-hosted-builder/ --- src/native/external/zlib-ng/CMakeLists.txt | 403 ++++++++++++------ src/native/external/zlib-ng/FAQ.zlib | 3 +- src/native/external/zlib-ng/LICENSE.md | 2 +- src/native/external/zlib-ng/Makefile.in | 46 +- src/native/external/zlib-ng/PORTING.md | 32 ++ src/native/external/zlib-ng/README.md | 30 +- src/native/external/zlib-ng/adler32.c | 54 +-- .../external/zlib-ng/arch/arm/Makefile.in | 7 - .../external/zlib-ng/arch/arm/adler32_neon.c | 4 +- .../external/zlib-ng/arch/arm/arm_features.c | 17 +- .../external/zlib-ng/arch/arm/arm_features.h | 6 +- .../external/zlib-ng/arch/arm/arm_functions.h | 65 +++ .../external/zlib-ng/arch/arm/chunkset_neon.c | 4 +- .../zlib-ng/arch/arm/compare256_neon.c | 5 +- .../external/zlib-ng/arch/arm/crc32_acle.c | 2 +- .../external/zlib-ng/arch/arm/neon_intrins.h | 7 + .../zlib-ng/arch/arm/slide_hash_armv6.c | 7 +- .../zlib-ng/arch/arm/slide_hash_neon.c | 7 +- .../external/zlib-ng/arch/generic/Makefile.in | 57 ++- .../external/zlib-ng/arch/generic/adler32_c.c | 54 +++ .../zlib-ng/arch/generic/adler32_fold_c.c | 15 + .../zlib-ng/arch/generic/chunkset_c.c | 42 ++ .../zlib-ng/arch/generic/compare256_c.c | 181 ++++++++ .../zlib-ng/arch/generic/crc32_braid_c.c | 215 ++++++++++ .../zlib-ng/arch/generic/crc32_fold_c.c | 31 ++ .../zlib-ng/arch/generic/generic_functions.h | 106 +++++ .../zlib-ng/arch/generic/slide_hash_c.c | 52 +++ .../zlib-ng/arch/power/chunkset_power8.c | 2 +- .../zlib-ng/arch/power/compare256_power9.c | 6 +- .../zlib-ng/arch/power/power_features.c | 7 +- .../zlib-ng/arch/power/power_features.h | 6 +- .../zlib-ng/arch/power/power_functions.h | 67 +++ .../zlib-ng/arch/power/slide_ppc_tpl.h | 3 +- .../external/zlib-ng/arch/riscv/adler32_rvv.c | 4 +- .../zlib-ng/arch/riscv/compare256_rvv.c | 4 +- .../zlib-ng/arch/riscv/riscv_features.c | 11 +- .../zlib-ng/arch/riscv/riscv_features.h | 6 +- .../zlib-ng/arch/riscv/riscv_functions.h | 49 +++ .../zlib-ng/arch/riscv/slide_hash_rvv.c | 11 +- .../external/zlib-ng/arch/s390/Makefile.in | 6 - .../external/zlib-ng/arch/s390/README.md | 75 ++-- .../external/zlib-ng/arch/s390/crc32-vx.c | 4 +- .../zlib-ng/arch/s390/dfltcc_common.h | 91 +++- .../zlib-ng/arch/s390/dfltcc_deflate.c | 39 +- .../zlib-ng/arch/s390/dfltcc_deflate.h | 8 +- .../zlib-ng/arch/s390/dfltcc_detail.h | 149 +++---- .../zlib-ng/arch/s390/dfltcc_inflate.c | 42 +- .../zlib-ng/arch/s390/dfltcc_inflate.h | 7 +- .../zlib-ng/arch/s390/s390_features.c | 2 +- .../zlib-ng/arch/s390/s390_features.h | 4 + .../zlib-ng/arch/s390/s390_functions.h | 20 + .../external/zlib-ng/arch/x86/Makefile.in | 11 +- .../external/zlib-ng/arch/x86/adler32_avx2.c | 17 +- .../zlib-ng/arch/x86/adler32_avx512.c | 13 +- .../zlib-ng/arch/x86/adler32_avx512_vnni.c | 21 +- .../external/zlib-ng/arch/x86/adler32_sse42.c | 5 +- .../external/zlib-ng/arch/x86/adler32_ssse3.c | 4 +- .../zlib-ng/arch/x86/chunkset_ssse3.c | 14 +- .../zlib-ng/arch/x86/compare256_avx2.c | 5 +- .../zlib-ng/arch/x86/compare256_sse2.c | 5 +- .../arch/x86/crc32_fold_pclmulqdq_tpl.h | 35 +- .../zlib-ng/arch/x86/crc32_pclmulqdq_tpl.h | 26 +- .../zlib-ng/arch/x86/crc32_vpclmulqdq.c | 2 +- .../zlib-ng/arch/x86/slide_hash_avx2.c | 5 +- .../zlib-ng/arch/x86/slide_hash_sse2.c | 5 +- .../external/zlib-ng/arch/x86/x86_features.c | 24 +- .../external/zlib-ng/arch/x86/x86_features.h | 14 +- .../external/zlib-ng/arch/x86/x86_functions.h | 172 ++++++++ .../external/zlib-ng/arch/x86/x86_intrins.h | 4 +- src/native/external/zlib-ng/arch_functions.h | 29 ++ src/native/external/zlib-ng/chunkset_tpl.h | 8 +- .../zlib-ng/cmake/detect-intrinsics.cmake | 279 +++++++----- src/native/external/zlib-ng/configure | 256 ++++++----- src/native/external/zlib-ng/cpu_features.h | 264 +----------- src/native/external/zlib-ng/crc32.c | 42 ++ src/native/external/zlib-ng/crc32.h | 16 + .../external/zlib-ng/crc32_braid_comb.c | 1 - src/native/external/zlib-ng/crc32_braid_p.h | 22 +- src/native/external/zlib-ng/deflate.c | 243 ++++++++--- src/native/external/zlib-ng/deflate.h | 56 ++- src/native/external/zlib-ng/deflate_fast.c | 14 +- src/native/external/zlib-ng/deflate_huff.c | 2 +- src/native/external/zlib-ng/deflate_medium.c | 57 +-- src/native/external/zlib-ng/deflate_p.h | 16 +- src/native/external/zlib-ng/deflate_quick.c | 7 +- src/native/external/zlib-ng/deflate_rle.c | 6 +- src/native/external/zlib-ng/deflate_slow.c | 15 +- src/native/external/zlib-ng/deflate_stored.c | 4 +- .../external/zlib-ng/fallback_builtins.h | 3 - src/native/external/zlib-ng/functable.c | 79 +--- src/native/external/zlib-ng/functable.h | 31 +- src/native/external/zlib-ng/gzguts.h | 6 +- src/native/external/zlib-ng/gzlib.c | 8 +- src/native/external/zlib-ng/infback.c | 19 +- src/native/external/zlib-ng/inflate.c | 218 ++++++---- src/native/external/zlib-ng/inflate.h | 29 +- src/native/external/zlib-ng/inflate_p.h | 21 +- src/native/external/zlib-ng/inftrees.c | 6 +- src/native/external/zlib-ng/insert_string.c | 10 +- .../external/zlib-ng/insert_string_roll.c | 4 +- .../external/zlib-ng/insert_string_tpl.h | 15 +- src/native/external/zlib-ng/match_tpl.h | 19 +- src/native/external/zlib-ng/tools/makecrct.c | 6 - src/native/external/zlib-ng/trees.c | 66 +-- .../external/zlib-ng/win32/Makefile.a64 | 105 ++--- .../external/zlib-ng/win32/Makefile.arm | 99 +++-- .../external/zlib-ng/win32/Makefile.msc | 147 ++++--- .../external/zlib-ng/win32/depcheck.cpp | 321 ++++++++++++++ src/native/external/zlib-ng/win32/zlib-ng1.rc | 2 +- src/native/external/zlib-ng/win32/zlib1.rc | 2 +- src/native/external/zlib-ng/zbuild.h | 67 +++ src/native/external/zlib-ng/zconf-ng.h.in | 2 +- src/native/external/zlib-ng/zconf.h.in | 2 +- .../external/zlib-ng/zlib-config.cmake.in | 12 + .../external/zlib-ng/zlib-ng-config.cmake.in | 10 + src/native/external/zlib-ng/zlib-ng.h.in | 14 +- src/native/external/zlib-ng/zlib.h.in | 24 +- src/native/external/zlib-ng/zlib.map | 1 + src/native/external/zlib-ng/zutil.c | 50 +-- src/native/external/zlib-ng/zutil.h | 14 +- src/native/external/zlib-ng/zutil_p.h | 12 +- 121 files changed, 3491 insertions(+), 1729 deletions(-) create mode 100644 src/native/external/zlib-ng/arch/arm/arm_functions.h create mode 100644 src/native/external/zlib-ng/arch/generic/adler32_c.c create mode 100644 src/native/external/zlib-ng/arch/generic/adler32_fold_c.c create mode 100644 src/native/external/zlib-ng/arch/generic/chunkset_c.c create mode 100644 src/native/external/zlib-ng/arch/generic/compare256_c.c create mode 100644 src/native/external/zlib-ng/arch/generic/crc32_braid_c.c create mode 100644 src/native/external/zlib-ng/arch/generic/crc32_fold_c.c create mode 100644 src/native/external/zlib-ng/arch/generic/generic_functions.h create mode 100644 src/native/external/zlib-ng/arch/generic/slide_hash_c.c create mode 100644 src/native/external/zlib-ng/arch/power/power_functions.h create mode 100644 src/native/external/zlib-ng/arch/riscv/riscv_functions.h create mode 100644 src/native/external/zlib-ng/arch/s390/s390_functions.h create mode 100644 src/native/external/zlib-ng/arch/x86/x86_functions.h create mode 100644 src/native/external/zlib-ng/arch_functions.h create mode 100644 src/native/external/zlib-ng/crc32.c create mode 100644 src/native/external/zlib-ng/crc32.h create mode 100644 src/native/external/zlib-ng/win32/depcheck.cpp create mode 100644 src/native/external/zlib-ng/zlib-config.cmake.in create mode 100644 src/native/external/zlib-ng/zlib-ng-config.cmake.in diff --git a/src/native/external/zlib-ng/CMakeLists.txt b/src/native/external/zlib-ng/CMakeLists.txt index 8bcfaf7ea23e4e..719673fbf34a1a 100644 --- a/src/native/external/zlib-ng/CMakeLists.txt +++ b/src/native/external/zlib-ng/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.5.1) if(CMAKE_VERSION VERSION_LESS 3.12) cmake_policy(VERSION ${CMAKE_VERSION}) else() - cmake_policy(VERSION 3.5.1...3.13.2) + cmake_policy(VERSION 3.5.1...3.29.0) endif() message(STATUS "Using CMake version ${CMAKE_VERSION}") @@ -42,6 +42,7 @@ include(CheckCSourceCompiles) include(CheckCSourceRuns) include(CheckCCompilerFlag) include(CMakeDependentOption) +include(CMakePackageConfigHelpers) include(FeatureSummary) include(cmake/detect-arch.cmake) @@ -85,6 +86,7 @@ option(WITH_REDUCED_MEM "Reduced memory usage for special cases (reduces perform option(WITH_NEW_STRATEGIES "Use new strategies" ON) option(WITH_NATIVE_INSTRUCTIONS "Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)" OFF) +option(WITH_RUNTIME_CPU_DETECTION "Build with runtime detection of CPU architecture" ON) option(WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings" OFF) option(WITH_CODE_COVERAGE "Enable code coverage reporting" OFF) option(WITH_INFLATE_STRICT "Build with strict inflate distance checking" OFF) @@ -114,14 +116,14 @@ elseif(BASEARCH_S360_FOUND) option(WITH_DFLTCC_INFLATE "Build with DFLTCC intrinsics for decompression on IBM Z" OFF) option(WITH_CRC32_VX "Build with vectorized CRC32 on IBM Z" ON) elseif(BASEARCH_X86_FOUND) - option(WITH_AVX2 "Build with AVX2" ON) - option(WITH_AVX512 "Build with AVX512" ON) - option(WITH_AVX512VNNI "Build with AVX512 VNNI extensions" ON) option(WITH_SSE2 "Build with SSE2" ON) - option(WITH_SSSE3 "Build with SSSE3" ON) - option(WITH_SSE42 "Build with SSE42" ON) - option(WITH_PCLMULQDQ "Build with PCLMULQDQ" ON) - option(WITH_VPCLMULQDQ "Build with VPCLMULQDQ" ON) + cmake_dependent_option(WITH_SSSE3 "Build with SSSE3" ON "WITH_SSE2" OFF) + cmake_dependent_option(WITH_SSE42 "Build with SSE42" ON "WITH_SSSE3" OFF) + cmake_dependent_option(WITH_PCLMULQDQ "Build with PCLMULQDQ" ON "WITH_SSE42" OFF) + cmake_dependent_option(WITH_AVX2 "Build with AVX2" ON "WITH_SSE42" OFF) + cmake_dependent_option(WITH_AVX512 "Build with AVX512" ON "WITH_AVX2" OFF) + cmake_dependent_option(WITH_AVX512VNNI "Build with AVX512 VNNI extensions" ON "WITH_AVX512" OFF) + cmake_dependent_option(WITH_VPCLMULQDQ "Build with VPCLMULQDQ" ON "WITH_PCLMULQDQ;WITH_AVX512" OFF) endif() option(INSTALL_UTILS "Copy minigzip and minideflate during install" OFF) @@ -173,6 +175,12 @@ if(CMAKE_C_COMPILER_ID MATCHES "^Intel") set(WARNFLAGS_MAINTAINER /W5) set(WARNFLAGS_DISABLE) endif() + check_c_compiler_flag(-diag-disable=10441 HAVE_DIAG_10441) + if(HAVE_DIAG_10441) + list(APPEND WARNFLAGS_DISABLE "-diag-disable=10441") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -diag-disable=10441") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -diag-disable=10441") + endif() elseif(MSVC) # Minimum supported MSVC version is 1800 = Visual Studio 12.0/2013 # See also https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html @@ -255,27 +263,68 @@ endif() # Set native march/mcpu if(WITH_NATIVE_INSTRUCTIONS) - if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - check_c_compiler_flag(-march=native HAVE_MARCH_NATIVE) - if(HAVE_MARCH_NATIVE) - set(NATIVEFLAG "-march=native") - else() - check_c_compiler_flag(-mcpu=native HAVE_MCPU_NATIVE) - if(HAVE_MCPU_NATIVE) - set(NATIVEFLAG "-mcpu=native") + if(NATIVE_ARCH_OVERRIDE) + message(STATUS "WARNING: WITH_NATIVE_INSTRUCTIONS enabled, but running with NATIVE_ARCH_OVERRIDE: ${NATIVE_ARCH_OVERRIDE}") + set(NATIVEFLAG "${NATIVE_ARCH_OVERRIDE}") + else() + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") + check_c_compiler_flag(-march=native HAVE_MARCH_NATIVE) + if(HAVE_MARCH_NATIVE) + set(NATIVEFLAG "-march=native") + else() + check_c_compiler_flag(-mcpu=native HAVE_MCPU_NATIVE) + if(HAVE_MCPU_NATIVE) + set(NATIVEFLAG "-mcpu=native") + endif() endif() + # Fall through endif() - # Fall through endif() if(NATIVEFLAG) - # Apply flag to all source files and compilation checks - add_compile_options(${NATIVEFLAG}) + # Apply flags to all source files and compilation checks + if(WIN32) + separate_arguments(NATIVEOPTIONS WINDOWS_COMMAND "${NATIVEFLAG}") + else() + separate_arguments(NATIVEOPTIONS UNIX_COMMAND "${NATIVEFLAG}") + endif() + add_compile_options(${NATIVEOPTIONS}) + set(WITH_RUNTIME_CPU_DETECTION OFF) else() message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not implemented yet on this configuration") set(WITH_NATIVE_INSTRUCTIONS OFF) endif() endif() +# Compile without functable or CPU detection +if(NOT WITH_RUNTIME_CPU_DETECTION) + if(MSVC AND BASEARCH_X86_FOUND) + message(STATUS "WARNING: Microsoft Visual Studio does not support compile time detection of CPU features for \"/arch\" before \"AVX\"") + # Workaround for MSVC. By default MSVC does not define the __SSE*__ macros. + # Fix it if AVX is enabled. + set(CMAKE_REQUIRED_FLAGS "${NATIVEFLAG}") + check_c_source_compiles( + "#ifndef __AVX__ + # error \"AVX is not enabled.\" + #endif + int main(void) { return 0; }" + MSVC_IS_ENABLED_AVX + ) + set(CMAKE_REQUIRED_FLAGS) + if(MSVC_IS_ENABLED_AVX) + add_definitions( + -D__SSE__=1 + -D__SSE2__=1 + -D__SSE3__=1 + -D__SSSE3__=1 + -D__SSE4_1__=1 + -D__SSE4_2__=1 + -D__PCLMUL__=1 + ) + endif() + endif() + add_definitions(-DDISABLE_RUNTIME_CPU_DETECTION) +endif() + # Force disable LTO if WITH_NATIVE_INSTRUCTIONS is not active if(NOT WITH_NATIVE_INSTRUCTIONS) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF) @@ -326,6 +375,14 @@ if(HAVE_SYS_SDT_H) endif() check_include_file(unistd.h HAVE_UNISTD_H) +# +# Check for Linux includes +# +check_include_file(linux/auxvec.h HAVE_LINUX_AUXVEC_H) +if(HAVE_LINUX_AUXVEC_H) + add_definitions(-DHAVE_LINUX_AUXVEC_H) +endif() + # # Check to see if we have large file support # @@ -427,6 +484,22 @@ if(HAVE_ATTRIBUTE_ALIGNED) add_definitions(-DHAVE_ATTRIBUTE_ALIGNED) endif() +# +# Check for __builtin_assume_aligned(x,n) support in the compiler +# +check_c_source_compiles( + "char *test(char *buffer) { + char *abuffer = __builtin_assume_aligned(buffer,64); + return abuffer; + } + int main() { + return 0; + }" + HAVE_BUILTIN_ASSUME_ALIGNED) +if(HAVE_BUILTIN_ASSUME_ALIGNED) + add_definitions(-DHAVE_BUILTIN_ASSUME_ALIGNED) +endif() + # # check for __builtin_ctz() support in the compiler # @@ -528,14 +601,15 @@ endif() # Enable reduced memory configuration # if(WITH_REDUCED_MEM) - add_definitions(-DHASH_SIZE=32768u -DGZBUFSIZE=8192) + add_definitions(-DHASH_SIZE=32768u -DGZBUFSIZE=8192 -DNO_LIT_MEM) message(STATUS "Configured for reduced memory environment") endif() +set(GENERIC_ARCHDIR "arch/generic") set(ZLIB_ARCH_SRCS) -set(ZLIB_ARCH_HDRS) -set(ARCHDIR "arch/generic") +set(ZLIB_ARCH_HDRS ${GENERIC_ARCHDIR}/generic_functions.h) + if(BASEARCH_ARM_FOUND) set(ARCHDIR "arch/arm") elseif(BASEARCH_PPC_FOUND) @@ -550,6 +624,7 @@ elseif(BASEARCH_X86_FOUND) add_feature_info(SSE2 1 "Support the SSE2 instruction set, using \"${SSE2FLAG}\"") endif() else() + set(ARCHDIR ${GENERIC_ARCHDIR}) message(STATUS "No optimized architecture: using ${ARCHDIR}") endif() @@ -620,13 +695,17 @@ if(WITH_OPTIM) endif() endif() endif() - list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/arm_features.h) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/arm_features.c) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/arm_functions.h) + if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/arm_features.h) + list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/arm_features.c) + endif() + if(WITH_ACLE) check_acle_compiler_flag() if(HAVE_ACLE_FLAG) add_definitions(-DARM_ACLE) - set(ACLE_SRCS ${ARCHDIR}/crc32_acle.c ${ARCHDIR}/insert_string_acle.c) + set(ACLE_SRCS ${ARCHDIR}/crc32_acle.c) set_property(SOURCE ${ACLE_SRCS} PROPERTY COMPILE_FLAGS "${ACLEFLAG} ${NOLTOFLAG}") list(APPEND ZLIB_ARCH_SRCS ${ACLE_SRCS}) add_feature_info(ACLE_CRC 1 "Support ACLE optimized CRC hash generation, using \"${ACLEFLAG}\"") @@ -685,10 +764,18 @@ if(WITH_OPTIM) if(WITH_POWER9) check_power9_intrinsics() endif() - if(HAVE_VMX OR HAVE_POWER8_INTRIN OR HAVE_POWER9_INTRIN) + if(POWER8_NEED_AUXVEC_H OR POWER9_NEED_AUXVEC_H) + add_definitions(-DPOWER_NEED_AUXVEC_H) + endif() + if(HAVE_POWER8_INTRIN OR HAVE_POWER9_INTRIN) add_definitions(-DPOWER_FEATURES) - list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/power_features.h) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/power_features.c) + endif() + if(HAVE_VMX OR HAVE_POWER8_INTRIN OR HAVE_POWER9_INTRIN) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/power_functions.h) + if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/power_features.h) + list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/power_features.c) + endif() endif() # VMX specific options and files if(WITH_ALTIVEC) @@ -737,11 +824,17 @@ if(WITH_OPTIM) if(HAVE_RVV_INTRIN) add_definitions(-DRISCV_FEATURES) add_definitions(-DRISCV_RVV) - list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/riscv_features.h) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/riscv_features.c) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/riscv_functions.h) + if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/riscv_features.h) + list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/riscv_features.c) + endif() # FIXME: we will not set compile flags for riscv_features.c when # the kernels update hwcap or hwprobe for riscv - set(RVV_SRCS ${ARCHDIR}/riscv_features.c ${ARCHDIR}/adler32_rvv.c ${ARCHDIR}/chunkset_rvv.c ${ARCHDIR}/compare256_rvv.c ${ARCHDIR}/slide_hash_rvv.c) + set(RVV_SRCS ${ARCHDIR}/adler32_rvv.c ${ARCHDIR}/chunkset_rvv.c ${ARCHDIR}/compare256_rvv.c ${ARCHDIR}/slide_hash_rvv.c) + if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND RVV_SRCS ${ARCHDIR}/riscv_features.c) + endif() list(APPEND ZLIB_ARCH_SRCS ${RVV_SRCS}) set_property(SOURCE ${RVV_SRCS} PROPERTY COMPILE_FLAGS "${RISCVFLAG} ${NOLTOFLAG}") else() @@ -752,11 +845,11 @@ if(WITH_OPTIM) check_s390_intrinsics() if(HAVE_S390_INTRIN) add_definitions(-DS390_FEATURES) - list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/s390_features.h) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/s390_features.c) - endif() - if(WITH_DFLTCC_DEFLATE OR WITH_DFLTCC_INFLATE) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/dfltcc_common.c) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/s390_functions.h) + if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/s390_features.h) + list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/s390_features.c) + endif() endif() if(WITH_DFLTCC_DEFLATE) add_definitions(-DS390_DFLTCC_DEFLATE) @@ -779,14 +872,80 @@ if(WITH_OPTIM) endif() elseif(BASEARCH_X86_FOUND) add_definitions(-DX86_FEATURES) - list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/x86_features.h) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/x86_features.c) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/x86_functions.h) + if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/x86_features.h) + list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/x86_features.c) + endif() if(MSVC) list(APPEND ZLIB_ARCH_HDRS fallback_builtins.h) endif() + check_xsave_intrinsics() + if(HAVE_XSAVE_INTRIN) + add_feature_info(XSAVE 1 "Support XSAVE intrinsics using \"${XSAVEFLAG}\"") + if(WITH_RUNTIME_CPU_DETECTION) + set_property(SOURCE ${ARCHDIR}/x86_features.c PROPERTY COMPILE_FLAGS "${XSAVEFLAG}") + endif() + if(NOT (CMAKE_C_COMPILER_ID MATCHES "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 8.2)) + add_definitions(-DX86_HAVE_XSAVE_INTRIN) + endif() + endif() + if(WITH_SSE2) + check_sse2_intrinsics() + if(HAVE_SSE2_INTRIN) + add_definitions(-DX86_SSE2) + set(SSE2_SRCS ${ARCHDIR}/chunkset_sse2.c ${ARCHDIR}/compare256_sse2.c ${ARCHDIR}/slide_hash_sse2.c) + list(APPEND ZLIB_ARCH_SRCS ${SSE2_SRCS}) + if(NOT ${ARCH} MATCHES "x86_64") + set_property(SOURCE ${SSE2_SRCS} PROPERTY COMPILE_FLAGS "${SSE2FLAG} ${NOLTOFLAG}") + add_feature_info(FORCE_SSE2 FORCE_SSE2 "Assume CPU is SSE2 capable") + if(FORCE_SSE2) + add_definitions(-DX86_NOCHECK_SSE2) + endif() + endif() + else() + set(WITH_SSE2 OFF) + endif() + endif() + if(WITH_SSSE3) + check_ssse3_intrinsics() + if(HAVE_SSSE3_INTRIN AND WITH_SSE2) + add_definitions(-DX86_SSSE3) + set(SSSE3_SRCS ${ARCHDIR}/adler32_ssse3.c ${ARCHDIR}/chunkset_ssse3.c) + add_feature_info(SSSE3_ADLER32 1 "Support SSSE3-accelerated adler32, using \"${SSSE3FLAG}\"") + list(APPEND ZLIB_ARCH_SRCS ${SSSE3_SRCS}) + set_property(SOURCE ${SSSE3_SRCS} PROPERTY COMPILE_FLAGS "${SSSE3FLAG} ${NOLTOFLAG}") + else() + set(WITH_SSSE3 OFF) + endif() + endif() + if(WITH_SSE42) + check_sse42_intrinsics() + if(HAVE_SSE42_INTRIN AND WITH_SSSE3) + add_definitions(-DX86_SSE42) + set(SSE42_SRCS ${ARCHDIR}/adler32_sse42.c) + add_feature_info(SSE42_CRC 1 "Support SSE4.2 optimized adler32 hash generation, using \"${SSE42FLAG}\"") + list(APPEND ZLIB_ARCH_SRCS ${SSE42_SRCS}) + set_property(SOURCE ${SSE42_SRCS} PROPERTY COMPILE_FLAGS "${SSE42FLAG} ${NOLTOFLAG}") + else() + set(WITH_SSE42 OFF) + endif() + endif() + if(WITH_PCLMULQDQ) + check_pclmulqdq_intrinsics() + if(HAVE_PCLMULQDQ_INTRIN AND WITH_SSE42) + add_definitions(-DX86_PCLMULQDQ_CRC) + set(PCLMULQDQ_SRCS ${ARCHDIR}/crc32_pclmulqdq.c) + add_feature_info(PCLMUL_CRC 1 "Support CRC hash generation using PCLMULQDQ, using \"${SSE42FLAG} ${PCLMULFLAG}\"") + list(APPEND ZLIB_ARCH_SRCS ${PCLMULQDQ_SRCS}) + set_property(SOURCE ${PCLMULQDQ_SRCS} PROPERTY COMPILE_FLAGS "${SSE42FLAG} ${PCLMULFLAG} ${NOLTOFLAG}") + else() + set(WITH_PCLMULQDQ OFF) + endif() + endif() if(WITH_AVX2) check_avx2_intrinsics() - if(HAVE_AVX2_INTRIN) + if(HAVE_AVX2_INTRIN AND WITH_SSE42) add_definitions(-DX86_AVX2) set(AVX2_SRCS ${ARCHDIR}/slide_hash_avx2.c) add_feature_info(AVX2_SLIDEHASH 1 "Support AVX2 optimized slide_hash, using \"${AVX2FLAG}\"") @@ -804,15 +963,12 @@ if(WITH_OPTIM) endif() if(WITH_AVX512) check_avx512_intrinsics() - if(HAVE_AVX512_INTRIN) + if(HAVE_AVX512_INTRIN AND WITH_AVX2) add_definitions(-DX86_AVX512) list(APPEND AVX512_SRCS ${ARCHDIR}/adler32_avx512.c) add_feature_info(AVX512_ADLER32 1 "Support AVX512-accelerated adler32, using \"${AVX512FLAG}\"") list(APPEND ZLIB_ARCH_SRCS ${AVX512_SRCS}) list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/adler32_avx512_p.h) - if(HAVE_MASK_INTRIN) - add_definitions(-DX86_MASK_INTRIN) - endif() set_property(SOURCE ${AVX512_SRCS} PROPERTY COMPILE_FLAGS "${AVX512FLAG} ${NOLTOFLAG}") else() set(WITH_AVX512 OFF) @@ -820,7 +976,7 @@ if(WITH_OPTIM) endif() if(WITH_AVX512VNNI) check_avx512vnni_intrinsics() - if(HAVE_AVX512VNNI_INTRIN) + if(HAVE_AVX512VNNI_INTRIN AND WITH_AVX2) add_definitions(-DX86_AVX512VNNI) add_feature_info(AVX512VNNI_ADLER32 1 "Support AVX512VNNI adler32, using \"${AVX512VNNIFLAG}\"") list(APPEND AVX512VNNI_SRCS ${ARCHDIR}/adler32_avx512_vnni.c) @@ -830,82 +986,17 @@ if(WITH_OPTIM) set(WITH_AVX512VNNI OFF) endif() endif() - if(WITH_SSE42) - check_sse42_intrinsics() - if(HAVE_SSE42_INTRIN) - add_definitions(-DX86_SSE42) - set(SSE42_SRCS ${ARCHDIR}/adler32_sse42.c ${ARCHDIR}/insert_string_sse42.c) - add_feature_info(SSE42_CRC 1 "Support SSE4.2 optimized CRC hash generation, using \"${SSE42FLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${SSE42_SRCS}) - set_property(SOURCE ${SSE42_SRCS} PROPERTY COMPILE_FLAGS "${SSE42FLAG} ${NOLTOFLAG}") - else() - set(WITH_SSE42 OFF) - endif() - endif() - if(WITH_SSE2) - check_sse2_intrinsics() - if(HAVE_SSE2_INTRIN) - add_definitions(-DX86_SSE2) - set(SSE2_SRCS ${ARCHDIR}/chunkset_sse2.c ${ARCHDIR}/compare256_sse2.c ${ARCHDIR}/slide_hash_sse2.c) - list(APPEND ZLIB_ARCH_SRCS ${SSE2_SRCS}) - if(NOT ${ARCH} MATCHES "x86_64") - set_property(SOURCE ${SSE2_SRCS} PROPERTY COMPILE_FLAGS "${SSE2FLAG} ${NOLTOFLAG}") - add_feature_info(FORCE_SSE2 FORCE_SSE2 "Assume CPU is SSE2 capable") - if(FORCE_SSE2) - add_definitions(-DX86_NOCHECK_SSE2) - endif() - endif() - else() - set(WITH_SSE2 OFF) - endif() - endif() - if(WITH_SSSE3) - check_ssse3_intrinsics() - if(HAVE_SSSE3_INTRIN) - add_definitions(-DX86_SSSE3) - set(SSSE3_SRCS ${ARCHDIR}/adler32_ssse3.c ${ARCHDIR}/chunkset_ssse3.c) - add_feature_info(SSSE3_ADLER32 1 "Support SSSE3-accelerated adler32, using \"${SSSE3FLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${SSSE3_SRCS}) - set_property(SOURCE ${SSSE3_SRCS} PROPERTY COMPILE_FLAGS "${SSSE3FLAG} ${NOLTOFLAG}") - else() - set(WITH_SSSE3 OFF) - endif() - endif() - if(WITH_PCLMULQDQ AND WITH_SSSE3 AND WITH_SSE42) - check_pclmulqdq_intrinsics() - if(HAVE_PCLMULQDQ_INTRIN AND HAVE_SSSE3_INTRIN) - add_definitions(-DX86_PCLMULQDQ_CRC) - set(PCLMULQDQ_SRCS ${ARCHDIR}/crc32_pclmulqdq.c) - add_feature_info(PCLMUL_CRC 1 "Support CRC hash generation using PCLMULQDQ, using \"${SSSE3FLAG} ${SSE42FLAG} ${PCLMULFLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${PCLMULQDQ_SRCS}) - set_property(SOURCE ${PCLMULQDQ_SRCS} PROPERTY COMPILE_FLAGS "${SSSE3FLAG} ${SSE42FLAG} ${PCLMULFLAG} ${NOLTOFLAG}") - - if(WITH_VPCLMULQDQ AND WITH_AVX512) - check_vpclmulqdq_intrinsics() - if(HAVE_VPCLMULQDQ_INTRIN AND HAVE_AVX512_INTRIN) - add_definitions(-DX86_VPCLMULQDQ_CRC) - set(VPCLMULQDQ_SRCS ${ARCHDIR}/crc32_vpclmulqdq.c) - add_feature_info(VPCLMUL_CRC 1 "Support CRC hash generation using VPCLMULQDQ, using \"${VPCLMULFLAG} ${AVX512FLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${VPCLMULQDQ_SRCS}) - set_property(SOURCE ${VPCLMULQDQ_SRCS} PROPERTY COMPILE_FLAGS "${SSSE3FLAG} ${SSE42FLAG} ${PCLMULFLAG} ${VPCLMULFLAG} ${AVX512FLAG} ${NOLTOFLAG}") - else() - set(WITH_VPCLMULQDQ OFF) - endif() - else() - set(WITH_VPCLMULQDQ OFF) - endif() + if(WITH_VPCLMULQDQ) + check_vpclmulqdq_intrinsics() + if(HAVE_VPCLMULQDQ_INTRIN AND WITH_PCLMULQDQ AND WITH_AVX512) + add_definitions(-DX86_VPCLMULQDQ_CRC) + set(VPCLMULQDQ_SRCS ${ARCHDIR}/crc32_vpclmulqdq.c) + add_feature_info(VPCLMUL_CRC 1 "Support CRC hash generation using VPCLMULQDQ, using \"${PCLMULFLAG} ${VPCLMULFLAG} ${AVX512FLAG}\"") + list(APPEND ZLIB_ARCH_SRCS ${VPCLMULQDQ_SRCS}) + set_property(SOURCE ${VPCLMULQDQ_SRCS} PROPERTY COMPILE_FLAGS "${PCLMULFLAG} ${VPCLMULFLAG} ${AVX512FLAG} ${NOLTOFLAG}") else() - set(WITH_PCLMULQDQ OFF) set(WITH_VPCLMULQDQ OFF) endif() - else() - set(WITH_PCLMULQDQ OFF) - set(WITH_VPCLMULQDQ OFF) - endif() - check_xsave_intrinsics() - if(HAVE_XSAVE_INTRIN) - add_feature_info(XSAVE 1 "Support XSAVE intrinsics using \"${XSAVEFLAG}\"") - set_property(SOURCE ${ARCHDIR}/x86_features.c PROPERTY COMPILE_FLAGS "${XSAVEFLAG}") endif() endif() endif() @@ -980,11 +1071,10 @@ set(ZLIB_PRIVATE_HDRS adler32_p.h chunkset_tpl.h compare256_rle.h - cpu_features.h + arch_functions.h crc32_braid_p.h crc32_braid_comb_p.h crc32_braid_tbl.h - crc32_fold.h deflate.h deflate_p.h functable.h @@ -1003,15 +1093,17 @@ set(ZLIB_PRIVATE_HDRS zutil.h ) set(ZLIB_SRCS + arch/generic/adler32_c.c + arch/generic/adler32_fold_c.c + arch/generic/chunkset_c.c + arch/generic/compare256_c.c + arch/generic/crc32_braid_c.c + arch/generic/crc32_fold_c.c + arch/generic/slide_hash_c.c adler32.c - adler32_fold.c - chunkset.c - compare256.c compress.c - cpu_features.c - crc32_braid.c + crc32.c crc32_braid_comb.c - crc32_fold.c deflate.c deflate_fast.c deflate_huff.c @@ -1026,12 +1118,16 @@ set(ZLIB_SRCS inftrees.c insert_string.c insert_string_roll.c - slide_hash.c trees.c uncompr.c zutil.c ) +if(WITH_RUNTIME_CPU_DETECTION) + list(APPEND ZLIB_PRIVATE_HDRS cpu_features.h) + list(APPEND ZLIB_SRCS cpu_features.c) +endif() + set(ZLIB_GZFILE_PRIVATE_HDRS gzguts.h ) @@ -1067,12 +1163,27 @@ else() set(ZLIB_INSTALL_LIBRARIES zlib) endif() +# INFO: Mimics official zlib CMake target +# Generates ZLIB.cmake in case ZLIB_COMPAT=ON and always exports the CMake target ZLIB::ZLIB +# In case ZLIB_COMPAT=OFF, the CMake target and file follows zlib-ng naming convention +if (ZLIB_COMPAT) + if (TARGET zlib) + set_target_properties(zlib PROPERTIES EXPORT_NAME ZLIB) + else() + set_target_properties(zlibstatic PROPERTIES EXPORT_NAME ZLIB) + endif() +endif() + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${ARCHDIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/arch/generic) + foreach(ZLIB_INSTALL_LIBRARY ${ZLIB_INSTALL_LIBRARIES}) if(NOT ZLIB_COMPAT) target_compile_definitions(${ZLIB_INSTALL_LIBRARY} PUBLIC ZLIBNG_NATIVE_API) endif() target_include_directories(${ZLIB_INSTALL_LIBRARY} PUBLIC - "$" + "$${CMAKE_CURRENT_SOURCE_DIR}>" "$") endforeach() @@ -1124,7 +1235,7 @@ if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) if(HAVE_NO_INTERPOSITION) set_target_properties(zlib PROPERTIES COMPILE_FLAGS "-fno-semantic-interposition") endif() - if(NOT APPLE) + if(NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL AIX) if(NOT ZLIB_COMPAT) add_definitions(-DHAVE_SYMVER) endif() @@ -1183,6 +1294,7 @@ endif() if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) install(TARGETS ${ZLIB_INSTALL_LIBRARIES} + EXPORT ${EXPORT_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") @@ -1197,22 +1309,30 @@ if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL) endif() if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL) install(FILES ${ZLIB_PC} DESTINATION "${PKGCONFIG_INSTALL_DIR}") - # INFO: Mimics official zlib CMake target - # Generates ZLIB.cmake in case ZLIB_COMPAT=ON and always exports the CMake target ZLIB::ZLIB - # In case ZLIB_COMPAT=OFF, the CMake target and file follows zlib-ng naming convention - if (ZLIB_COMPAT) - if (TARGET zlib) - set_target_properties(zlib PROPERTIES EXPORT_NAME ZLIB) - else() - set_target_properties(zlibstatic PROPERTIES EXPORT_NAME ZLIB) - endif() - endif() - install(TARGETS ${ZLIB_INSTALL_LIBRARIES} - EXPORT ${EXPORT_NAME} - DESTINATION "${CMAKE_INSTALL_LIBDIR}") install(EXPORT ${EXPORT_NAME} DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_NAME}" NAMESPACE ${EXPORT_NAME}::) + # Use GNU-style variable names + set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}) + set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}) + if (ZLIB_COMPAT) + set(PACKAGE_CONFIGNAME zlib) + set(PACKAGE_VERSION ${ZLIB_HEADER_VERSION}) + else() + set(PACKAGE_CONFIGNAME zlib-ng) + set(PACKAGE_VERSION ${ZLIBNG_HEADER_VERSION}) + endif() + configure_package_config_file(${PACKAGE_CONFIGNAME}-config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_CONFIGNAME}-config.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_NAME} + PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) + write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_CONFIGNAME}-config-version.cmake + VERSION ${PACKAGE_VERSION} + COMPATIBILITY AnyNewerVersion) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_CONFIGNAME}-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_CONFIGNAME}-config-version.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_NAME}) endif() #============================================================================ @@ -1251,6 +1371,7 @@ add_feature_info(WITH_OPTIM WITH_OPTIM "Build with optimisation") add_feature_info(WITH_NEW_STRATEGIES WITH_NEW_STRATEGIES "Use new strategies") add_feature_info(WITH_NATIVE_INSTRUCTIONS WITH_NATIVE_INSTRUCTIONS "Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)") +add_feature_info(WITH_RUNTIME_CPU_DETECTION WITH_RUNTIME_CPU_DETECTION "Build with runtime CPU detection") add_feature_info(WITH_MAINTAINER_WARNINGS WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings") add_feature_info(WITH_CODE_COVERAGE WITH_CODE_COVERAGE "Enable code coverage reporting") add_feature_info(WITH_INFLATE_STRICT WITH_INFLATE_STRICT "Build with strict inflate distance checking") diff --git a/src/native/external/zlib-ng/FAQ.zlib b/src/native/external/zlib-ng/FAQ.zlib index 163160c1032bfa..698a4f83f0fbeb 100644 --- a/src/native/external/zlib-ng/FAQ.zlib +++ b/src/native/external/zlib-ng/FAQ.zlib @@ -20,8 +20,7 @@ The latest zlib FAQ is at https://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 https://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/native/external/zlib-ng/LICENSE.md b/src/native/external/zlib-ng/LICENSE.md index adb48d47296b4d..e866d7ac18620a 100644 --- a/src/native/external/zlib-ng/LICENSE.md +++ b/src/native/external/zlib-ng/LICENSE.md @@ -1,4 +1,4 @@ -(C) 1995-2013 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 diff --git a/src/native/external/zlib-ng/Makefile.in b/src/native/external/zlib-ng/Makefile.in index 3859eb5325c3a4..41f3e924553a3c 100644 --- a/src/native/external/zlib-ng/Makefile.in +++ b/src/native/external/zlib-ng/Makefile.in @@ -1,5 +1,5 @@ # Makefile for zlib -# 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 # To compile and test, type: @@ -28,8 +28,9 @@ SUFFIX=-ng TEST_LIBS=$(LIBNAME1).a LDSHARED=$(CC) LDSHAREDFLAGS=-shared +LDVERSIONSCRIPT= -VER=2.1.6 +VER=2.2.1 VER1=2 STATICLIB=$(LIBNAME1).a @@ -74,15 +75,17 @@ man3dir = ${mandir}/man3 pkgconfigdir = ${libdir}/pkgconfig OBJZ = \ + arch/generic/adler32_c.o \ + arch/generic/adler32_fold_c.o \ + arch/generic/chunkset_c.o \ + arch/generic/compare256_c.o \ + arch/generic/crc32_braid_c.o \ + arch/generic/crc32_fold_c.o \ + arch/generic/slide_hash_c.o \ adler32.o \ - adler32_fold.o \ - chunkset.o \ - compare256.o \ compress.o \ - cpu_features.o \ - crc32_braid.o \ + crc32.o \ crc32_braid_comb.o \ - crc32_fold.o \ deflate.o \ deflate_fast.o \ deflate_huff.o \ @@ -97,10 +100,10 @@ OBJZ = \ inftrees.o \ insert_string.o \ insert_string_roll.o \ - slide_hash.o \ trees.o \ uncompr.o \ zutil.o \ + cpu_features.o \ $(ARCH_STATIC_OBJS) OBJG = \ @@ -112,15 +115,17 @@ TESTOBJG = OBJC = $(OBJZ) $(OBJG) PIC_OBJZ = \ + arch/generic/adler32_c.lo \ + arch/generic/adler32_fold_c.lo \ + arch/generic/chunkset_c.lo \ + arch/generic/compare256_c.lo \ + arch/generic/crc32_braid_c.lo \ + arch/generic/crc32_fold_c.lo \ + arch/generic/slide_hash_c.lo \ adler32.lo \ - adler32_fold.lo \ - chunkset.lo \ - compare256.lo \ compress.lo \ - cpu_features.lo \ - crc32_braid.lo \ + crc32.lo \ crc32_braid_comb.lo \ - crc32_fold.lo \ deflate.lo \ deflate_fast.lo \ deflate_huff.lo \ @@ -135,10 +140,10 @@ PIC_OBJZ = \ inftrees.lo \ insert_string.lo \ insert_string_roll.lo \ - slide_hash.lo \ trees.lo \ uncompr.lo \ zutil.lo \ + cpu_features.lo \ $(ARCH_SHARED_OBJS) PIC_OBJG = \ @@ -169,6 +174,12 @@ $(ARCHDIR)/%.o: $(SRCDIR)/$(ARCHDIR)/%.c $(ARCHDIR)/%.lo: $(SRCDIR)/$(ARCHDIR)/%.c $(MAKE) -C $(ARCHDIR) $(notdir $@) +arch/generic/%.o: $(SRCDIR)/arch/generic/%.c + $(MAKE) -C arch/generic $(notdir $@) + +arch/generic/%.lo: $(SRCDIR)/arch/generic/%.c + $(MAKE) -C arch/generic $(notdir $@) + %.o: $(ARCHDIR)/%.o -cp $< $@ @@ -242,7 +253,7 @@ gzwrite.lo: $(SRCDIR)/gzwrite.c $(SHAREDTARGET): $(PIC_OBJS) $(DEFFILE) $(RCOBJS) ifneq ($(SHAREDTARGET),) - $(LDSHARED) $(CFLAGS) $(LDSHAREDFLAGS) $(LDFLAGS) -o $@ $(DEFFILE) $(PIC_OBJS) $(RCOBJS) $(LDSHAREDLIBC) + $(LDSHARED) $(CFLAGS) $(LDSHAREDFLAGS) $(LDVERSIONSCRIPT) $(LDFLAGS) -o $@ $(DEFFILE) $(PIC_OBJS) $(RCOBJS) $(LDSHAREDLIBC) ifneq ($(STRIP),) $(STRIP) $@ endif @@ -356,6 +367,7 @@ uninstall: uninstall-static uninstall-shared mostlyclean: clean clean: @if [ -f $(ARCHDIR)/Makefile ]; then $(MAKE) -C $(ARCHDIR) clean; fi + @if [ -f arch/generic/Makefile ]; then $(MAKE) -C arch/generic clean; fi @if [ -f test/Makefile ]; then $(MAKE) -C test clean; fi rm -f *.o *.lo *~ \ example$(EXE) minigzip$(EXE) minigzipsh$(EXE) \ diff --git a/src/native/external/zlib-ng/PORTING.md b/src/native/external/zlib-ng/PORTING.md index c48522e3a02f74..208f6ee9e7c0f1 100644 --- a/src/native/external/zlib-ng/PORTING.md +++ b/src/native/external/zlib-ng/PORTING.md @@ -4,6 +4,38 @@ Porting applications to use zlib-ng Zlib-ng can be used/compiled in two different modes, that require some consideration by the application developer. +Changes from zlib affecting native and compat modes +--------------------------------------------------- +Zlib-ng is not as conservative with memory allocation as Zlib is. + +Where Zlib's inflate will allocate a lower amount of memory depending on +compression level and window size, zlib-ng will always allocate the maximum +amount of memory and possibly leave parts of it unused. +Zlib-ng's deflate will however allocate a lower amount of memory depending +on compression level and window size. + +Zlib-ng also allocates one "big" buffer instead of doing multiple smaller +allocations. This is faster, can lead to better cache locality and reduces +space lost to alignment padding. + +At the time of writing, by default zlib-ng allocates the following amounts +of memory on a 64-bit system (except on S390x that requires ~4KiB more): +- Deflate: 350.272 Bytes +- Inflate: 42.112 Bytes + +**Advantages:** +- All memory is allocated during DeflateInit or InflateInit functions, + leaving the actual deflate/inflate functions free from allocations. +- Zlib-ng can only fail from memory allocation errors during init. +- Time spent doing memory allocation systemcalls is all done during init, + allowing applications to do prepare this before doing latency-sensitive + deflate/inflate later. +- Can reduce wasted memory due to buffer alignment padding both by OS and zlib-ng. +- Potentially improved memory locality. + +**Disadvantages:** +- Zlib-ng allocates a little more memory than zlib does. + zlib-compat mode ---------------- Zlib-ng can be compiled in zlib-compat mode, suitable for zlib-replacement diff --git a/src/native/external/zlib-ng/README.md b/src/native/external/zlib-ng/README.md index 4f9fe09c69115f..411621b52ffbc6 100644 --- a/src/native/external/zlib-ng/README.md +++ b/src/native/external/zlib-ng/README.md @@ -21,7 +21,6 @@ Features * Support for CPU intrinsics when available * Adler32 implementation using SSSE3, AVX2, AVX512, AVX512-VNNI, Neon, VMX & VSX * CRC32-B implementation using PCLMULQDQ, VPCLMULQDQ, ACLE, & IBM Z - * Hash table implementation using CRC32-C intrinsics on x86 and ARM * Slide hash implementations using SSE2, AVX2, ARMv6, Neon, VMX & VSX * Compare256 implementations using SSE2, AVX2, Neon, POWER9 & RVV * Inflate chunk copying using SSE2, SSSE3, AVX, Neon & VSX @@ -95,20 +94,21 @@ make test Build Options ------------- -| CMake | configure | Description | Default | -|:-------------------------|:-------------------------|:--------------------------------------------------------------------------------------|---------| -| ZLIB_COMPAT | --zlib-compat | Compile with zlib compatible API | OFF | -| ZLIB_ENABLE_TESTS | | Build test binaries | ON | -| WITH_GZFILEOP | --without-gzfileops | Compile with support for gzFile related functions | ON | -| WITH_OPTIM | --without-optimizations | Build with optimisations | ON | -| WITH_NEW_STRATEGIES | --without-new-strategies | Use new strategies | ON | -| WITH_NATIVE_INSTRUCTIONS | | Compiles with full instruction set supported on this host (gcc/clang -march=native) | OFF | -| WITH_SANITIZER | | Build with sanitizer (memory, address, undefined) | OFF | -| WITH_GTEST | | Build gtest_zlib | ON | -| WITH_FUZZERS | | Build test/fuzz | OFF | -| WITH_BENCHMARKS | | Build test/benchmarks | OFF | -| WITH_MAINTAINER_WARNINGS | | Build with project maintainer warnings | OFF | -| WITH_CODE_COVERAGE | | Enable code coverage reporting | OFF | +| CMake | configure | Description | Default | +|:---------------------------|:-------------------------|:------------------------------------------------------------------------------------|---------| +| ZLIB_COMPAT | --zlib-compat | Compile with zlib compatible API | OFF | +| ZLIB_ENABLE_TESTS | | Build test binaries | ON | +| WITH_GZFILEOP | --without-gzfileops | Compile with support for gzFile related functions | ON | +| WITH_OPTIM | --without-optimizations | Build with optimisations | ON | +| WITH_NEW_STRATEGIES | --without-new-strategies | Use new strategies | ON | +| WITH_NATIVE_INSTRUCTIONS | | Compiles with full instruction set supported on this host (gcc/clang -march=native) | OFF | +| WITH_RUNTIME_CPU_DETECTION | | Compiles with runtime CPU detection | ON | +| WITH_SANITIZER | | Build with sanitizer (memory, address, undefined) | OFF | +| WITH_GTEST | | Build gtest_zlib | ON | +| WITH_FUZZERS | | Build test/fuzz | OFF | +| WITH_BENCHMARKS | | Build test/benchmarks | OFF | +| WITH_MAINTAINER_WARNINGS | | Build with project maintainer warnings | OFF | +| WITH_CODE_COVERAGE | | Enable code coverage reporting | OFF | Install diff --git a/src/native/external/zlib-ng/adler32.c b/src/native/external/zlib-ng/adler32.c index 95ac13c3046b34..1a643ed53b2c0c 100644 --- a/src/native/external/zlib-ng/adler32.c +++ b/src/native/external/zlib-ng/adler32.c @@ -7,70 +7,24 @@ #include "functable.h" #include "adler32_p.h" -/* ========================================================================= */ -Z_INTERNAL uint32_t adler32_c(uint32_t adler, const uint8_t *buf, size_t len) { - uint32_t sum2; - unsigned n; - - /* split Adler-32 into component sums */ - sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (UNLIKELY(len == 1)) - return adler32_len_1(adler, buf, sum2); - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (UNLIKELY(buf == NULL)) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (UNLIKELY(len < 16)) - return adler32_len_16(adler, buf, len, sum2); - - /* do length NMAX blocks -- requires just one modulo operation */ - while (len >= NMAX) { - len -= NMAX; -#ifdef UNROLL_MORE - n = NMAX / 16; /* NMAX is divisible by 16 */ -#else - n = NMAX / 8; /* NMAX is divisible by 8 */ -#endif - do { -#ifdef UNROLL_MORE - DO16(adler, sum2, buf); /* 16 sums unrolled */ - buf += 16; -#else - DO8(adler, sum2, buf, 0); /* 8 sums unrolled */ - buf += 8; -#endif - } while (--n); - adler %= BASE; - sum2 %= BASE; - } - - /* do remaining bytes (less than NMAX, still just one modulo) */ - return adler32_len_64(adler, buf, len, sum2); -} - #ifdef ZLIB_COMPAT unsigned long Z_EXPORT PREFIX(adler32_z)(unsigned long adler, const unsigned char *buf, size_t len) { - return (unsigned long)functable.adler32((uint32_t)adler, buf, len); + return (unsigned long)FUNCTABLE_CALL(adler32)((uint32_t)adler, buf, len); } #else uint32_t Z_EXPORT PREFIX(adler32_z)(uint32_t adler, const unsigned char *buf, size_t len) { - return functable.adler32(adler, buf, len); + return FUNCTABLE_CALL(adler32)(adler, buf, len); } #endif /* ========================================================================= */ #ifdef ZLIB_COMPAT unsigned long Z_EXPORT PREFIX(adler32)(unsigned long adler, const unsigned char *buf, unsigned int len) { - return (unsigned long)functable.adler32((uint32_t)adler, buf, len); + return (unsigned long)FUNCTABLE_CALL(adler32)((uint32_t)adler, buf, len); } #else uint32_t Z_EXPORT PREFIX(adler32)(uint32_t adler, const unsigned char *buf, uint32_t len) { - return functable.adler32(adler, buf, len); + return FUNCTABLE_CALL(adler32)(adler, buf, len); } #endif diff --git a/src/native/external/zlib-ng/arch/arm/Makefile.in b/src/native/external/zlib-ng/arch/arm/Makefile.in index 9d05b00b54eded..b6f0aaf2114525 100644 --- a/src/native/external/zlib-ng/arch/arm/Makefile.in +++ b/src/native/external/zlib-ng/arch/arm/Makefile.in @@ -25,7 +25,6 @@ all: \ crc32_acle.o crc32_acle.lo \ slide_hash_neon.o slide_hash_neon.lo \ slide_hash_armv6.o slide_hash_armv6.lo \ - insert_string_acle.o insert_string_acle.lo adler32_neon.o: $(CC) $(CFLAGS) $(NEONFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c @@ -69,12 +68,6 @@ slide_hash_armv6.o: slide_hash_armv6.lo: $(CC) $(SFLAGS) $(ARMV6FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_armv6.c -insert_string_acle.o: - $(CC) $(CFLAGS) $(ACLEFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_acle.c - -insert_string_acle.lo: - $(CC) $(SFLAGS) $(ACLEFLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_acle.c - mostlyclean: clean clean: rm -f *.o *.lo *~ diff --git a/src/native/external/zlib-ng/arch/arm/adler32_neon.c b/src/native/external/zlib-ng/arch/arm/adler32_neon.c index f1c43ff0474973..8e46b380170b89 100644 --- a/src/native/external/zlib-ng/arch/arm/adler32_neon.c +++ b/src/native/external/zlib-ng/arch/arm/adler32_neon.c @@ -7,8 +7,8 @@ */ #ifdef ARM_NEON #include "neon_intrins.h" -#include "../../zbuild.h" -#include "../../adler32_p.h" +#include "zbuild.h" +#include "adler32_p.h" static void NEON_accum32(uint32_t *s, const uint8_t *buf, size_t len) { static const uint16_t ALIGNED_(16) taps[64] = { diff --git a/src/native/external/zlib-ng/arch/arm/arm_features.c b/src/native/external/zlib-ng/arch/arm/arm_features.c index a0e070ba956115..d0d49764f4e5d7 100644 --- a/src/native/external/zlib-ng/arch/arm/arm_features.c +++ b/src/native/external/zlib-ng/arch/arm/arm_features.c @@ -1,4 +1,4 @@ -#include "../../zbuild.h" +#include "zbuild.h" #include "arm_features.h" #if defined(__linux__) && defined(HAVE_SYS_AUXV_H) @@ -11,6 +11,11 @@ # ifndef ID_AA64ISAR0_CRC32_VAL # define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32 # endif +#elif defined(__OpenBSD__) && defined(__aarch64__) +# include +# include +# include +# include #elif defined(__APPLE__) # if !defined(_DARWIN_C_SOURCE) # define _DARWIN_C_SOURCE /* enable types aliases (eg u_int) */ @@ -30,6 +35,16 @@ static int arm_has_crc32() { #elif defined(__FreeBSD__) && defined(__aarch64__) return getenv("QEMU_EMULATING") == NULL && ID_AA64ISAR0_CRC32_VAL(READ_SPECIALREG(id_aa64isar0_el1)) >= ID_AA64ISAR0_CRC32_BASE; +#elif defined(__OpenBSD__) && defined(__aarch64__) + int hascrc32 = 0; + int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 }; + uint64_t isar0 = 0; + size_t len = sizeof(isar0); + if (sysctl(isar0_mib, 2, &isar0, &len, NULL, 0) != -1) { + if (ID_AA64ISAR0_CRC32(isar0) >= ID_AA64ISAR0_CRC32_BASE) + hascrc32 = 1; + } + return hascrc32; #elif defined(__APPLE__) int hascrc32; size_t size = sizeof(hascrc32); diff --git a/src/native/external/zlib-ng/arch/arm/arm_features.h b/src/native/external/zlib-ng/arch/arm/arm_features.h index eca078e310ead6..d968e02fbb6cfc 100644 --- a/src/native/external/zlib-ng/arch/arm/arm_features.h +++ b/src/native/external/zlib-ng/arch/arm/arm_features.h @@ -2,8 +2,8 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#ifndef ARM_H_ -#define ARM_H_ +#ifndef ARM_FEATURES_H_ +#define ARM_FEATURES_H_ struct arm_cpu_features { int has_simd; @@ -13,4 +13,4 @@ struct arm_cpu_features { void Z_INTERNAL arm_check_features(struct arm_cpu_features *features); -#endif /* ARM_H_ */ +#endif /* ARM_FEATURES_H_ */ diff --git a/src/native/external/zlib-ng/arch/arm/arm_functions.h b/src/native/external/zlib-ng/arch/arm/arm_functions.h new file mode 100644 index 00000000000000..61c682710a5512 --- /dev/null +++ b/src/native/external/zlib-ng/arch/arm/arm_functions.h @@ -0,0 +1,65 @@ +/* arm_functions.h -- ARM implementations for arch-specific functions. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef ARM_FUNCTIONS_H_ +#define ARM_FUNCTIONS_H_ + +#ifdef ARM_NEON +uint32_t adler32_neon(uint32_t adler, const uint8_t *buf, size_t len); +uint32_t chunksize_neon(void); +uint8_t* chunkmemset_safe_neon(uint8_t *out, unsigned dist, unsigned len, unsigned left); + +# ifdef HAVE_BUILTIN_CTZLL +uint32_t compare256_neon(const uint8_t *src0, const uint8_t *src1); +uint32_t longest_match_neon(deflate_state *const s, Pos cur_match); +uint32_t longest_match_slow_neon(deflate_state *const s, Pos cur_match); +# endif +void slide_hash_neon(deflate_state *s); +void inflate_fast_neon(PREFIX3(stream) *strm, uint32_t start); +#endif + +#ifdef ARM_ACLE +uint32_t crc32_acle(uint32_t crc, const uint8_t *buf, size_t len); +#endif + +#ifdef ARM_SIMD +void slide_hash_armv6(deflate_state *s); +#endif + + +#ifdef DISABLE_RUNTIME_CPU_DETECTION +// ARM - SIMD +# if (defined(ARM_SIMD) && defined(__ARM_FEATURE_SIMD32)) || defined(ARM_NOCHECK_SIMD) +# undef native_slide_hash +# define native_slide_hash slide_hash_armv6 +# endif +// ARM - NEON +# if (defined(ARM_NEON) && (defined(__ARM_NEON__) || defined(__ARM_NEON))) || ARM_NOCHECK_NEON +# undef native_adler32 +# define native_adler32 adler32_neon +# undef native_chunkmemset_safe +# define native_chunkmemset_safe chunkmemset_safe_neon +# undef native_chunksize +# define native_chunksize chunksize_neon +# undef native_inflate_fast +# define native_inflate_fast inflate_fast_neon +# undef native_slide_hash +# define native_slide_hash slide_hash_neon +# ifdef HAVE_BUILTIN_CTZLL +# undef native_compare256 +# define native_compare256 compare256_neon +# undef native_longest_match +# define native_longest_match longest_match_neon +# undef native_longest_match_slow +# define native_longest_match_slow longest_match_slow_neon +# endif +# endif +// ARM - ACLE +# if defined(ARM_ACLE) && defined(__ARM_ACLE) && defined(__ARM_FEATURE_CRC32) +# undef native_crc32 +# define native_crc32 crc32_acle +# endif +#endif + +#endif /* ARM_FUNCTIONS_H_ */ diff --git a/src/native/external/zlib-ng/arch/arm/chunkset_neon.c b/src/native/external/zlib-ng/arch/arm/chunkset_neon.c index f9a444b0681fc0..1c49ef56123552 100644 --- a/src/native/external/zlib-ng/arch/arm/chunkset_neon.c +++ b/src/native/external/zlib-ng/arch/arm/chunkset_neon.c @@ -4,8 +4,8 @@ #ifdef ARM_NEON #include "neon_intrins.h" -#include "../../zbuild.h" -#include "../generic/chunk_permute_table.h" +#include "zbuild.h" +#include "arch/generic/chunk_permute_table.h" typedef uint8x16_t chunk_t; diff --git a/src/native/external/zlib-ng/arch/arm/compare256_neon.c b/src/native/external/zlib-ng/arch/arm/compare256_neon.c index 7daeba411ecea7..87d14c89c09bc1 100644 --- a/src/native/external/zlib-ng/arch/arm/compare256_neon.c +++ b/src/native/external/zlib-ng/arch/arm/compare256_neon.c @@ -3,8 +3,9 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "../../zbuild.h" - +#include "zbuild.h" +#include "zutil_p.h" +#include "deflate.h" #include "fallback_builtins.h" #if defined(ARM_NEON) && defined(HAVE_BUILTIN_CTZLL) diff --git a/src/native/external/zlib-ng/arch/arm/crc32_acle.c b/src/native/external/zlib-ng/arch/arm/crc32_acle.c index ac7d6ff66b3ea7..116bcab1c23f11 100644 --- a/src/native/external/zlib-ng/arch/arm/crc32_acle.c +++ b/src/native/external/zlib-ng/arch/arm/crc32_acle.c @@ -7,7 +7,7 @@ #ifdef ARM_ACLE #include "acle_intrins.h" -#include "../../zbuild.h" +#include "zbuild.h" Z_INTERNAL Z_TARGET_CRC uint32_t crc32_acle(uint32_t crc, const uint8_t *buf, size_t len) { Z_REGISTER uint32_t c; diff --git a/src/native/external/zlib-ng/arch/arm/neon_intrins.h b/src/native/external/zlib-ng/arch/arm/neon_intrins.h index 51df77dbe6855d..a9e99ec88a9ce9 100644 --- a/src/native/external/zlib-ng/arch/arm/neon_intrins.h +++ b/src/native/external/zlib-ng/arch/arm/neon_intrins.h @@ -25,6 +25,13 @@ out.val[3] = vqsubq_u16(a.val[3], b); \ } while (0) +# if defined(__clang__) && defined(__arm__) && defined(__ANDROID__) +/* Clang for 32-bit Android has too strict alignment requirement (:256) for x4 NEON intrinsics */ +# undef ARM_NEON_HASLD4 +# undef vld1q_u16_x4 +# undef vld1q_u8_x4 +# undef vst1q_u16_x4 +# endif # ifndef ARM_NEON_HASLD4 diff --git a/src/native/external/zlib-ng/arch/arm/slide_hash_armv6.c b/src/native/external/zlib-ng/arch/arm/slide_hash_armv6.c index 3a715a1551df6d..07f71b59eb822a 100644 --- a/src/native/external/zlib-ng/arch/arm/slide_hash_armv6.c +++ b/src/native/external/zlib-ng/arch/arm/slide_hash_armv6.c @@ -5,8 +5,8 @@ #if defined(ARM_SIMD) #include "acle_intrins.h" -#include "../../zbuild.h" -#include "../../deflate.h" +#include "zbuild.h" +#include "deflate.h" /* SIMD version of hash_chain rebase */ static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize) { @@ -39,8 +39,7 @@ static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize } Z_INTERNAL void slide_hash_armv6(deflate_state *s) { - Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); - uint16_t wsize = (uint16_t)s->w_size; + unsigned int wsize = s->w_size; slide_hash_chain(s->head, HASH_SIZE, wsize); slide_hash_chain(s->prev, wsize, wsize); diff --git a/src/native/external/zlib-ng/arch/arm/slide_hash_neon.c b/src/native/external/zlib-ng/arch/arm/slide_hash_neon.c index 2889e9c0460274..a601e6099ad7cc 100644 --- a/src/native/external/zlib-ng/arch/arm/slide_hash_neon.c +++ b/src/native/external/zlib-ng/arch/arm/slide_hash_neon.c @@ -10,8 +10,8 @@ #ifdef ARM_NEON #include "neon_intrins.h" -#include "../../zbuild.h" -#include "../../deflate.h" +#include "zbuild.h" +#include "deflate.h" /* SIMD version of hash_chain rebase */ static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize) { @@ -38,8 +38,7 @@ static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize } Z_INTERNAL void slide_hash_neon(deflate_state *s) { - Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); - uint16_t wsize = (uint16_t)s->w_size; + unsigned int wsize = s->w_size; slide_hash_chain(s->head, HASH_SIZE, wsize); slide_hash_chain(s->prev, wsize, wsize); diff --git a/src/native/external/zlib-ng/arch/generic/Makefile.in b/src/native/external/zlib-ng/arch/generic/Makefile.in index c717026f86e4a5..32c8242d026f15 100644 --- a/src/native/external/zlib-ng/arch/generic/Makefile.in +++ b/src/native/external/zlib-ng/arch/generic/Makefile.in @@ -1,5 +1,6 @@ -# Makefile for zlib +# Makefile for zlib-ng # Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler +# Copyright (C) 2024 Hans Kristian Rosbach # For conditions of distribution and use, see copyright notice in zlib.h CC= @@ -11,12 +12,62 @@ SRCDIR=. SRCTOP=../.. TOPDIR=$(SRCTOP) -all: +all: \ + adler32_c.o adler32_c.lo \ + adler32_fold_c.o adler32_fold_c.lo \ + chunkset_c.o chunkset_c.lo \ + compare256_c.o compare256_c.lo \ + crc32_braid_c.o crc32_braid_c.lo \ + crc32_fold_c.o crc32_fold_c.lo \ + slide_hash_c.o slide_hash_c.lo + + +adler32_c.o: $(SRCDIR)/adler32_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/adler32_p.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_c.c + +adler32_c.lo: $(SRCDIR)/adler32_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/adler32_p.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_c.c + +adler32_fold_c.o: $(SRCDIR)/adler32_fold_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/functable.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_fold_c.c + +adler32_fold_c.lo: $(SRCDIR)/adler32_fold_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/functable.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_fold_c.c + +chunkset_c.o: $(SRCDIR)/chunkset_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/chunkset_tpl.h $(SRCTOP)/inffast_tpl.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_c.c + +chunkset_c.lo: $(SRCDIR)/chunkset_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/chunkset_tpl.h $(SRCTOP)/inffast_tpl.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_c.c + +compare256_c.o: $(SRCDIR)/compare256_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/zutil_p.h $(SRCTOP)/deflate.h $(SRCTOP)/fallback_builtins.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/compare256_c.c + +compare256_c.lo: $(SRCDIR)/compare256_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/zutil_p.h $(SRCTOP)/deflate.h $(SRCTOP)/fallback_builtins.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/compare256_c.c + +crc32_braid_c.o: $(SRCDIR)/crc32_braid_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/crc32_braid_p.h $(SRCTOP)/crc32_braid_tbl.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_braid_c.c + +crc32_braid_c.lo: $(SRCDIR)/crc32_braid_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/crc32_braid_p.h $(SRCTOP)/crc32_braid_tbl.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_braid_c.c + +crc32_fold_c.o: $(SRCDIR)/crc32_fold_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/functable.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_fold_c.c + +crc32_fold_c.lo: $(SRCDIR)/crc32_fold_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/functable.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_fold_c.c + +slide_hash_c.o: $(SRCDIR)/slide_hash_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/deflate.h + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_c.c + +slide_hash_c.lo: $(SRCDIR)/slide_hash_c.c $(SRCTOP)/zbuild.h $(SRCTOP)/deflate.h + $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_c.c mostlyclean: clean clean: - rm -f *.o *.lo *~ \ + rm -f *.o *.lo *~ rm -rf objs rm -f *.gcda *.gcno *.gcov diff --git a/src/native/external/zlib-ng/arch/generic/adler32_c.c b/src/native/external/zlib-ng/arch/generic/adler32_c.c new file mode 100644 index 00000000000000..64258c89b4940f --- /dev/null +++ b/src/native/external/zlib-ng/arch/generic/adler32_c.c @@ -0,0 +1,54 @@ +/* adler32.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2011, 2016 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "functable.h" +#include "adler32_p.h" + +/* ========================================================================= */ +Z_INTERNAL uint32_t adler32_c(uint32_t adler, const uint8_t *buf, size_t len) { + uint32_t sum2; + unsigned n; + + /* split Adler-32 into component sums */ + sum2 = (adler >> 16) & 0xffff; + adler &= 0xffff; + + /* in case user likes doing a byte at a time, keep it fast */ + if (UNLIKELY(len == 1)) + return adler32_len_1(adler, buf, sum2); + + /* initial Adler-32 value (deferred check for len == 1 speed) */ + if (UNLIKELY(buf == NULL)) + return 1L; + + /* in case short lengths are provided, keep it somewhat fast */ + if (UNLIKELY(len < 16)) + return adler32_len_16(adler, buf, len, sum2); + + /* do length NMAX blocks -- requires just one modulo operation */ + while (len >= NMAX) { + len -= NMAX; +#ifdef UNROLL_MORE + n = NMAX / 16; /* NMAX is divisible by 16 */ +#else + n = NMAX / 8; /* NMAX is divisible by 8 */ +#endif + do { +#ifdef UNROLL_MORE + DO16(adler, sum2, buf); /* 16 sums unrolled */ + buf += 16; +#else + DO8(adler, sum2, buf, 0); /* 8 sums unrolled */ + buf += 8; +#endif + } while (--n); + adler %= BASE; + sum2 %= BASE; + } + + /* do remaining bytes (less than NMAX, still just one modulo) */ + return adler32_len_64(adler, buf, len, sum2); +} diff --git a/src/native/external/zlib-ng/arch/generic/adler32_fold_c.c b/src/native/external/zlib-ng/arch/generic/adler32_fold_c.c new file mode 100644 index 00000000000000..397dd104002cda --- /dev/null +++ b/src/native/external/zlib-ng/arch/generic/adler32_fold_c.c @@ -0,0 +1,15 @@ +/* adler32_fold.c -- adler32 folding interface + * Copyright (C) 2022 Adam Stylinski + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "functable.h" + +#include + +Z_INTERNAL uint32_t adler32_fold_copy_c(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) { + adler = FUNCTABLE_CALL(adler32)(adler, src, len); + memcpy(dst, src, len); + return adler; +} diff --git a/src/native/external/zlib-ng/arch/generic/chunkset_c.c b/src/native/external/zlib-ng/arch/generic/chunkset_c.c new file mode 100644 index 00000000000000..7b2bb7ba3676a7 --- /dev/null +++ b/src/native/external/zlib-ng/arch/generic/chunkset_c.c @@ -0,0 +1,42 @@ +/* chunkset.c -- inline functions to copy small data chunks. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" + +typedef uint64_t chunk_t; + +#define CHUNK_SIZE 8 + +#define HAVE_CHUNKMEMSET_4 +#define HAVE_CHUNKMEMSET_8 + +static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { + uint8_t *dest = (uint8_t *)chunk; + memcpy(dest, from, sizeof(uint32_t)); + memcpy(dest+4, from, sizeof(uint32_t)); +} + +static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { + memcpy(chunk, from, sizeof(uint64_t)); +} + +static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { + memcpy(chunk, (uint8_t *)s, sizeof(uint64_t)); +} + +static inline void storechunk(uint8_t *out, chunk_t *chunk) { + memcpy(out, chunk, sizeof(uint64_t)); +} + +#define CHUNKSIZE chunksize_c +#define CHUNKCOPY chunkcopy_c +#define CHUNKUNROLL chunkunroll_c +#define CHUNKMEMSET chunkmemset_c +#define CHUNKMEMSET_SAFE chunkmemset_safe_c + +#include "chunkset_tpl.h" + +#define INFLATE_FAST inflate_fast_c + +#include "inffast_tpl.h" diff --git a/src/native/external/zlib-ng/arch/generic/compare256_c.c b/src/native/external/zlib-ng/arch/generic/compare256_c.c new file mode 100644 index 00000000000000..0c12cb3a4ec4be --- /dev/null +++ b/src/native/external/zlib-ng/arch/generic/compare256_c.c @@ -0,0 +1,181 @@ +/* compare256.c -- 256 byte memory comparison with match length return + * Copyright (C) 2020 Nathan Moinvaziri + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "zutil_p.h" +#include "deflate.h" +#include "fallback_builtins.h" + +/* ALIGNED, byte comparison */ +static inline uint32_t compare256_c_static(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0; + + do { + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + if (*src0 != *src1) + return len; + src0 += 1, src1 += 1, len += 1; + } while (len < 256); + + return 256; +} + +Z_INTERNAL uint32_t compare256_c(const uint8_t *src0, const uint8_t *src1) { + return compare256_c_static(src0, src1); +} + +#define LONGEST_MATCH longest_match_c +#define COMPARE256 compare256_c_static + +#include "match_tpl.h" + +#define LONGEST_MATCH_SLOW +#define LONGEST_MATCH longest_match_slow_c +#define COMPARE256 compare256_c_static + +#include "match_tpl.h" + +#if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN +/* 16-bit unaligned integer comparison */ +static inline uint32_t compare256_unaligned_16_static(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0; + + do { + if (zng_memcmp_2(src0, src1) != 0) + return len + (*src0 == *src1); + src0 += 2, src1 += 2, len += 2; + + if (zng_memcmp_2(src0, src1) != 0) + return len + (*src0 == *src1); + src0 += 2, src1 += 2, len += 2; + + if (zng_memcmp_2(src0, src1) != 0) + return len + (*src0 == *src1); + src0 += 2, src1 += 2, len += 2; + + if (zng_memcmp_2(src0, src1) != 0) + return len + (*src0 == *src1); + src0 += 2, src1 += 2, len += 2; + } while (len < 256); + + return 256; +} + +Z_INTERNAL uint32_t compare256_unaligned_16(const uint8_t *src0, const uint8_t *src1) { + return compare256_unaligned_16_static(src0, src1); +} + +#define LONGEST_MATCH longest_match_unaligned_16 +#define COMPARE256 compare256_unaligned_16_static + +#include "match_tpl.h" + +#define LONGEST_MATCH_SLOW +#define LONGEST_MATCH longest_match_slow_unaligned_16 +#define COMPARE256 compare256_unaligned_16_static + +#include "match_tpl.h" + +#ifdef HAVE_BUILTIN_CTZ +/* 32-bit unaligned integer comparison */ +static inline uint32_t compare256_unaligned_32_static(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0; + + do { + uint32_t sv, mv, diff; + + memcpy(&sv, src0, sizeof(sv)); + memcpy(&mv, src1, sizeof(mv)); + + diff = sv ^ mv; + if (diff) { + uint32_t match_byte = __builtin_ctz(diff) / 8; + return len + match_byte; + } + + src0 += 4, src1 += 4, len += 4; + } while (len < 256); + + return 256; +} + +Z_INTERNAL uint32_t compare256_unaligned_32(const uint8_t *src0, const uint8_t *src1) { + return compare256_unaligned_32_static(src0, src1); +} + +#define LONGEST_MATCH longest_match_unaligned_32 +#define COMPARE256 compare256_unaligned_32_static + +#include "match_tpl.h" + +#define LONGEST_MATCH_SLOW +#define LONGEST_MATCH longest_match_slow_unaligned_32 +#define COMPARE256 compare256_unaligned_32_static + +#include "match_tpl.h" + +#endif + +#if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) +/* UNALIGNED64_OK, 64-bit integer comparison */ +static inline uint32_t compare256_unaligned_64_static(const uint8_t *src0, const uint8_t *src1) { + uint32_t len = 0; + + do { + uint64_t sv, mv, diff; + + memcpy(&sv, src0, sizeof(sv)); + memcpy(&mv, src1, sizeof(mv)); + + diff = sv ^ mv; + if (diff) { + uint64_t match_byte = __builtin_ctzll(diff) / 8; + return len + (uint32_t)match_byte; + } + + src0 += 8, src1 += 8, len += 8; + } while (len < 256); + + return 256; +} + +Z_INTERNAL uint32_t compare256_unaligned_64(const uint8_t *src0, const uint8_t *src1) { + return compare256_unaligned_64_static(src0, src1); +} + +#define LONGEST_MATCH longest_match_unaligned_64 +#define COMPARE256 compare256_unaligned_64_static + +#include "match_tpl.h" + +#define LONGEST_MATCH_SLOW +#define LONGEST_MATCH longest_match_slow_unaligned_64 +#define COMPARE256 compare256_unaligned_64_static + +#include "match_tpl.h" + +#endif + +#endif diff --git a/src/native/external/zlib-ng/arch/generic/crc32_braid_c.c b/src/native/external/zlib-ng/arch/generic/crc32_braid_c.c new file mode 100644 index 00000000000000..7d8028f6d70555 --- /dev/null +++ b/src/native/external/zlib-ng/arch/generic/crc32_braid_c.c @@ -0,0 +1,215 @@ +/* crc32_braid.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2022 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * + * 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. + */ + +#include "zbuild.h" +#include "crc32_braid_p.h" +#include "crc32_braid_tbl.h" + +/* + 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 tables 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. +*/ + +/* ========================================================================= */ +#ifdef W +/* + 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. + */ +#if BYTE_ORDER == LITTLE_ENDIAN +static uint32_t crc_word(z_word_t data) { + int k; + for (k = 0; k < W; k++) + data = (data >> 8) ^ crc_table[data & 0xff]; + return (uint32_t)data; +} +#elif BYTE_ORDER == BIG_ENDIAN +static z_word_t crc_word(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 /* BYTE_ORDER */ + +#endif /* W */ + +/* ========================================================================= */ +Z_INTERNAL uint32_t PREFIX(crc32_braid)(uint32_t crc, const uint8_t *buf, size_t len) { + uint32_t c; + + /* Pre-condition the CRC */ + c = (~crc) & 0xffffffff; + +#ifdef W + /* If provided enough bytes, do a braided CRC calculation. */ + if (len >= N * W + W - 1) { + size_t blks; + z_word_t const *words; + int k; + + /* Compute the CRC up to a z_word_t boundary. */ + while (len && ((uintptr_t)buf & (W - 1)) != 0) { + len--; + DO1; + } + + /* 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; + + 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 = ZSWAPWORD(c); +#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 = BRAID_TABLE[0][word0 & 0xff]; +#if N > 1 + crc1 = BRAID_TABLE[0][word1 & 0xff]; +#if N > 2 + crc2 = BRAID_TABLE[0][word2 & 0xff]; +#if N > 3 + crc3 = BRAID_TABLE[0][word3 & 0xff]; +#if N > 4 + crc4 = BRAID_TABLE[0][word4 & 0xff]; +#if N > 5 + crc5 = BRAID_TABLE[0][word5 & 0xff]; +#endif +#endif +#endif +#endif +#endif + for (k = 1; k < W; k++) { + crc0 ^= BRAID_TABLE[k][(word0 >> (k << 3)) & 0xff]; +#if N > 1 + crc1 ^= BRAID_TABLE[k][(word1 >> (k << 3)) & 0xff]; +#if N > 2 + crc2 ^= BRAID_TABLE[k][(word2 >> (k << 3)) & 0xff]; +#if N > 3 + crc3 ^= BRAID_TABLE[k][(word3 >> (k << 3)) & 0xff]; +#if N > 4 + crc4 ^= BRAID_TABLE[k][(word4 >> (k << 3)) & 0xff]; +#if N > 5 + crc5 ^= 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. */ + comb = crc_word(crc0 ^ words[0]); +#if N > 1 + comb = crc_word(crc1 ^ words[1] ^ comb); +#if N > 2 + comb = crc_word(crc2 ^ words[2] ^ comb); +#if N > 3 + comb = crc_word(crc3 ^ words[3] ^ comb); +#if N > 4 + comb = crc_word(crc4 ^ words[4] ^ comb); +#if N > 5 + comb = crc_word(crc5 ^ words[5] ^ comb); +#endif +#endif +#endif +#endif +#endif + words += N; + c = ZSWAPWORD(comb); + + /* Update the pointer to the remaining bytes to process. */ + buf = (const unsigned char *)words; + } + +#endif /* W */ + + /* Complete the computation of the CRC on any remaining bytes. */ + while (len >= 8) { + len -= 8; + DO8; + } + while (len) { + len--; + DO1; + } + + /* Return the CRC, post-conditioned. */ + return c ^ 0xffffffff; +} diff --git a/src/native/external/zlib-ng/arch/generic/crc32_fold_c.c b/src/native/external/zlib-ng/arch/generic/crc32_fold_c.c new file mode 100644 index 00000000000000..43930e97c61fe5 --- /dev/null +++ b/src/native/external/zlib-ng/arch/generic/crc32_fold_c.c @@ -0,0 +1,31 @@ +/* crc32_fold.c -- crc32 folding interface + * Copyright (C) 2021 Nathan Moinvaziri + * For conditions of distribution and use, see copyright notice in zlib.h + */ +#include "zbuild.h" +#include "zutil.h" +#include "functable.h" +#include "crc32.h" + +Z_INTERNAL uint32_t crc32_fold_reset_c(crc32_fold *crc) { + crc->value = CRC32_INITIAL_VALUE; + return crc->value; +} + +Z_INTERNAL void crc32_fold_copy_c(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len) { + crc->value = FUNCTABLE_CALL(crc32)(crc->value, src, len); + memcpy(dst, src, len); +} + +Z_INTERNAL void crc32_fold_c(crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc) { + /* Note: while this is basically the same thing as the vanilla CRC function, we still need + * a functable entry for it so that we can generically dispatch to this function with the + * same arguments for the versions that _do_ do a folding CRC but we don't want a copy. The + * init_crc is an unused argument in this context */ + Z_UNUSED(init_crc); + crc->value = FUNCTABLE_CALL(crc32)(crc->value, src, len); +} + +Z_INTERNAL uint32_t crc32_fold_final_c(crc32_fold *crc) { + return crc->value; +} diff --git a/src/native/external/zlib-ng/arch/generic/generic_functions.h b/src/native/external/zlib-ng/arch/generic/generic_functions.h new file mode 100644 index 00000000000000..997dd4d01eeea0 --- /dev/null +++ b/src/native/external/zlib-ng/arch/generic/generic_functions.h @@ -0,0 +1,106 @@ +/* generic_functions.h -- generic C implementations for arch-specific functions. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef GENERIC_FUNCTIONS_H_ +#define GENERIC_FUNCTIONS_H_ + +#include "zendian.h" + +Z_INTERNAL uint32_t crc32_fold_reset_c(crc32_fold *crc); +Z_INTERNAL void crc32_fold_copy_c(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len); +Z_INTERNAL void crc32_fold_c(crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc); +Z_INTERNAL uint32_t crc32_fold_final_c(crc32_fold *crc); + +Z_INTERNAL uint32_t adler32_fold_copy_c(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); + + +typedef uint32_t (*adler32_func)(uint32_t adler, const uint8_t *buf, size_t len); +typedef uint32_t (*compare256_func)(const uint8_t *src0, const uint8_t *src1); +typedef uint32_t (*crc32_func)(uint32_t crc32, const uint8_t *buf, size_t len); + +uint32_t adler32_c(uint32_t adler, const uint8_t *buf, size_t len); + +uint32_t chunksize_c(void); +uint8_t* chunkmemset_safe_c(uint8_t *out, unsigned dist, unsigned len, unsigned left); +void inflate_fast_c(PREFIX3(stream) *strm, uint32_t start); + +uint32_t PREFIX(crc32_braid)(uint32_t crc, const uint8_t *buf, size_t len); + +uint32_t compare256_c(const uint8_t *src0, const uint8_t *src1); +#if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN +uint32_t compare256_unaligned_16(const uint8_t *src0, const uint8_t *src1); +# ifdef HAVE_BUILTIN_CTZ + uint32_t compare256_unaligned_32(const uint8_t *src0, const uint8_t *src1); +# endif +# if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) + uint32_t compare256_unaligned_64(const uint8_t *src0, const uint8_t *src1); +# endif +#endif + +typedef void (*slide_hash_func)(deflate_state *s); + +void slide_hash_c(deflate_state *s); + +uint32_t longest_match_c(deflate_state *const s, Pos cur_match); +# if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN + uint32_t longest_match_unaligned_16(deflate_state *const s, Pos cur_match); +# ifdef HAVE_BUILTIN_CTZ + uint32_t longest_match_unaligned_32(deflate_state *const s, Pos cur_match); +# endif +# if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) + uint32_t longest_match_unaligned_64(deflate_state *const s, Pos cur_match); +# endif +# endif + +uint32_t longest_match_slow_c(deflate_state *const s, Pos cur_match); +# if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN + uint32_t longest_match_slow_unaligned_16(deflate_state *const s, Pos cur_match); + uint32_t longest_match_slow_unaligned_32(deflate_state *const s, Pos cur_match); +# ifdef UNALIGNED64_OK + uint32_t longest_match_slow_unaligned_64(deflate_state *const s, Pos cur_match); +# endif +# endif + + +// Select generic implementation for longest_match, longest_match_slow, longest_match_slow functions. +#if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN +# if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) +# define longest_match_generic longest_match_unaligned_64 +# define longest_match_slow_generic longest_match_slow_unaligned_64 +# define compare256_generic compare256_unaligned_64 +# elif defined(HAVE_BUILTIN_CTZ) +# define longest_match_generic longest_match_unaligned_32 +# define longest_match_slow_generic longest_match_slow_unaligned_32 +# define compare256_generic compare256_unaligned_32 +# else +# define longest_match_generic longest_match_unaligned_16 +# define longest_match_slow_generic longest_match_slow_unaligned_16 +# define compare256_generic compare256_unaligned_16 +# endif +#else +# define longest_match_generic longest_match_c +# define longest_match_slow_generic longest_match_slow_c +# define compare256_generic compare256_c +#endif + + +#ifdef DISABLE_RUNTIME_CPU_DETECTION +// Generic code +# define native_adler32 adler32_c +# define native_adler32_fold_copy adler32_fold_copy_c +# define native_chunkmemset_safe chunkmemset_safe_c +# define native_chunksize chunksize_c +# define native_crc32 PREFIX(crc32_braid) +# define native_crc32_fold crc32_fold_c +# define native_crc32_fold_copy crc32_fold_copy_c +# define native_crc32_fold_final crc32_fold_final_c +# define native_crc32_fold_reset crc32_fold_reset_c +# define native_inflate_fast inflate_fast_c +# define native_slide_hash slide_hash_c +# define native_longest_match longest_match_generic +# define native_longest_match_slow longest_match_slow_generic +# define native_compare256 compare256_generic +#endif + +#endif diff --git a/src/native/external/zlib-ng/arch/generic/slide_hash_c.c b/src/native/external/zlib-ng/arch/generic/slide_hash_c.c new file mode 100644 index 00000000000000..8345b9e36b8523 --- /dev/null +++ b/src/native/external/zlib-ng/arch/generic/slide_hash_c.c @@ -0,0 +1,52 @@ +/* slide_hash.c -- slide hash table C implementation + * + * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zbuild.h" +#include "deflate.h" + +/* =========================================================================== + * 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. + */ +static inline void slide_hash_c_chain(Pos *table, uint32_t entries, uint16_t wsize) { +#ifdef NOT_TWEAK_COMPILER + table += entries; + do { + unsigned m; + m = *--table; + *table = (Pos)(m >= wsize ? m-wsize : 0); + /* If entries is not on any hash chain, prev[entries] is garbage but + * its value will never be used. + */ + } while (--entries); +#else + { + /* As of I make this change, gcc (4.8.*) isn't able to vectorize + * this hot loop using saturated-subtraction on x86-64 architecture. + * To avoid this defect, we can change the loop such that + * o. the pointer advance forward, and + * o. demote the variable 'm' to be local to the loop, and + * choose type "Pos" (instead of 'unsigned int') for the + * variable to avoid unnecessary zero-extension. + */ + unsigned int i; + Pos *q = table; + for (i = 0; i < entries; i++) { + Pos m = *q; + Pos t = (Pos)wsize; + *q++ = (Pos)(m >= t ? m-t: 0); + } + } +#endif /* NOT_TWEAK_COMPILER */ +} + +Z_INTERNAL void slide_hash_c(deflate_state *s) { + uint16_t wsize = (uint16_t)s->w_size; + + slide_hash_c_chain(s->head, HASH_SIZE, wsize); + slide_hash_c_chain(s->prev, wsize, wsize); +} diff --git a/src/native/external/zlib-ng/arch/power/chunkset_power8.c b/src/native/external/zlib-ng/arch/power/chunkset_power8.c index 7cbb8029b3b141..aef19732736f57 100644 --- a/src/native/external/zlib-ng/arch/power/chunkset_power8.c +++ b/src/native/external/zlib-ng/arch/power/chunkset_power8.c @@ -4,7 +4,7 @@ #ifdef POWER8_VSX #include -#include "../../zbuild.h" +#include "zbuild.h" typedef vector unsigned char chunk_t; diff --git a/src/native/external/zlib-ng/arch/power/compare256_power9.c b/src/native/external/zlib-ng/arch/power/compare256_power9.c index 9b0ddaf8004501..c8be498e4f60b2 100644 --- a/src/native/external/zlib-ng/arch/power/compare256_power9.c +++ b/src/native/external/zlib-ng/arch/power/compare256_power9.c @@ -5,8 +5,10 @@ #ifdef POWER9 #include -#include "../../zbuild.h" -#include "../../zendian.h" +#include "zbuild.h" +#include "zutil_p.h" +#include "deflate.h" +#include "zendian.h" /* Older versions of GCC misimplemented semantics for these bit counting builtins. * https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=3f30f2d1dbb3228b8468b26239fe60c2974ce2ac */ diff --git a/src/native/external/zlib-ng/arch/power/power_features.c b/src/native/external/zlib-ng/arch/power/power_features.c index f73503734b13d5..4939d1c18f3422 100644 --- a/src/native/external/zlib-ng/arch/power/power_features.c +++ b/src/native/external/zlib-ng/arch/power/power_features.c @@ -1,16 +1,19 @@ /* power_features.c - POWER feature check * Copyright (C) 2020 Matheus Castanho , IBM - * Copyright (C) 2021-2022 Mika T. Lindqvist + * Copyright (C) 2021-2024 Mika T. Lindqvist * For conditions of distribution and use, see copyright notice in zlib.h */ #ifdef HAVE_SYS_AUXV_H # include #endif +#ifdef POWER_NEED_AUXVEC_H +# include +#endif #ifdef __FreeBSD__ # include #endif -#include "../../zbuild.h" +#include "zbuild.h" #include "power_features.h" void Z_INTERNAL power_check_features(struct power_cpu_features *features) { diff --git a/src/native/external/zlib-ng/arch/power/power_features.h b/src/native/external/zlib-ng/arch/power/power_features.h index 9252364cc48d2f..1ff51de5ddc581 100644 --- a/src/native/external/zlib-ng/arch/power/power_features.h +++ b/src/native/external/zlib-ng/arch/power/power_features.h @@ -4,8 +4,8 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#ifndef POWER_H_ -#define POWER_H_ +#ifndef POWER_FEATURES_H_ +#define POWER_FEATURES_H_ struct power_cpu_features { int has_altivec; @@ -15,4 +15,4 @@ struct power_cpu_features { void Z_INTERNAL power_check_features(struct power_cpu_features *features); -#endif /* POWER_H_ */ +#endif /* POWER_FEATURES_H_ */ diff --git a/src/native/external/zlib-ng/arch/power/power_functions.h b/src/native/external/zlib-ng/arch/power/power_functions.h new file mode 100644 index 00000000000000..cb6b7650ecafa9 --- /dev/null +++ b/src/native/external/zlib-ng/arch/power/power_functions.h @@ -0,0 +1,67 @@ +/* power_functions.h -- POWER implementations for arch-specific functions. + * Copyright (C) 2020 Matheus Castanho , IBM + * Copyright (C) 2021 Mika T. Lindqvist + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef POWER_FUNCTIONS_H_ +#define POWER_FUNCTIONS_H_ + +#ifdef PPC_VMX +uint32_t adler32_vmx(uint32_t adler, const uint8_t *buf, size_t len); +void slide_hash_vmx(deflate_state *s); +#endif + +#ifdef POWER8_VSX +uint32_t adler32_power8(uint32_t adler, const uint8_t *buf, size_t len); +uint32_t chunksize_power8(void); +uint8_t* chunkmemset_safe_power8(uint8_t *out, unsigned dist, unsigned len, unsigned left); +uint32_t crc32_power8(uint32_t crc, const uint8_t *buf, size_t len); +void slide_hash_power8(deflate_state *s); +void inflate_fast_power8(PREFIX3(stream) *strm, uint32_t start); +#endif + +#ifdef POWER9 +uint32_t compare256_power9(const uint8_t *src0, const uint8_t *src1); +uint32_t longest_match_power9(deflate_state *const s, Pos cur_match); +uint32_t longest_match_slow_power9(deflate_state *const s, Pos cur_match); +#endif + + +#ifdef DISABLE_RUNTIME_CPU_DETECTION +// Power - VMX +# if defined(PPC_VMX) && defined(__ALTIVEC__) +# undef native_adler32 +# define native_adler32 adler32_vmx +# undef native_slide_hash +# define native_slide_hash slide_hash_vmx +# endif +// Power8 - VSX +# if defined(POWER8_VSX) && defined(_ARCH_PWR8) && defined(__VSX__) +# undef native_adler32 +# define native_adler32 adler32_power8 +# undef native_chunkmemset_safe +# define native_chunkmemset_safe chunkmemset_safe_power8 +# undef native_chunksize +# define native_chunksize chunksize_power8 +# undef native_inflate_fast +# define native_inflate_fast inflate_fast_power8 +# undef native_slide_hash +# define native_slide_hash slide_hash_power8 +# endif +# if defined(POWER8_VSX_CRC32) && defined(_ARCH_PWR8) && defined(__VSX__) +# undef native_crc32 +# define native_crc32 crc32_power8 +# endif +// Power9 +# if defined(POWER9) && defined(_ARCH_PWR9) +# undef native_compare256 +# define native_compare256 compare256_power9 +# undef native_longest_match +# define native_longest_match longest_match_power9 +# undef native_longest_match_slow +# define native_longest_match_slow longest_match_slow_power9 +# endif +#endif + +#endif /* POWER_FUNCTIONS_H_ */ diff --git a/src/native/external/zlib-ng/arch/power/slide_ppc_tpl.h b/src/native/external/zlib-ng/arch/power/slide_ppc_tpl.h index 680a7f8e2af407..5c17e38fb31036 100644 --- a/src/native/external/zlib-ng/arch/power/slide_ppc_tpl.h +++ b/src/native/external/zlib-ng/arch/power/slide_ppc_tpl.h @@ -24,8 +24,7 @@ static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize } void Z_INTERNAL SLIDE_PPC(deflate_state *s) { - Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); - uint16_t wsize = (uint16_t)s->w_size; + uint16_t wsize = s->w_size; slide_hash_chain(s->head, HASH_SIZE, wsize); slide_hash_chain(s->prev, wsize, wsize); diff --git a/src/native/external/zlib-ng/arch/riscv/adler32_rvv.c b/src/native/external/zlib-ng/arch/riscv/adler32_rvv.c index da46f37e73c18c..d0f9aaa567b381 100644 --- a/src/native/external/zlib-ng/arch/riscv/adler32_rvv.c +++ b/src/native/external/zlib-ng/arch/riscv/adler32_rvv.c @@ -9,8 +9,8 @@ #include #include -#include "../../zbuild.h" -#include "../../adler32_p.h" +#include "zbuild.h" +#include "adler32_p.h" static inline uint32_t adler32_rvv_impl(uint32_t adler, uint8_t* restrict dst, const uint8_t *src, size_t len, int COPY) { /* split Adler-32 into component sums */ diff --git a/src/native/external/zlib-ng/arch/riscv/compare256_rvv.c b/src/native/external/zlib-ng/arch/riscv/compare256_rvv.c index 0fd6082c44d0ab..3d6c3e3aa5b1e9 100644 --- a/src/native/external/zlib-ng/arch/riscv/compare256_rvv.c +++ b/src/native/external/zlib-ng/arch/riscv/compare256_rvv.c @@ -6,7 +6,9 @@ #ifdef RISCV_RVV -#include "../../zbuild.h" +#include "zbuild.h" +#include "zutil_p.h" +#include "deflate.h" #include "fallback_builtins.h" #include diff --git a/src/native/external/zlib-ng/arch/riscv/riscv_features.c b/src/native/external/zlib-ng/arch/riscv/riscv_features.c index b066f427e0fc3e..1e3f45e0a73a55 100644 --- a/src/native/external/zlib-ng/arch/riscv/riscv_features.c +++ b/src/native/external/zlib-ng/arch/riscv/riscv_features.c @@ -1,10 +1,13 @@ #include #include #include -#include #include -#include "../../zbuild.h" +#if defined(__linux__) && defined(HAVE_SYS_AUXV_H) +# include +#endif + +#include "zbuild.h" #include "riscv_features.h" #define ISA_V_HWCAP (1 << ('v' - 'a')) @@ -33,7 +36,11 @@ void Z_INTERNAL riscv_check_features_compile_time(struct riscv_cpu_features *fea } void Z_INTERNAL riscv_check_features_runtime(struct riscv_cpu_features *features) { +#if defined(__linux__) && defined(HAVE_SYS_AUXV_H) unsigned long hw_cap = getauxval(AT_HWCAP); +#else + unsigned long hw_cap = 0; +#endif features->has_rvv = hw_cap & ISA_V_HWCAP; } diff --git a/src/native/external/zlib-ng/arch/riscv/riscv_features.h b/src/native/external/zlib-ng/arch/riscv/riscv_features.h index c76e967c36ceca..b1593acc256703 100644 --- a/src/native/external/zlib-ng/arch/riscv/riscv_features.h +++ b/src/native/external/zlib-ng/arch/riscv/riscv_features.h @@ -6,8 +6,8 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#ifndef RISCV_H_ -#define RISCV_H_ +#ifndef RISCV_FEATURES_H_ +#define RISCV_FEATURES_H_ struct riscv_cpu_features { int has_rvv; @@ -15,4 +15,4 @@ struct riscv_cpu_features { void Z_INTERNAL riscv_check_features(struct riscv_cpu_features *features); -#endif /* RISCV_H_ */ +#endif /* RISCV_FEATURES_H_ */ diff --git a/src/native/external/zlib-ng/arch/riscv/riscv_functions.h b/src/native/external/zlib-ng/arch/riscv/riscv_functions.h new file mode 100644 index 00000000000000..015b2fbd75c427 --- /dev/null +++ b/src/native/external/zlib-ng/arch/riscv/riscv_functions.h @@ -0,0 +1,49 @@ +/* riscv_functions.h -- RISCV implementations for arch-specific functions. + * + * Copyright (C) 2023 SiFive, Inc. All rights reserved. + * Contributed by Alex Chiang + * + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef RISCV_FUNCTIONS_H_ +#define RISCV_FUNCTIONS_H_ + +#ifdef RISCV_RVV +uint32_t adler32_rvv(uint32_t adler, const uint8_t *buf, size_t len); +uint32_t adler32_fold_copy_rvv(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); +uint32_t chunksize_rvv(void); +uint8_t* chunkmemset_safe_rvv(uint8_t *out, unsigned dist, unsigned len, unsigned left); +uint32_t compare256_rvv(const uint8_t *src0, const uint8_t *src1); + +uint32_t longest_match_rvv(deflate_state *const s, Pos cur_match); +uint32_t longest_match_slow_rvv(deflate_state *const s, Pos cur_match); +void slide_hash_rvv(deflate_state *s); +void inflate_fast_rvv(PREFIX3(stream) *strm, uint32_t start); +#endif + +#ifdef DISABLE_RUNTIME_CPU_DETECTION +// RISCV - RVV +# if defined(RISCV_RVV) && defined(__riscv_v) && defined(__linux__) +# undef native_adler32 +# define native_adler32 adler32_rvv +# undef native_adler32_fold_copy +# define native_adler32_fold_copy adler32_fold_copy_rvv +# undef native_chunkmemset_safe +# define native_chunkmemset_safe chunkmemset_safe_rvv +# undef native_chunksize +# define native_chunksize chunksize_rvv +# undef native_compare256 +# define native_compare256 compare256_rvv +# undef native_inflate_fast +# define native_inflate_fast inflate_fast_rvv +# undef native_longest_match +# define native_longest_match longest_match_rvv +# undef native_longest_match_slow +# define native_longest_match_slow longest_match_slow_rvv +# undef native_slide_hash +# define native_slide_hash slide_hash_rvv +# endif +#endif + +#endif /* RISCV_FUNCTIONS_H_ */ diff --git a/src/native/external/zlib-ng/arch/riscv/slide_hash_rvv.c b/src/native/external/zlib-ng/arch/riscv/slide_hash_rvv.c index b70a44b63e0e70..ac28bbd9f26e5e 100644 --- a/src/native/external/zlib-ng/arch/riscv/slide_hash_rvv.c +++ b/src/native/external/zlib-ng/arch/riscv/slide_hash_rvv.c @@ -8,24 +8,21 @@ #include -#include "../../zbuild.h" -#include "../../deflate.h" +#include "zbuild.h" +#include "deflate.h" static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize) { size_t vl; while (entries > 0) { vl = __riscv_vsetvl_e16m4(entries); vuint16m4_t v_tab = __riscv_vle16_v_u16m4(table, vl); - vuint16m4_t v_diff = __riscv_vsub_vx_u16m4(v_tab, wsize, vl); - vbool4_t mask = __riscv_vmsltu_vx_u16m4_b4(v_tab, wsize, vl); - v_tab = __riscv_vmerge_vxm_u16m4(v_diff, 0, mask, vl); - __riscv_vse16_v_u16m4(table, v_tab, vl); + vuint16m4_t v_diff = __riscv_vssubu_vx_u16m4(v_tab, wsize, vl); + __riscv_vse16_v_u16m4(table, v_diff, vl); table += vl, entries -= vl; } } Z_INTERNAL void slide_hash_rvv(deflate_state *s) { - Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); uint16_t wsize = (uint16_t)s->w_size; slide_hash_chain(s->head, HASH_SIZE, wsize); diff --git a/src/native/external/zlib-ng/arch/s390/Makefile.in b/src/native/external/zlib-ng/arch/s390/Makefile.in index 6b4fba7775c4a9..e994157df2d34a 100644 --- a/src/native/external/zlib-ng/arch/s390/Makefile.in +++ b/src/native/external/zlib-ng/arch/s390/Makefile.in @@ -20,12 +20,6 @@ s390_features.o: s390_features.lo: $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/s390_features.c -dfltcc_common.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_common.c - -dfltcc_common.lo: - $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_common.c - dfltcc_deflate.o: $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_deflate.c diff --git a/src/native/external/zlib-ng/arch/s390/README.md b/src/native/external/zlib-ng/arch/s390/README.md index 2c3165412c0041..7b383cc9981aa1 100644 --- a/src/native/external/zlib-ng/arch/s390/README.md +++ b/src/native/external/zlib-ng/arch/s390/README.md @@ -61,11 +61,11 @@ integrated with the rest of zlib-ng using hook macros. ## Hook macros DFLTCC takes as arguments a parameter block, an input buffer, an output -buffer and a window. `ZALLOC_DEFLATE_STATE()`, `ZALLOC_INFLATE_STATE()`, -`ZFREE_STATE()`, `ZCOPY_DEFLATE_STATE()`, `ZCOPY_INFLATE_STATE()`, -`ZALLOC_WINDOW()`, `ZCOPY_WINDOW()` and `TRY_FREE_WINDOW()` macros encapsulate -allocation details for the parameter block (which is allocated alongside -zlib-ng state) and the window (which must be page-aligned and large enough). +buffer, and a window. Parameter blocks are stored alongside zlib states; +buffers are forwarded from the caller; and window - which must be +4k-aligned and is always 64k large, is managed using the `PAD_WINDOW()`, +`WINDOW_PAD_SIZE`, `HINT_ALIGNED_WINDOW` and `DEFLATE_ADJUST_WINDOW_SIZE()` +and `INFLATE_ADJUST_WINDOW_SIZE()` hooks. Software and hardware window formats do not match, therefore, `deflateSetDictionary()`, `deflateGetDictionary()`, `inflateSetDictionary()` @@ -117,8 +117,7 @@ converted to calls to functions, which are implemented in `arch/s390/dfltcc_*` files. The functions can be grouped in three broad categories: -* Base DFLTCC support, e.g. wrapping the machine instruction - - `dfltcc()` and allocating aligned memory - `dfltcc_alloc_state()`. +* Base DFLTCC support, e.g. wrapping the machine instruction - `dfltcc()`. * Translating between software and hardware data formats, e.g. `dfltcc_deflate_set_dictionary()`. * Translating between software and hardware state machines, e.g. @@ -214,29 +213,31 @@ DFLTCC is a non-privileged instruction, neither special VM/LPAR configuration nor root are required. zlib-ng CI uses an IBM-provided z15 self-hosted builder for the DFLTCC -testing. There are no IBM Z builds of GitHub Actions runner, and -stable qemu-user has problems with .NET apps, so the builder runs the -x86_64 runner version with qemu-user built from the master branch. +testing. There is no official IBM Z GitHub Actions runner, so we build +one inspired by `anup-kodlekere/gaplib`. +Future updates to actions-runner might need an updated patch. The .net +version number patch has been separated into a separate file to avoid a +need for constantly changing the patch. ## Configuring the builder. ### Install prerequisites. ``` -$ sudo dnf install docker +sudo dnf install podman ``` -### Add services. +### Add actions-runner service. ``` -$ sudo cp self-hosted-builder/*.service /etc/systemd/system/ -$ sudo systemctl daemon-reload +sudo cp self-hosted-builder/actions-runner.service /etc/systemd/system/ +sudo systemctl daemon-reload ``` -### Create a config file. +### Create a config file, needs github personal access token. ``` -$ sudo tee /etc/actions-runner +# Create file /etc/actions-runner repo=/ access_token= ``` @@ -245,40 +246,32 @@ Access token should have the repo scope, consult https://docs.github.com/en/rest/reference/actions#create-a-registration-token-for-a-repository for details. -### Autostart the x86_64 emulation support. +### Autostart actions-runner. ``` -$ sudo systemctl enable --now qemu-user-static +$ sudo systemctl enable --now actions-runner ``` -### Autostart the runner. +## Rebuilding the container +In order to update the `gaplib-actions-runner` podman container, e.g. to get the +latest OS security fixes, follow these steps: ``` -$ sudo systemctl enable --now actions-runner -``` +# Stop actions-runner service +sudo systemctl stop actions-runner -## Rebuilding the image +# Delete old container +sudo podman container rm gaplib-actions-runner -In order to update the `iiilinuxibmcom/actions-runner` image, e.g. to get the -latest OS security fixes, use the following commands: +# Delete old image +sudo podman image rm localhost/zlib-ng/actions-runner -``` -$ sudo docker build \ - --pull \ - -f self-hosted-builder/actions-runner.Dockerfile \ - -t iiilinuxibmcom/actions-runner -$ sudo systemctl restart actions-runner -``` - -## Removing persistent data +# Build image +sudo podman build --squash -f Dockerfile.zlib-ng --tag zlib-ng/actions-runner --build-arg . -The `actions-runner` service stores various temporary data, such as runner -registration information, work directories and logs, in the `actions-runner` -volume. In order to remove it and start from scratch, e.g. when switching the -runner to a different repository, use the following commands: +# Build container +sudo podman create --name=gaplib-actions-runner --env-file=/etc/actions-runner --init --interactive --volume=actions-runner-temp:/home/actions-runner zlib-ng/actions-runner -``` -$ sudo systemctl stop actions-runner -$ sudo docker rm -f actions-runner -$ sudo docker volume rm actions-runner +# Start actions-runner service +sudo systemctl start actions-runner ``` diff --git a/src/native/external/zlib-ng/arch/s390/crc32-vx.c b/src/native/external/zlib-ng/arch/s390/crc32-vx.c index acfa21887e975b..b3dcbf70305ce5 100644 --- a/src/native/external/zlib-ng/arch/s390/crc32-vx.c +++ b/src/native/external/zlib-ng/arch/s390/crc32-vx.c @@ -12,8 +12,8 @@ * relicensed under the zlib license. */ -#include "../../zbuild.h" -#include "crc32_braid_p.h" +#include "zbuild.h" +#include "arch_functions.h" #include diff --git a/src/native/external/zlib-ng/arch/s390/dfltcc_common.h b/src/native/external/zlib-ng/arch/s390/dfltcc_common.h index b73437411b8e51..a6527ab5df126a 100644 --- a/src/native/external/zlib-ng/arch/s390/dfltcc_common.h +++ b/src/native/external/zlib-ng/arch/s390/dfltcc_common.h @@ -3,20 +3,95 @@ #include "zutil.h" -void Z_INTERNAL *PREFIX(dfltcc_alloc_window)(PREFIX3(streamp) strm, uInt items, uInt size); -void Z_INTERNAL PREFIX(dfltcc_copy_window)(void *dest, const void *src, size_t n); -void Z_INTERNAL PREFIX(dfltcc_free_window)(PREFIX3(streamp) strm, void *w); +/* + Parameter Block for Query Available Functions. + */ +struct dfltcc_qaf_param { + char fns[16]; + char reserved1[8]; + char fmts[2]; + char reserved2[6]; +} ALIGNED_(8); -#define ZFREE_STATE ZFREE +/* + Parameter Block for Generate Dynamic-Huffman Table, Compress and Expand. + */ +struct dfltcc_param_v0 { + uint16_t pbvn; /* Parameter-Block-Version Number */ + uint8_t mvn; /* Model-Version Number */ + uint8_t ribm; /* Reserved for IBM use */ + uint32_t reserved32 : 31; + uint32_t cf : 1; /* Continuation Flag */ + uint8_t reserved64[8]; + uint32_t nt : 1; /* New Task */ + uint32_t reserved129 : 1; + uint32_t cvt : 1; /* Check Value Type */ + uint32_t reserved131 : 1; + uint32_t htt : 1; /* Huffman-Table Type */ + uint32_t bcf : 1; /* Block-Continuation Flag */ + uint32_t bcc : 1; /* Block Closing Control */ + uint32_t bhf : 1; /* Block Header Final */ + uint32_t reserved136 : 1; + uint32_t reserved137 : 1; + uint32_t dhtgc : 1; /* DHT Generation Control */ + uint32_t reserved139 : 5; + uint32_t reserved144 : 5; + uint32_t sbb : 3; /* Sub-Byte Boundary */ + uint8_t oesc; /* Operation-Ending-Supplemental Code */ + uint32_t reserved160 : 12; + uint32_t ifs : 4; /* Incomplete-Function Status */ + uint16_t ifl; /* Incomplete-Function Length */ + uint8_t reserved192[8]; + uint8_t reserved256[8]; + uint8_t reserved320[4]; + uint16_t hl; /* History Length */ + uint32_t reserved368 : 1; + uint16_t ho : 15; /* History Offset */ + uint32_t cv; /* Check Value */ + uint32_t eobs : 15; /* End-of-block Symbol */ + uint32_t reserved431: 1; + uint8_t eobl : 4; /* End-of-block Length */ + uint32_t reserved436 : 12; + uint32_t reserved448 : 4; + uint16_t cdhtl : 12; /* Compressed-Dynamic-Huffman Table + Length */ + uint8_t reserved464[6]; + uint8_t cdht[288]; /* Compressed-Dynamic-Huffman Table */ + uint8_t reserved[24]; + uint8_t ribm2[8]; /* Reserved for IBM use */ + uint8_t csb[1152]; /* Continuation-State Buffer */ +} ALIGNED_(8); -#define ZALLOC_WINDOW PREFIX(dfltcc_alloc_window) +/* + Extension of inflate_state and deflate_state. + */ +struct dfltcc_state { + struct dfltcc_param_v0 param; /* Parameter block. */ + struct dfltcc_qaf_param af; /* Available functions. */ + char msg[64]; /* Buffer for strm->msg */ +}; -#define ZCOPY_WINDOW PREFIX(dfltcc_copy_window) +typedef struct { + struct dfltcc_state common; + uint16_t level_mask; /* Levels on which to use DFLTCC */ + uint32_t block_size; /* New block each X bytes */ + size_t block_threshold; /* New block after total_in > X */ + uint32_t dht_threshold; /* New block only if avail_in >= X */ +} arch_deflate_state; -#define ZFREE_WINDOW PREFIX(dfltcc_free_window) +typedef struct { + struct dfltcc_state common; +} arch_inflate_state; -#define TRY_FREE_WINDOW PREFIX(dfltcc_free_window) +/* + History buffer size. + */ +#define HB_BITS 15 +#define HB_SIZE (1 << HB_BITS) +/* + Sizes of deflate block parts. + */ #define DFLTCC_BLOCK_HEADER_BITS 3 #define DFLTCC_HLITS_COUNT_BITS 5 #define DFLTCC_HDISTS_COUNT_BITS 5 diff --git a/src/native/external/zlib-ng/arch/s390/dfltcc_deflate.c b/src/native/external/zlib-ng/arch/s390/dfltcc_deflate.c index 3ad988afc7bb98..90b4b96e9ce335 100644 --- a/src/native/external/zlib-ng/arch/s390/dfltcc_deflate.c +++ b/src/native/external/zlib-ng/arch/s390/dfltcc_deflate.c @@ -19,23 +19,9 @@ #include "dfltcc_deflate.h" #include "dfltcc_detail.h" -struct dfltcc_deflate_state { - struct dfltcc_state common; - uint16_t level_mask; /* Levels on which to use DFLTCC */ - uint32_t block_size; /* New block each X bytes */ - size_t block_threshold; /* New block after total_in > X */ - uint32_t dht_threshold; /* New block only if avail_in >= X */ -}; - -#define GET_DFLTCC_DEFLATE_STATE(state) ((struct dfltcc_deflate_state *)GET_DFLTCC_STATE(state)) - -void Z_INTERNAL *PREFIX(dfltcc_alloc_deflate_state)(PREFIX3(streamp) strm) { - return dfltcc_alloc_state(strm, sizeof(deflate_state), sizeof(struct dfltcc_deflate_state)); -} - void Z_INTERNAL PREFIX(dfltcc_reset_deflate_state)(PREFIX3(streamp) strm) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_deflate_state *dfltcc_state = GET_DFLTCC_DEFLATE_STATE(state); + arch_deflate_state *dfltcc_state = &state->arch; dfltcc_reset_state(&dfltcc_state->common); @@ -46,14 +32,10 @@ void Z_INTERNAL PREFIX(dfltcc_reset_deflate_state)(PREFIX3(streamp) strm) { dfltcc_state->dht_threshold = DFLTCC_DHT_MIN_SAMPLE_SIZE; } -void Z_INTERNAL PREFIX(dfltcc_copy_deflate_state)(void *dst, const void *src) { - dfltcc_copy_state(dst, src, sizeof(deflate_state), sizeof(struct dfltcc_deflate_state)); -} - static inline int dfltcc_can_deflate_with_params(PREFIX3(streamp) strm, int level, uInt window_bits, int strategy, int reproducible) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_deflate_state *dfltcc_state = GET_DFLTCC_DEFLATE_STATE(state); + arch_deflate_state *dfltcc_state = &state->arch; /* Unsupported compression settings */ if ((dfltcc_state->level_mask & (1 << level)) == 0) @@ -82,7 +64,7 @@ int Z_INTERNAL PREFIX(dfltcc_can_deflate)(PREFIX3(streamp) strm) { static inline void dfltcc_gdht(PREFIX3(streamp) strm) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; size_t avail_in = strm->avail_in; dfltcc(DFLTCC_GDHT, param, NULL, NULL, &strm->next_in, &avail_in, NULL); @@ -90,7 +72,7 @@ static inline void dfltcc_gdht(PREFIX3(streamp) strm) { static inline dfltcc_cc dfltcc_cmpr(PREFIX3(streamp) strm) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; size_t avail_in = strm->avail_in; size_t avail_out = strm->avail_out; dfltcc_cc cc; @@ -127,7 +109,7 @@ static inline void send_eobs(PREFIX3(streamp) strm, const struct dfltcc_param_v0 int Z_INTERNAL PREFIX(dfltcc_deflate)(PREFIX3(streamp) strm, int flush, block_state *result) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_deflate_state *dfltcc_state = GET_DFLTCC_DEFLATE_STATE(state); + arch_deflate_state *dfltcc_state = &state->arch; struct dfltcc_param_v0 *param = &dfltcc_state->common.param; uInt masked_avail_in; dfltcc_cc cc; @@ -328,7 +310,7 @@ int Z_INTERNAL PREFIX(dfltcc_deflate)(PREFIX3(streamp) strm, int flush, block_st */ static int dfltcc_was_deflate_used(PREFIX3(streamp) strm) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; return strm->total_in > 0 || param->nt == 0 || param->hl > 0; } @@ -353,8 +335,7 @@ int Z_INTERNAL PREFIX(dfltcc_deflate_params)(PREFIX3(streamp) strm, int level, i int Z_INTERNAL PREFIX(dfltcc_deflate_done)(PREFIX3(streamp) strm, int flush) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; /* When deflate(Z_FULL_FLUSH) is called with small avail_out, it might * close the block without resetting the compression state. Detect this @@ -382,8 +363,7 @@ int Z_INTERNAL PREFIX(dfltcc_can_set_reproducible)(PREFIX3(streamp) strm, int re int Z_INTERNAL PREFIX(dfltcc_deflate_set_dictionary)(PREFIX3(streamp) strm, const unsigned char *dictionary, uInt dict_length) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; append_history(param, state->window, dictionary, dict_length); state->strstart = 1; /* Add FDICT to zlib header */ @@ -393,8 +373,7 @@ int Z_INTERNAL PREFIX(dfltcc_deflate_set_dictionary)(PREFIX3(streamp) strm, int Z_INTERNAL PREFIX(dfltcc_deflate_get_dictionary)(PREFIX3(streamp) strm, unsigned char *dictionary, uInt *dict_length) { deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; if (dictionary) get_history(param, state->window, dictionary); diff --git a/src/native/external/zlib-ng/arch/s390/dfltcc_deflate.h b/src/native/external/zlib-ng/arch/s390/dfltcc_deflate.h index cb261b156c78b2..35e2fd3f626a39 100644 --- a/src/native/external/zlib-ng/arch/s390/dfltcc_deflate.h +++ b/src/native/external/zlib-ng/arch/s390/dfltcc_deflate.h @@ -1,11 +1,10 @@ #ifndef DFLTCC_DEFLATE_H #define DFLTCC_DEFLATE_H +#include "deflate.h" #include "dfltcc_common.h" -void Z_INTERNAL *PREFIX(dfltcc_alloc_deflate_state)(PREFIX3(streamp)); void Z_INTERNAL PREFIX(dfltcc_reset_deflate_state)(PREFIX3(streamp)); -void Z_INTERNAL PREFIX(dfltcc_copy_deflate_state)(void *dst, const void *src); int Z_INTERNAL PREFIX(dfltcc_can_deflate)(PREFIX3(streamp) strm); int Z_INTERNAL PREFIX(dfltcc_deflate)(PREFIX3(streamp) strm, int flush, block_state *result); int Z_INTERNAL PREFIX(dfltcc_deflate_params)(PREFIX3(streamp) strm, int level, int strategy, int *flush); @@ -15,9 +14,6 @@ int Z_INTERNAL PREFIX(dfltcc_deflate_set_dictionary)(PREFIX3(streamp) strm, const unsigned char *dictionary, uInt dict_length); int Z_INTERNAL PREFIX(dfltcc_deflate_get_dictionary)(PREFIX3(streamp) strm, unsigned char *dictionary, uInt* dict_length); -#define ZALLOC_DEFLATE_STATE PREFIX(dfltcc_alloc_deflate_state) -#define ZCOPY_DEFLATE_STATE PREFIX(dfltcc_copy_deflate_state) - #define DEFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) \ do { \ if (PREFIX(dfltcc_can_deflate)((strm))) \ @@ -57,4 +53,6 @@ int Z_INTERNAL PREFIX(dfltcc_deflate_get_dictionary)(PREFIX3(streamp) strm, unsi #define DEFLATE_CAN_SET_REPRODUCIBLE PREFIX(dfltcc_can_set_reproducible) +#define DEFLATE_ADJUST_WINDOW_SIZE(n) MAX(n, HB_SIZE) + #endif diff --git a/src/native/external/zlib-ng/arch/s390/dfltcc_detail.h b/src/native/external/zlib-ng/arch/s390/dfltcc_detail.h index 362d94c337fd83..ae6001ba38634e 100644 --- a/src/native/external/zlib-ng/arch/s390/dfltcc_detail.h +++ b/src/native/external/zlib-ng/arch/s390/dfltcc_detail.h @@ -1,4 +1,4 @@ -#include "../../zbuild.h" +#include "zbuild.h" #include #ifdef HAVE_SYS_SDT_H @@ -24,18 +24,8 @@ #define DFLTCC_RIBM 0 #endif -/* - Parameter Block for Query Available Functions. - */ #define static_assert(c, msg) __attribute__((unused)) static char static_assert_failed_ ## msg[c ? 1 : -1] -struct dfltcc_qaf_param { - char fns[16]; - char reserved1[8]; - char fmts[2]; - char reserved2[6]; -}; - #define DFLTCC_SIZEOF_QAF 32 static_assert(sizeof(struct dfltcc_qaf_param) == DFLTCC_SIZEOF_QAF, qaf); @@ -74,60 +64,11 @@ static inline int is_dfltcc_enabled(void) { #define DFLTCC_FMT0 0 -/* - Parameter Block for Generate Dynamic-Huffman Table, Compress and Expand. - */ #define CVT_CRC32 0 #define CVT_ADLER32 1 #define HTT_FIXED 0 #define HTT_DYNAMIC 1 -struct dfltcc_param_v0 { - uint16_t pbvn; /* Parameter-Block-Version Number */ - uint8_t mvn; /* Model-Version Number */ - uint8_t ribm; /* Reserved for IBM use */ - uint32_t reserved32 : 31; - uint32_t cf : 1; /* Continuation Flag */ - uint8_t reserved64[8]; - uint32_t nt : 1; /* New Task */ - uint32_t reserved129 : 1; - uint32_t cvt : 1; /* Check Value Type */ - uint32_t reserved131 : 1; - uint32_t htt : 1; /* Huffman-Table Type */ - uint32_t bcf : 1; /* Block-Continuation Flag */ - uint32_t bcc : 1; /* Block Closing Control */ - uint32_t bhf : 1; /* Block Header Final */ - uint32_t reserved136 : 1; - uint32_t reserved137 : 1; - uint32_t dhtgc : 1; /* DHT Generation Control */ - uint32_t reserved139 : 5; - uint32_t reserved144 : 5; - uint32_t sbb : 3; /* Sub-Byte Boundary */ - uint8_t oesc; /* Operation-Ending-Supplemental Code */ - uint32_t reserved160 : 12; - uint32_t ifs : 4; /* Incomplete-Function Status */ - uint16_t ifl; /* Incomplete-Function Length */ - uint8_t reserved192[8]; - uint8_t reserved256[8]; - uint8_t reserved320[4]; - uint16_t hl; /* History Length */ - uint32_t reserved368 : 1; - uint16_t ho : 15; /* History Offset */ - uint32_t cv; /* Check Value */ - uint32_t eobs : 15; /* End-of-block Symbol */ - uint32_t reserved431: 1; - uint8_t eobl : 4; /* End-of-block Length */ - uint32_t reserved436 : 12; - uint32_t reserved448 : 4; - uint16_t cdhtl : 12; /* Compressed-Dynamic-Huffman Table - Length */ - uint8_t reserved464[6]; - uint8_t cdht[288]; /* Compressed-Dynamic-Huffman Table */ - uint8_t reserved[24]; - uint8_t ribm2[8]; /* Reserved for IBM use */ - uint8_t csb[1152]; /* Continuation-State Buffer */ -}; - #define DFLTCC_SIZEOF_GDHT_V0 384 #define DFLTCC_SIZEOF_CMPR_XPND_V0 1536 static_assert(offsetof(struct dfltcc_param_v0, csb) == DFLTCC_SIZEOF_GDHT_V0, gdht_v0); @@ -159,8 +100,30 @@ typedef enum { #define DFLTCC_XPND 4 #define HBT_CIRCULAR (1 << 7) #define DFLTCC_FN_MASK ((1 << 7) - 1) -#define HB_BITS 15 -#define HB_SIZE (1 << HB_BITS) + +/* Return lengths of high (starting at param->ho) and low (starting at 0) fragments of the circular history buffer. */ +static inline void get_history_lengths(struct dfltcc_param_v0 *param, size_t *hl_high, size_t *hl_low) { + *hl_high = MIN(param->hl, HB_SIZE - param->ho); + *hl_low = param->hl - *hl_high; +} + +/* Notify instrumentation about an upcoming read/write access to the circular history buffer. */ +static inline void instrument_read_write_hist(struct dfltcc_param_v0 *param, void *hist) { + size_t hl_high, hl_low; + + get_history_lengths(param, &hl_high, &hl_low); + instrument_read_write(hist + param->ho, hl_high); + instrument_read_write(hist, hl_low); +} + +/* Notify MSan about a completed write to the circular history buffer. */ +static inline void msan_unpoison_hist(struct dfltcc_param_v0 *param, void *hist) { + size_t hl_high, hl_low; + + get_history_lengths(param, &hl_high, &hl_low); + __msan_unpoison(hist + param->ho, hl_high); + __msan_unpoison(hist, hl_low); +} static inline dfltcc_cc dfltcc(int fn, void *param, unsigned char **op1, size_t *len1, @@ -170,14 +133,33 @@ static inline dfltcc_cc dfltcc(int fn, void *param, size_t t3 = len1 ? *len1 : 0; z_const unsigned char *t4 = op2 ? *op2 : NULL; size_t t5 = len2 ? *len2 : 0; - Z_REGISTER int r0 __asm__("r0") = fn; - Z_REGISTER void *r1 __asm__("r1") = param; - Z_REGISTER unsigned char *r2 __asm__("r2") = t2; - Z_REGISTER size_t r3 __asm__("r3") = t3; - Z_REGISTER z_const unsigned char *r4 __asm__("r4") = t4; - Z_REGISTER size_t r5 __asm__("r5") = t5; + Z_REGISTER int r0 __asm__("r0"); + Z_REGISTER void *r1 __asm__("r1"); + Z_REGISTER unsigned char *r2 __asm__("r2"); + Z_REGISTER size_t r3 __asm__("r3"); + Z_REGISTER z_const unsigned char *r4 __asm__("r4"); + Z_REGISTER size_t r5 __asm__("r5"); int cc; + /* Insert pre-instrumentation for DFLTCC. */ + switch (fn & DFLTCC_FN_MASK) { + case DFLTCC_QAF: + instrument_write(param, DFLTCC_SIZEOF_QAF); + break; + case DFLTCC_GDHT: + instrument_read_write(param, DFLTCC_SIZEOF_GDHT_V0); + instrument_read(t4, t5); + break; + case DFLTCC_CMPR: + case DFLTCC_XPND: + instrument_read_write(param, DFLTCC_SIZEOF_CMPR_XPND_V0); + instrument_read(t4, t5); + instrument_write(t2, t3); + instrument_read_write_hist(param, hist); + break; + } + + r0 = fn; r1 = param; r2 = t2; r3 = t3; r4 = t4; r5 = t5; __asm__ volatile( #ifdef HAVE_SYS_SDT_H STAP_PROBE_ASM(zlib, dfltcc_entry, STAP_PROBE_ASM_TEMPLATE(5)) @@ -201,6 +183,7 @@ static inline dfltcc_cc dfltcc(int fn, void *param, : "cc", "memory"); t2 = r2; t3 = r3; t4 = r4; t5 = r5; + /* Insert post-instrumentation for DFLTCC. */ switch (fn & DFLTCC_FN_MASK) { case DFLTCC_QAF: __msan_unpoison(param, DFLTCC_SIZEOF_QAF); @@ -211,10 +194,12 @@ static inline dfltcc_cc dfltcc(int fn, void *param, case DFLTCC_CMPR: __msan_unpoison(param, DFLTCC_SIZEOF_CMPR_XPND_V0); __msan_unpoison(orig_t2, t2 - orig_t2 + (((struct dfltcc_param_v0 *)param)->sbb == 0 ? 0 : 1)); + msan_unpoison_hist(param, hist); break; case DFLTCC_XPND: __msan_unpoison(param, DFLTCC_SIZEOF_CMPR_XPND_V0); __msan_unpoison(orig_t2, t2 - orig_t2); + msan_unpoison_hist(param, hist); break; } @@ -229,23 +214,8 @@ static inline dfltcc_cc dfltcc(int fn, void *param, return (cc >> 28) & 3; } -/* - Extension of inflate_state and deflate_state. Must be doubleword-aligned. -*/ -struct dfltcc_state { - struct dfltcc_param_v0 param; /* Parameter block. */ - struct dfltcc_qaf_param af; /* Available functions. */ - char msg[64]; /* Buffer for strm->msg */ -}; - #define ALIGN_UP(p, size) (__typeof__(p))(((uintptr_t)(p) + ((size) - 1)) & ~((size) - 1)) -#define GET_DFLTCC_STATE(state) ((struct dfltcc_state *)((char *)(state) + ALIGN_UP(sizeof(*state), 8))) - -static inline void *dfltcc_alloc_state(PREFIX3(streamp) strm, uInt size, uInt extension_size) { - return ZALLOC(strm, 1, ALIGN_UP(size, 8) + extension_size); -} - static inline void dfltcc_reset_state(struct dfltcc_state *dfltcc_state) { /* Initialize available functions */ if (is_dfltcc_enabled()) { @@ -297,12 +267,9 @@ static inline void append_history(struct dfltcc_param_v0 *param, unsigned char * static inline void get_history(struct dfltcc_param_v0 *param, const unsigned char *history, unsigned char *buf) { - if (param->ho + param->hl <= HB_SIZE) - /* Circular history buffer does not wrap - copy one chunk */ - memcpy(buf, history + param->ho, param->hl); - else { - /* Circular history buffer wraps - copy two chunks */ - memcpy(buf, history + param->ho, HB_SIZE - param->ho); - memcpy(buf + HB_SIZE - param->ho, history, param->ho + param->hl - HB_SIZE); - } + size_t hl_high, hl_low; + + get_history_lengths(param, &hl_high, &hl_low); + memcpy(buf, history + param->ho, hl_high); + memcpy(buf + hl_high, history, hl_low); } diff --git a/src/native/external/zlib-ng/arch/s390/dfltcc_inflate.c b/src/native/external/zlib-ng/arch/s390/dfltcc_inflate.c index f0d3951b592b83..cc3cb39781c8a5 100644 --- a/src/native/external/zlib-ng/arch/s390/dfltcc_inflate.c +++ b/src/native/external/zlib-ng/arch/s390/dfltcc_inflate.c @@ -20,24 +20,15 @@ #include "dfltcc_inflate.h" #include "dfltcc_detail.h" -struct inflate_state Z_INTERNAL *PREFIX(dfltcc_alloc_inflate_state)(PREFIX3(streamp) strm) { - return (struct inflate_state *)dfltcc_alloc_state(strm, sizeof(struct inflate_state), sizeof(struct dfltcc_state)); -} - void Z_INTERNAL PREFIX(dfltcc_reset_inflate_state)(PREFIX3(streamp) strm) { struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - dfltcc_reset_state(dfltcc_state); -} - -void Z_INTERNAL PREFIX(dfltcc_copy_inflate_state)(struct inflate_state *dst, const struct inflate_state *src) { - dfltcc_copy_state(dst, src, sizeof(struct inflate_state), sizeof(struct dfltcc_state)); + dfltcc_reset_state(&state->arch.common); } int Z_INTERNAL PREFIX(dfltcc_can_inflate)(PREFIX3(streamp) strm) { struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); + struct dfltcc_state *dfltcc_state = &state->arch.common; /* Unsupported hardware */ return is_bit_set(dfltcc_state->af.fns, DFLTCC_XPND) && is_bit_set(dfltcc_state->af.fmts, DFLTCC_FMT0); @@ -45,7 +36,7 @@ int Z_INTERNAL PREFIX(dfltcc_can_inflate)(PREFIX3(streamp) strm) { static inline dfltcc_cc dfltcc_xpnd(PREFIX3(streamp) strm) { struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; size_t avail_in = strm->avail_in; size_t avail_out = strm->avail_out; dfltcc_cc cc; @@ -60,7 +51,7 @@ static inline dfltcc_cc dfltcc_xpnd(PREFIX3(streamp) strm) { dfltcc_inflate_action Z_INTERNAL PREFIX(dfltcc_inflate)(PREFIX3(streamp) strm, int flush, int *ret) { struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); + struct dfltcc_state *dfltcc_state = &state->arch.common; struct dfltcc_param_v0 *param = &dfltcc_state->param; dfltcc_cc cc; @@ -86,10 +77,9 @@ dfltcc_inflate_action Z_INTERNAL PREFIX(dfltcc_inflate)(PREFIX3(streamp) strm, i if (strm->avail_in == 0 && !param->cf) return DFLTCC_INFLATE_BREAK; - if (PREFIX(inflate_ensure_window)(state)) { - state->mode = MEM; - return DFLTCC_INFLATE_CONTINUE; - } + /* if window not in use yet, initialize */ + if (state->wsize == 0) + state->wsize = 1U << state->wbits; /* Translate stream to parameter block */ param->cvt = ((state->wrap & 4) && state->flags) ? CVT_CRC32 : CVT_ADLER32; @@ -123,9 +113,8 @@ dfltcc_inflate_action Z_INTERNAL PREFIX(dfltcc_inflate)(PREFIX3(streamp) strm, i int Z_INTERNAL PREFIX(dfltcc_was_inflate_used)(PREFIX3(streamp) strm) { struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; - return !param->nt; + return !state->arch.common.param.nt; } /* @@ -153,7 +142,7 @@ static void rotate(unsigned char *start, unsigned char *pivot, unsigned char *en int Z_INTERNAL PREFIX(dfltcc_inflate_disable)(PREFIX3(streamp) strm) { struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); + struct dfltcc_state *dfltcc_state = &state->arch.common; struct dfltcc_param_v0 *param = &dfltcc_state->param; if (!PREFIX(dfltcc_can_inflate)(strm)) @@ -178,13 +167,11 @@ int Z_INTERNAL PREFIX(dfltcc_inflate_disable)(PREFIX3(streamp) strm) { int Z_INTERNAL PREFIX(dfltcc_inflate_set_dictionary)(PREFIX3(streamp) strm, const unsigned char *dictionary, uInt dict_length) { struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; - if (PREFIX(inflate_ensure_window)(state)) { - state->mode = MEM; - return Z_MEM_ERROR; - } + /* if window not in use yet, initialize */ + if (state->wsize == 0) + state->wsize = 1U << state->wbits; append_history(param, state->window, dictionary, dict_length); state->havedict = 1; @@ -194,8 +181,7 @@ int Z_INTERNAL PREFIX(dfltcc_inflate_set_dictionary)(PREFIX3(streamp) strm, int Z_INTERNAL PREFIX(dfltcc_inflate_get_dictionary)(PREFIX3(streamp) strm, unsigned char *dictionary, uInt *dict_length) { struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; + struct dfltcc_param_v0 *param = &state->arch.common.param; if (dictionary && state->window) get_history(param, state->window, dictionary); diff --git a/src/native/external/zlib-ng/arch/s390/dfltcc_inflate.h b/src/native/external/zlib-ng/arch/s390/dfltcc_inflate.h index 632fada621ace7..3623f8ed7fee2d 100644 --- a/src/native/external/zlib-ng/arch/s390/dfltcc_inflate.h +++ b/src/native/external/zlib-ng/arch/s390/dfltcc_inflate.h @@ -3,9 +3,7 @@ #include "dfltcc_common.h" -struct inflate_state Z_INTERNAL *PREFIX(dfltcc_alloc_inflate_state)(PREFIX3(streamp) strm); void Z_INTERNAL PREFIX(dfltcc_reset_inflate_state)(PREFIX3(streamp) strm); -void Z_INTERNAL PREFIX(dfltcc_copy_inflate_state)(struct inflate_state *dst, const struct inflate_state *src); int Z_INTERNAL PREFIX(dfltcc_can_inflate)(PREFIX3(streamp) strm); typedef enum { DFLTCC_INFLATE_CONTINUE, @@ -20,9 +18,6 @@ int Z_INTERNAL PREFIX(dfltcc_inflate_set_dictionary)(PREFIX3(streamp) strm, int Z_INTERNAL PREFIX(dfltcc_inflate_get_dictionary)(PREFIX3(streamp) strm, unsigned char *dictionary, uInt* dict_length); -#define ZALLOC_INFLATE_STATE PREFIX(dfltcc_alloc_inflate_state) -#define ZCOPY_INFLATE_STATE PREFIX(dfltcc_copy_inflate_state) - #define INFLATE_RESET_KEEP_HOOK PREFIX(dfltcc_reset_inflate_state) #define INFLATE_PRIME_HOOK(strm, bits, value) \ @@ -67,4 +62,6 @@ int Z_INTERNAL PREFIX(dfltcc_inflate_get_dictionary)(PREFIX3(streamp) strm, return PREFIX(dfltcc_inflate_get_dictionary)((strm), (dict), (dict_len)); \ } while (0) +#define INFLATE_ADJUST_WINDOW_SIZE(n) MAX(n, HB_SIZE) + #endif diff --git a/src/native/external/zlib-ng/arch/s390/s390_features.c b/src/native/external/zlib-ng/arch/s390/s390_features.c index 82901060ebbb2d..629025d5bb1470 100644 --- a/src/native/external/zlib-ng/arch/s390/s390_features.c +++ b/src/native/external/zlib-ng/arch/s390/s390_features.c @@ -1,4 +1,4 @@ -#include "../../zbuild.h" +#include "zbuild.h" #include "s390_features.h" #ifdef HAVE_SYS_AUXV_H diff --git a/src/native/external/zlib-ng/arch/s390/s390_features.h b/src/native/external/zlib-ng/arch/s390/s390_features.h index b8ffef74d8441e..fb2ac14b26b5d0 100644 --- a/src/native/external/zlib-ng/arch/s390/s390_features.h +++ b/src/native/external/zlib-ng/arch/s390/s390_features.h @@ -1,3 +1,7 @@ +/* s390_features.h -- check for s390 features. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + #ifndef S390_FEATURES_H_ #define S390_FEATURES_H_ diff --git a/src/native/external/zlib-ng/arch/s390/s390_functions.h b/src/native/external/zlib-ng/arch/s390/s390_functions.h new file mode 100644 index 00000000000000..e9c67978f0a037 --- /dev/null +++ b/src/native/external/zlib-ng/arch/s390/s390_functions.h @@ -0,0 +1,20 @@ +/* s390_functions.h -- s390 implementations for arch-specific functions. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef S390_FUNCTIONS_H_ +#define S390_FUNCTIONS_H_ + +#ifdef S390_CRC32_VX +uint32_t crc32_s390_vx(uint32_t crc, const uint8_t *buf, size_t len); +#endif + + +#ifdef DISABLE_RUNTIME_CPU_DETECTION +# if defined(S390_CRC32_VX) && defined(__zarch__) && __ARCH__ >= 11 && defined(__VX__) +# undef native_crc32 +# define native_crc32 = crc32_s390_vx +# endif +#endif + +#endif diff --git a/src/native/external/zlib-ng/arch/x86/Makefile.in b/src/native/external/zlib-ng/arch/x86/Makefile.in index 7c052469b2987f..c13cd179c0cc72 100644 --- a/src/native/external/zlib-ng/arch/x86/Makefile.in +++ b/src/native/external/zlib-ng/arch/x86/Makefile.in @@ -35,7 +35,6 @@ all: \ chunkset_ssse3.o chunkset_ssse3.lo \ compare256_avx2.o compare256_avx2.lo \ compare256_sse2.o compare256_sse2.lo \ - insert_string_sse42.o insert_string_sse42.lo \ crc32_pclmulqdq.o crc32_pclmulqdq.lo \ crc32_vpclmulqdq.o crc32_vpclmulqdq.lo \ slide_hash_avx2.o slide_hash_avx2.lo \ @@ -77,12 +76,6 @@ compare256_sse2.o: compare256_sse2.lo: $(CC) $(SFLAGS) $(SSE2FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/compare256_sse2.c -insert_string_sse42.o: - $(CC) $(CFLAGS) $(SSE42FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_sse42.c - -insert_string_sse42.lo: - $(CC) $(SFLAGS) $(SSE42FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_sse42.c - crc32_pclmulqdq.o: $(CC) $(CFLAGS) $(PCLMULFLAG) $(SSE42FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_pclmulqdq.c @@ -90,10 +83,10 @@ crc32_pclmulqdq.lo: $(CC) $(SFLAGS) $(PCLMULFLAG) $(SSE42FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_pclmulqdq.c crc32_vpclmulqdq.o: - $(CC) $(CFLAGS) $(PCLMULFLAG) $(SSE42FLAG) $(VPCLMULFLAG) $(AVX512FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_vpclmulqdq.c + $(CC) $(CFLAGS) $(PCLMULFLAG) $(VPCLMULFLAG) $(AVX512FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_vpclmulqdq.c crc32_vpclmulqdq.lo: - $(CC) $(SFLAGS) $(PCLMULFLAG) $(SSE42FLAG) $(VPCLMULFLAG) $(AVX512FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_vpclmulqdq.c + $(CC) $(SFLAGS) $(PCLMULFLAG) $(VPCLMULFLAG) $(AVX512FLAG) $(NOLTOFLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_vpclmulqdq.c slide_hash_avx2.o: $(CC) $(CFLAGS) $(AVX2FLAG) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_avx2.c diff --git a/src/native/external/zlib-ng/arch/x86/adler32_avx2.c b/src/native/external/zlib-ng/arch/x86/adler32_avx2.c index e3ac6705cef358..38e7f068e3981b 100644 --- a/src/native/external/zlib-ng/arch/x86/adler32_avx2.c +++ b/src/native/external/zlib-ng/arch/x86/adler32_avx2.c @@ -9,24 +9,15 @@ #ifdef X86_AVX2 -#include "../../zbuild.h" +#include "zbuild.h" #include -#include "../../adler32_fold.h" -#include "../../adler32_p.h" +#include "adler32_p.h" #include "adler32_avx2_p.h" #include "x86_intrins.h" -#ifdef X86_SSE42 extern uint32_t adler32_fold_copy_sse42(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); extern uint32_t adler32_ssse3(uint32_t adler, const uint8_t *src, size_t len); -#define copy_sub32(a, b, c, d) adler32_fold_copy_sse42(a, b, c, d) -#define sub32(a, b, c) adler32_ssse3(a, b, c) -#else -#define copy_sub32(a, b, c, d) adler32_copy_len_16(adler0, c, b, d, adler1) -#define sub32(a, b, c) adler32_len_16(adler0, b, c, adler1) -#endif - static inline uint32_t adler32_fold_copy_impl(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len, const int COPY) { if (src == NULL) return 1L; if (len == 0) return adler; @@ -44,9 +35,9 @@ static inline uint32_t adler32_fold_copy_impl(uint32_t adler, uint8_t *dst, cons } } else if (len < 32) { if (COPY) { - return copy_sub32(adler, dst, src, len); + return adler32_fold_copy_sse42(adler, dst, src, len); } else { - return sub32(adler, src, len); + return adler32_ssse3(adler, src, len); } } diff --git a/src/native/external/zlib-ng/arch/x86/adler32_avx512.c b/src/native/external/zlib-ng/arch/x86/adler32_avx512.c index aa6cc170185b61..626c4807f821bb 100644 --- a/src/native/external/zlib-ng/arch/x86/adler32_avx512.c +++ b/src/native/external/zlib-ng/arch/x86/adler32_avx512.c @@ -8,10 +8,9 @@ #ifdef X86_AVX512 -#include "../../zbuild.h" -#include "../../adler32_p.h" -#include "../../adler32_fold.h" -#include "../../cpu_features.h" +#include "zbuild.h" +#include "adler32_p.h" +#include "arch_functions.h" #include #include "x86_intrins.h" #include "adler32_avx512_p.h" @@ -33,13 +32,7 @@ static inline uint32_t adler32_fold_copy_impl(uint32_t adler, uint8_t *dst, cons _mm512_mask_storeu_epi8(dst, storemask, copy_vec); } -#ifdef X86_AVX2 return adler32_avx2(adler, src, len); -#elif defined(X86_SSSE3) - return adler32_ssse3(adler, src, len); -#else - return adler32_len_16(adler0, src, len, adler1); -#endif } __m512i vbuf, vs1_0, vs3; diff --git a/src/native/external/zlib-ng/arch/x86/adler32_avx512_vnni.c b/src/native/external/zlib-ng/arch/x86/adler32_avx512_vnni.c index 771f7ebe043f24..4c5cfc1cadb461 100644 --- a/src/native/external/zlib-ng/arch/x86/adler32_avx512_vnni.c +++ b/src/native/external/zlib-ng/arch/x86/adler32_avx512_vnni.c @@ -9,11 +9,10 @@ #ifdef X86_AVX512VNNI -#include "../../zbuild.h" -#include "../../adler32_p.h" -#include "../../cpu_features.h" +#include "zbuild.h" +#include "adler32_p.h" +#include "arch_functions.h" #include -#include "../../adler32_fold.h" #include "x86_intrins.h" #include "adler32_avx512_p.h" #include "adler32_avx2_p.h" @@ -28,20 +27,10 @@ Z_INTERNAL uint32_t adler32_avx512_vnni(uint32_t adler, const uint8_t *src, size rem_peel: if (len < 32) -#if defined(X86_SSSE3) return adler32_ssse3(adler, src, len); -#else - return adler32_len_16(adler0, src, len, adler1); -#endif if (len < 64) -#ifdef X86_AVX2 return adler32_avx2(adler, src, len); -#elif defined(X86_SSE3) - return adler32_ssse3(adler, src, len); -#else - return adler32_len_16(adler0, src, len, adler1); -#endif const __m512i dot2v = _mm512_set_epi8(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, @@ -135,11 +124,7 @@ Z_INTERNAL uint32_t adler32_fold_copy_avx512_vnni(uint32_t adler, uint8_t *dst, __m256i copy_vec = _mm256_maskz_loadu_epi8(storemask, src); _mm256_mask_storeu_epi8(dst, storemask, copy_vec); -#if defined(X86_SSSE3) return adler32_ssse3(adler, src, len); -#else - return adler32_len_16(adler0, src, len, adler1); -#endif } const __m256i dot2v = _mm256_set_epi8(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, diff --git a/src/native/external/zlib-ng/arch/x86/adler32_sse42.c b/src/native/external/zlib-ng/arch/x86/adler32_sse42.c index 257a360982ed87..df0739d1650aec 100644 --- a/src/native/external/zlib-ng/arch/x86/adler32_sse42.c +++ b/src/native/external/zlib-ng/arch/x86/adler32_sse42.c @@ -6,9 +6,8 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "../../zbuild.h" -#include "../../adler32_p.h" -#include "../../adler32_fold.h" +#include "zbuild.h" +#include "adler32_p.h" #include "adler32_ssse3_p.h" #include diff --git a/src/native/external/zlib-ng/arch/x86/adler32_ssse3.c b/src/native/external/zlib-ng/arch/x86/adler32_ssse3.c index ae819d632e53ae..15e2f78ba35ac5 100644 --- a/src/native/external/zlib-ng/arch/x86/adler32_ssse3.c +++ b/src/native/external/zlib-ng/arch/x86/adler32_ssse3.c @@ -6,8 +6,8 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "../../zbuild.h" -#include "../../adler32_p.h" +#include "zbuild.h" +#include "adler32_p.h" #include "adler32_ssse3_p.h" #ifdef X86_SSSE3 diff --git a/src/native/external/zlib-ng/arch/x86/chunkset_ssse3.c b/src/native/external/zlib-ng/arch/x86/chunkset_ssse3.c index c06d1b37bd7e97..722ecd3d51e30d 100644 --- a/src/native/external/zlib-ng/arch/x86/chunkset_ssse3.c +++ b/src/native/external/zlib-ng/arch/x86/chunkset_ssse3.c @@ -4,10 +4,7 @@ #include "zbuild.h" -/* This requires SSE2 support. While it's implicit with SSSE3, we can minimize - * code size by sharing the chunkcopy functions, which will certainly compile - * to identical machine code */ -#if defined(X86_SSSE3) && defined(X86_SSE2) +#if defined(X86_SSSE3) #include #include "../generic/chunk_permute_table.h" @@ -19,8 +16,6 @@ typedef __m128i chunk_t; #define HAVE_CHUNKMEMSET_4 #define HAVE_CHUNKMEMSET_8 #define HAVE_CHUNK_MAG -#define HAVE_CHUNKCOPY -#define HAVE_CHUNKUNROLL static const lut_rem_pair perm_idx_lut[13] = { {0, 1}, /* 3 */ @@ -83,14 +78,11 @@ static inline chunk_t GET_CHUNK_MAG(uint8_t *buf, uint32_t *chunk_rem, uint32_t return ret_vec; } -extern uint8_t* chunkcopy_sse2(uint8_t *out, uint8_t const *from, unsigned len); -extern uint8_t* chunkunroll_sse2(uint8_t *out, unsigned *dist, unsigned *len); - #define CHUNKSIZE chunksize_ssse3 #define CHUNKMEMSET chunkmemset_ssse3 #define CHUNKMEMSET_SAFE chunkmemset_safe_ssse3 -#define CHUNKCOPY chunkcopy_sse2 -#define CHUNKUNROLL chunkunroll_sse2 +#define CHUNKCOPY chunkcopy_ssse3 +#define CHUNKUNROLL chunkunroll_ssse3 #include "chunkset_tpl.h" diff --git a/src/native/external/zlib-ng/arch/x86/compare256_avx2.c b/src/native/external/zlib-ng/arch/x86/compare256_avx2.c index 1318a0e333a491..d2c835e4ee8ec4 100644 --- a/src/native/external/zlib-ng/arch/x86/compare256_avx2.c +++ b/src/native/external/zlib-ng/arch/x86/compare256_avx2.c @@ -3,8 +3,9 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "../../zbuild.h" - +#include "zbuild.h" +#include "zutil_p.h" +#include "deflate.h" #include "fallback_builtins.h" #if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) diff --git a/src/native/external/zlib-ng/arch/x86/compare256_sse2.c b/src/native/external/zlib-ng/arch/x86/compare256_sse2.c index aad4bd240d2021..216bb3a705c4a4 100644 --- a/src/native/external/zlib-ng/arch/x86/compare256_sse2.c +++ b/src/native/external/zlib-ng/arch/x86/compare256_sse2.c @@ -3,8 +3,9 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "../../zbuild.h" - +#include "zbuild.h" +#include "zutil_p.h" +#include "deflate.h" #include "fallback_builtins.h" #if defined(X86_SSE2) && defined(HAVE_BUILTIN_CTZ) diff --git a/src/native/external/zlib-ng/arch/x86/crc32_fold_pclmulqdq_tpl.h b/src/native/external/zlib-ng/arch/x86/crc32_fold_pclmulqdq_tpl.h index 3e799283173cdc..1ffe201dda7ce8 100644 --- a/src/native/external/zlib-ng/arch/x86/crc32_fold_pclmulqdq_tpl.h +++ b/src/native/external/zlib-ng/arch/x86/crc32_fold_pclmulqdq_tpl.h @@ -26,27 +26,26 @@ Z_INTERNAL void CRC32_FOLD(crc32_fold *crc, const uint8_t *src, size_t len, uint __m128i xmm_t0, xmm_t1, xmm_t2, xmm_t3; __m128i xmm_crc0, xmm_crc1, xmm_crc2, xmm_crc3; __m128i xmm_crc_part = _mm_setzero_si128(); -#ifdef COPY char ALIGNED_(16) partial_buf[16] = { 0 }; -#else +#ifndef COPY __m128i xmm_initial = _mm_cvtsi32_si128(init_crc); int32_t first = init_crc != 0; - /* Technically the CRC functions don't even call this for input < 64, but a bare minimum of 31 - * bytes of input is needed for the aligning load that occurs. If there's an initial CRC, to - * carry it forward through the folded CRC there must be 16 - src % 16 + 16 bytes available, which - * by definition can be up to 15 bytes + one full vector load. */ - assert(len >= 31 || first == 0); + /* The CRC functions don't call this for input < 16, as a minimum of 16 bytes of input is needed + * for the aligning load that occurs. If there's an initial CRC, to carry it forward through + * the folded CRC there must be 16 - src % 16 + 16 bytes available, which by definition can be + * up to 15 bytes + one full vector load. */ + assert(len >= 16 || first == 0); #endif crc32_fold_load((__m128i *)crc->fold, &xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); if (len < 16) { -#ifdef COPY if (len == 0) return; memcpy(partial_buf, src, len); xmm_crc_part = _mm_load_si128((const __m128i *)partial_buf); +#ifdef COPY memcpy(dst, partial_buf, len); #endif goto partial; @@ -63,9 +62,23 @@ Z_INTERNAL void CRC32_FOLD(crc32_fold *crc, const uint8_t *src, size_t len, uint if (algn_diff < 4 && init_crc != 0) { xmm_t0 = xmm_crc_part; - xmm_crc_part = _mm_loadu_si128((__m128i*)src + 1); - fold_1(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t0); + if (len >= 32) { + xmm_crc_part = _mm_loadu_si128((__m128i*)src + 1); + fold_1(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); + xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t0); + } else { + memcpy(partial_buf, src + 16, len - 16); + xmm_crc_part = _mm_load_si128((__m128i*)partial_buf); + fold_1(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); + xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t0); + src += 16; + len -= 16; +#ifdef COPY + dst -= algn_diff; +#endif + goto partial; + } + src += 16; len -= 16; } diff --git a/src/native/external/zlib-ng/arch/x86/crc32_pclmulqdq_tpl.h b/src/native/external/zlib-ng/arch/x86/crc32_pclmulqdq_tpl.h index 05d3b15257f746..3a4f6af5af35c4 100644 --- a/src/native/external/zlib-ng/arch/x86/crc32_pclmulqdq_tpl.h +++ b/src/native/external/zlib-ng/arch/x86/crc32_pclmulqdq_tpl.h @@ -17,7 +17,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "../../zbuild.h" +#include "zbuild.h" #include #include @@ -26,8 +26,9 @@ # include #endif -#include "../../crc32_fold.h" -#include "../../crc32_braid_p.h" +#include "crc32.h" +#include "crc32_braid_p.h" +#include "crc32_braid_tbl.h" #include "x86_intrins.h" #include @@ -350,11 +351,22 @@ Z_INTERNAL uint32_t CRC32_FOLD_FINAL(crc32_fold *crc) { return crc->value; } +static inline uint32_t crc32_small(uint32_t crc, const uint8_t *buf, size_t len) { + uint32_t c = (~crc) & 0xffffffff; + + while (len) { + len--; + DO1; + } + + return c ^ 0xffffffff; +} + Z_INTERNAL uint32_t CRC32(uint32_t crc32, const uint8_t *buf, size_t len) { - /* For lens < 64, crc32_braid method is faster. The CRC32 instruction for - * these short lengths might also prove to be effective */ - if (len < 64) - return PREFIX(crc32_braid)(crc32, buf, len); + /* For lens smaller than ~12, crc32_small method is faster. + * But there are also minimum requirements for the pclmul functions due to alignment */ + if (len < 16) + return crc32_small(crc32, buf, len); crc32_fold ALIGNED_(16) crc_state; CRC32_FOLD_RESET(&crc_state); diff --git a/src/native/external/zlib-ng/arch/x86/crc32_vpclmulqdq.c b/src/native/external/zlib-ng/arch/x86/crc32_vpclmulqdq.c index ec641b43263be1..cad35b14eefc23 100644 --- a/src/native/external/zlib-ng/arch/x86/crc32_vpclmulqdq.c +++ b/src/native/external/zlib-ng/arch/x86/crc32_vpclmulqdq.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#if defined(X86_PCLMULQDQ_CRC) && defined(X86_VPCLMULQDQ_CRC) +#ifdef X86_VPCLMULQDQ_CRC #define X86_VPCLMULQDQ #define CRC32_FOLD_COPY crc32_fold_vpclmulqdq_copy diff --git a/src/native/external/zlib-ng/arch/x86/slide_hash_avx2.c b/src/native/external/zlib-ng/arch/x86/slide_hash_avx2.c index 39254204ef4621..f49ad3331b8151 100644 --- a/src/native/external/zlib-ng/arch/x86/slide_hash_avx2.c +++ b/src/native/external/zlib-ng/arch/x86/slide_hash_avx2.c @@ -9,8 +9,8 @@ * * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "../../zbuild.h" -#include "../../deflate.h" +#include "zbuild.h" +#include "deflate.h" #include @@ -31,7 +31,6 @@ static inline void slide_hash_chain(Pos *table, uint32_t entries, const __m256i } Z_INTERNAL void slide_hash_avx2(deflate_state *s) { - Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); uint16_t wsize = (uint16_t)s->w_size; const __m256i ymm_wsize = _mm256_set1_epi16((short)wsize); diff --git a/src/native/external/zlib-ng/arch/x86/slide_hash_sse2.c b/src/native/external/zlib-ng/arch/x86/slide_hash_sse2.c index 5e75aedba5efbc..cfdf7bee49852b 100644 --- a/src/native/external/zlib-ng/arch/x86/slide_hash_sse2.c +++ b/src/native/external/zlib-ng/arch/x86/slide_hash_sse2.c @@ -8,8 +8,8 @@ * * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "../../zbuild.h" -#include "../../deflate.h" +#include "zbuild.h" +#include "deflate.h" #include #include @@ -52,7 +52,6 @@ static inline void slide_hash_chain(Pos *table0, Pos *table1, uint32_t entries0, } Z_INTERNAL void slide_hash_sse2(deflate_state *s) { - Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); uint16_t wsize = (uint16_t)s->w_size; const __m128i xmm_wsize = _mm_set1_epi16((short)wsize); diff --git a/src/native/external/zlib-ng/arch/x86/x86_features.c b/src/native/external/zlib-ng/arch/x86/x86_features.c index 8d11564c24f94b..58cb4df341f2a5 100644 --- a/src/native/external/zlib-ng/arch/x86/x86_features.c +++ b/src/native/external/zlib-ng/arch/x86/x86_features.c @@ -7,7 +7,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "../../zbuild.h" +#include "zbuild.h" #include "x86_features.h" #ifdef _MSC_VER @@ -15,6 +15,13 @@ #else // Newer versions of GCC and clang come with cpuid.h # include +# ifdef X86_HAVE_XSAVE_INTRIN +# if __GNUC__ == 8 +# include +# else +# include +# endif +# endif #endif #include @@ -29,6 +36,7 @@ static inline void cpuid(int info, unsigned* eax, unsigned* ebx, unsigned* ecx, *ecx = registers[2]; *edx = registers[3]; #else + *eax = *ebx = *ecx = *edx = 0; __cpuid(info, *eax, *ebx, *ecx, *edx); #endif } @@ -43,12 +51,13 @@ static inline void cpuidex(int info, int subinfo, unsigned* eax, unsigned* ebx, *ecx = registers[2]; *edx = registers[3]; #else + *eax = *ebx = *ecx = *edx = 0; __cpuid_count(info, subinfo, *eax, *ebx, *ecx, *edx); #endif } static inline uint64_t xgetbv(unsigned int xcr) { -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(X86_HAVE_XSAVE_INTRIN) return _xgetbv(xcr); #else uint32_t eax, edx; @@ -90,7 +99,16 @@ void Z_INTERNAL x86_check_features(struct x86_cpu_features *features) { // check AVX512 bits if the OS supports saving ZMM registers if (features->has_os_save_zmm) { - features->has_avx512 = ebx & 0x00010000; + features->has_avx512f = ebx & 0x00010000; + if (features->has_avx512f) { + // According to the Intel Software Developer's Manual, AVX512F must be enabled too in order to enable + // AVX512(DQ,BW,VL). + features->has_avx512dq = ebx & 0x00020000; + features->has_avx512bw = ebx & 0x40000000; + features->has_avx512vl = ebx & 0x80000000; + } + features->has_avx512_common = features->has_avx512f && features->has_avx512dq && features->has_avx512bw \ + && features->has_avx512vl; features->has_avx512vnni = ecx & 0x800; } } diff --git a/src/native/external/zlib-ng/arch/x86/x86_features.h b/src/native/external/zlib-ng/arch/x86/x86_features.h index 4a36bde835d32e..6daa5e38282ffc 100644 --- a/src/native/external/zlib-ng/arch/x86/x86_features.h +++ b/src/native/external/zlib-ng/arch/x86/x86_features.h @@ -1,14 +1,18 @@ /* x86_features.h -- check for CPU features -* Copyright (C) 2013 Intel Corporation Jim Kukunas -* For conditions of distribution and use, see copyright notice in zlib.h -*/ + * Copyright (C) 2013 Intel Corporation Jim Kukunas + * For conditions of distribution and use, see copyright notice in zlib.h + */ #ifndef X86_FEATURES_H_ #define X86_FEATURES_H_ struct x86_cpu_features { int has_avx2; - int has_avx512; + int has_avx512f; + int has_avx512dq; + int has_avx512bw; + int has_avx512vl; + int has_avx512_common; // Enabled when AVX512(F,DQ,BW,VL) are all enabled. int has_avx512vnni; int has_sse2; int has_ssse3; @@ -21,4 +25,4 @@ struct x86_cpu_features { void Z_INTERNAL x86_check_features(struct x86_cpu_features *features); -#endif /* CPU_H_ */ +#endif /* X86_FEATURES_H_ */ diff --git a/src/native/external/zlib-ng/arch/x86/x86_functions.h b/src/native/external/zlib-ng/arch/x86/x86_functions.h new file mode 100644 index 00000000000000..5aa9b31747452f --- /dev/null +++ b/src/native/external/zlib-ng/arch/x86/x86_functions.h @@ -0,0 +1,172 @@ +/* x86_functions.h -- x86 implementations for arch-specific functions. + * Copyright (C) 2013 Intel Corporation Jim Kukunas + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef X86_FUNCTIONS_H_ +#define X86_FUNCTIONS_H_ + +#ifdef X86_SSE2 +uint32_t chunksize_sse2(void); +uint8_t* chunkmemset_safe_sse2(uint8_t *out, unsigned dist, unsigned len, unsigned left); + +# ifdef HAVE_BUILTIN_CTZ + uint32_t compare256_sse2(const uint8_t *src0, const uint8_t *src1); + uint32_t longest_match_sse2(deflate_state *const s, Pos cur_match); + uint32_t longest_match_slow_sse2(deflate_state *const s, Pos cur_match); + void slide_hash_sse2(deflate_state *s); +# endif + void inflate_fast_sse2(PREFIX3(stream)* strm, uint32_t start); +#endif + +#ifdef X86_SSSE3 +uint32_t adler32_ssse3(uint32_t adler, const uint8_t *buf, size_t len); +uint8_t* chunkmemset_safe_ssse3(uint8_t *out, unsigned dist, unsigned len, unsigned left); +void inflate_fast_ssse3(PREFIX3(stream) *strm, uint32_t start); +#endif + +#ifdef X86_SSE42 +uint32_t adler32_fold_copy_sse42(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); +#endif + +#ifdef X86_AVX2 +uint32_t adler32_avx2(uint32_t adler, const uint8_t *buf, size_t len); +uint32_t adler32_fold_copy_avx2(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); +uint32_t chunksize_avx2(void); +uint8_t* chunkmemset_safe_avx2(uint8_t *out, unsigned dist, unsigned len, unsigned left); + +# ifdef HAVE_BUILTIN_CTZ + uint32_t compare256_avx2(const uint8_t *src0, const uint8_t *src1); + uint32_t longest_match_avx2(deflate_state *const s, Pos cur_match); + uint32_t longest_match_slow_avx2(deflate_state *const s, Pos cur_match); + void slide_hash_avx2(deflate_state *s); +# endif + void inflate_fast_avx2(PREFIX3(stream)* strm, uint32_t start); +#endif +#ifdef X86_AVX512 +uint32_t adler32_avx512(uint32_t adler, const uint8_t *buf, size_t len); +uint32_t adler32_fold_copy_avx512(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); +#endif +#ifdef X86_AVX512VNNI +uint32_t adler32_avx512_vnni(uint32_t adler, const uint8_t *buf, size_t len); +uint32_t adler32_fold_copy_avx512_vnni(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); +#endif + +#ifdef X86_PCLMULQDQ_CRC +uint32_t crc32_fold_pclmulqdq_reset(crc32_fold *crc); +void crc32_fold_pclmulqdq_copy(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len); +void crc32_fold_pclmulqdq(crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc); +uint32_t crc32_fold_pclmulqdq_final(crc32_fold *crc); +uint32_t crc32_pclmulqdq(uint32_t crc32, const uint8_t *buf, size_t len); +#endif +#ifdef X86_VPCLMULQDQ_CRC +uint32_t crc32_fold_vpclmulqdq_reset(crc32_fold *crc); +void crc32_fold_vpclmulqdq_copy(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len); +void crc32_fold_vpclmulqdq(crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc); +uint32_t crc32_fold_vpclmulqdq_final(crc32_fold *crc); +uint32_t crc32_vpclmulqdq(uint32_t crc32, const uint8_t *buf, size_t len); +#endif + + +#ifdef DISABLE_RUNTIME_CPU_DETECTION +// X86 - SSE2 +# if (defined(X86_SSE2) && defined(__SSE2__)) || defined(__x86_64__) || defined(_M_X64) || defined(X86_NOCHECK_SSE2) +# undef native_chunkmemset_safe +# define native_chunkmemset_safe chunkmemset_safe_sse2 +# undef native_chunksize +# define native_chunksize chunksize_sse2 +# undef native_inflate_fast +# define native_inflate_fast inflate_fast_sse2 +# undef native_slide_hash +# define native_slide_hash slide_hash_sse2 +# ifdef HAVE_BUILTIN_CTZ +# undef native_compare256 +# define native_compare256 compare256_sse2 +# undef native_longest_match +# define native_longest_match longest_match_sse2 +# undef native_longest_match_slow +# define native_longest_match_slow longest_match_slow_sse2 +# endif +#endif +// X86 - SSSE3 +# if defined(X86_SSSE3) && defined(__SSSE3__) +# undef native_adler32 +# define native_adler32 adler32_ssse3 +# undef native_chunkmemset_safe +# define native_chunkmemset_safe chunkmemset_safe_ssse3 +# undef native_inflate_fast +# define native_inflate_fast inflate_fast_ssse3 +# endif +// X86 - SSE4.2 +# if defined(X86_SSE42) && defined(__SSE4_2__) +# undef native_adler32_fold_copy +# define native_adler32_fold_copy adler32_fold_copy_sse42 +# endif + +// X86 - PCLMUL +#if defined(X86_PCLMULQDQ_CRC) && defined(__PCLMUL__) +# undef native_crc32 +# define native_crc32 crc32_pclmulqdq +# undef native_crc32_fold +# define native_crc32_fold crc32_fold_pclmulqdq +# undef native_crc32_fold_copy +# define native_crc32_fold_copy crc32_fold_pclmulqdq_copy +# undef native_crc32_fold_final +# define native_crc32_fold_final crc32_fold_pclmulqdq_final +# undef native_crc32_fold_reset +# define native_crc32_fold_reset crc32_fold_pclmulqdq_reset +#endif +// X86 - AVX +# if defined(X86_AVX2) && defined(__AVX2__) +# undef native_adler32 +# define native_adler32 adler32_avx2 +# undef native_adler32_fold_copy +# define native_adler32_fold_copy adler32_fold_copy_avx2 +# undef native_chunkmemset_safe +# define native_chunkmemset_safe chunkmemset_safe_avx2 +# undef native_chunksize +# define native_chunksize chunksize_avx2 +# undef native_inflate_fast +# define native_inflate_fast inflate_fast_avx2 +# undef native_slide_hash +# define native_slide_hash slide_hash_avx2 +# ifdef HAVE_BUILTIN_CTZ +# undef native_compare256 +# define native_compare256 compare256_avx2 +# undef native_longest_match +# define native_longest_match longest_match_avx2 +# undef native_longest_match_slow +# define native_longest_match_slow longest_match_slow_avx2 +# endif +# endif + +// X86 - AVX512 (F,DQ,BW,Vl) +# if defined(X86_AVX512) && defined(__AVX512F__) && defined(__AVX512DQ__) && defined(__AVX512BW__) && defined(__AVX512VL__) +# undef native_adler32 +# define native_adler32 adler32_avx512 +# undef native_adler32_fold_copy +# define native_adler32_fold_copy adler32_fold_copy_avx512 +// X86 - AVX512 (VNNI) +# if defined(X86_AVX512VNNI) && defined(__AVX512VNNI__) +# undef native_adler32 +# define native_adler32 adler32_avx512_vnni +# undef native_adler32_fold_copy +# define native_adler32_fold_copy adler32_fold_copy_avx512_vnni +# endif +// X86 - VPCLMULQDQ +# if defined(__PCLMUL__) && defined(__AVX512F__) && defined(__VPCLMULQDQ__) +# undef native_crc32 +# define native_crc32 crc32_vpclmulqdq +# undef native_crc32_fold +# define native_crc32_fold crc32_fold_vpclmulqdq +# undef native_crc32_fold_copy +# define native_crc32_fold_copy crc32_fold_vpclmulqdq_copy +# undef native_crc32_fold_final +# define native_crc32_fold_final crc32_fold_vpclmulqdq_final +# undef native_crc32_fold_reset +# define native_crc32_fold_reset crc32_fold_vpclmulqdq_reset +# endif +# endif +#endif + +#endif /* X86_FUNCTIONS_H_ */ diff --git a/src/native/external/zlib-ng/arch/x86/x86_intrins.h b/src/native/external/zlib-ng/arch/x86/x86_intrins.h index 52e1085d66f978..0e596d18a14391 100644 --- a/src/native/external/zlib-ng/arch/x86/x86_intrins.h +++ b/src/native/external/zlib-ng/arch/x86/x86_intrins.h @@ -7,7 +7,7 @@ #ifdef __AVX2__ #include -#if (!defined(__clang__) && defined(__GNUC__) && __GNUC__ < 10) \ +#if (!defined(__clang__) && !defined(__NVCOMPILER) && defined(__GNUC__) && __GNUC__ < 10) \ || (defined(__apple_build_version__) && __apple_build_version__ < 9020039) static inline __m256i _mm256_zextsi128_si256(__m128i a) { __m128i r; @@ -29,7 +29,7 @@ static inline __m512i _mm512_zextsi128_si512(__m128i a) { /* GCC <9 is missing some AVX512 intrinsics. */ #ifdef __AVX512F__ -#if (!defined(__clang__) && defined(__GNUC__) && __GNUC__ < 9) +#if (!defined(__clang__) && !defined(__NVCOMPILER) && defined(__GNUC__) && __GNUC__ < 9) #include #define PACK(c0, c1, c2, c3) (((int)(unsigned char)(c0) << 24) | ((int)(unsigned char)(c1) << 16) | \ diff --git a/src/native/external/zlib-ng/arch_functions.h b/src/native/external/zlib-ng/arch_functions.h new file mode 100644 index 00000000000000..9a7f8d9379fb06 --- /dev/null +++ b/src/native/external/zlib-ng/arch_functions.h @@ -0,0 +1,29 @@ +/* arch_functions.h -- Arch-specific function prototypes. + * Copyright (C) 2017 Hans Kristian Rosbach + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifndef CPU_FUNCTIONS_H_ +#define CPU_FUNCTIONS_H_ + +#include "zbuild.h" +#include "zutil.h" +#include "crc32.h" +#include "deflate.h" +#include "fallback_builtins.h" + +#include "arch/generic/generic_functions.h" + +#if defined(X86_FEATURES) +# include "arch/x86/x86_functions.h" +#elif defined(ARM_FEATURES) +# include "arch/arm/arm_functions.h" +#elif defined(PPC_FEATURES) || defined(POWER_FEATURES) +# include "arch/power/power_functions.h" +#elif defined(S390_FEATURES) +# include "arch/s390/s390_functions.h" +#elif defined(RISCV_FEATURES) +# include "arch/riscv/riscv_functions.h" +#endif + +#endif diff --git a/src/native/external/zlib-ng/chunkset_tpl.h b/src/native/external/zlib-ng/chunkset_tpl.h index f909a12557f0c8..f5cc5c04506dfc 100644 --- a/src/native/external/zlib-ng/chunkset_tpl.h +++ b/src/native/external/zlib-ng/chunkset_tpl.h @@ -5,7 +5,7 @@ #include "zbuild.h" #include -#if CHUNK_SIZE == 32 && defined(X86_SSSE3) && defined(X86_SSE2) +#if CHUNK_SIZE == 32 && defined(X86_SSSE3) extern uint8_t* chunkmemset_ssse3(uint8_t *out, unsigned dist, unsigned len); #endif @@ -25,7 +25,7 @@ Z_INTERNAL uint32_t CHUNKSIZE(void) { without iteration, which will hopefully make the branch prediction more reliable. */ #ifndef HAVE_CHUNKCOPY -Z_INTERNAL uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) { +static inline uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) { Assert(len > 0, "chunkcopy should never have a length 0"); chunk_t chunk; int32_t align = ((len - 1) % sizeof(chunk_t)) + 1; @@ -54,7 +54,7 @@ Z_INTERNAL uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) { least 258 bytes of output space available (258 being the maximum length output from a single token; see inflate_fast()'s assumptions below). */ #ifndef HAVE_CHUNKUNROLL -Z_INTERNAL uint8_t* CHUNKUNROLL(uint8_t *out, unsigned *dist, unsigned *len) { +static inline uint8_t* CHUNKUNROLL(uint8_t *out, unsigned *dist, unsigned *len) { unsigned char const *from = out - *dist; chunk_t chunk; while (*dist < *len && *dist < sizeof(chunk_t)) { @@ -98,7 +98,7 @@ Z_INTERNAL uint8_t* CHUNKMEMSET(uint8_t *out, unsigned dist, unsigned len) { Assert(len >= sizeof(uint64_t), "chunkmemset should be called on larger chunks"); */ Assert(dist > 0, "chunkmemset cannot have a distance 0"); /* Only AVX2 */ -#if CHUNK_SIZE == 32 && defined(X86_SSSE3) && defined(X86_SSE2) +#if CHUNK_SIZE == 32 && defined(X86_SSSE3) if (len <= 16) { return chunkmemset_ssse3(out, dist, len); } diff --git a/src/native/external/zlib-ng/cmake/detect-intrinsics.cmake b/src/native/external/zlib-ng/cmake/detect-intrinsics.cmake index 74ac3910b8f44d..14f82fcbf588fe 100644 --- a/src/native/external/zlib-ng/cmake/detect-intrinsics.cmake +++ b/src/native/external/zlib-ng/cmake/detect-intrinsics.cmake @@ -2,40 +2,39 @@ # Licensed under the Zlib license, see LICENSE.md for details macro(check_acle_compiler_flag) - if(MSVC) - # Both ARM and ARM64-targeting msvc support intrinsics, but - # ARM msvc is missing some intrinsics introduced with ARMv8, e.g. crc32 - if(MSVC_C_ARCHITECTURE_ID STREQUAL "ARM64") - set(HAVE_ACLE_FLAG TRUE) - endif() - else() + if(NOT NATIVEFLAG) if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + check_c_compiler_flag("-march=armv8-a+crc" HAVE_MARCH_ARMV8_CRC) + if(HAVE_MARCH_ARMV8_CRC) set(ACLEFLAG "-march=armv8-a+crc" CACHE INTERNAL "Compiler option to enable ACLE support") + else() + check_c_compiler_flag("-march=armv8-a+crc+simd" HAVE_MARCH_ARMV8_CRC_SIMD) + if(HAVE_MARCH_ARMV8_CRC_SIMD) + set(ACLEFLAG "-march=armv8-a+crc+simd" CACHE INTERNAL "Compiler option to enable ACLE support") + endif() endif() endif() - # Check whether compiler supports ACLE flag - set(CMAKE_REQUIRED_FLAGS "${ACLEFLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") - check_c_source_compiles( - "int main() { return 0; }" - HAVE_ACLE_FLAG FAIL_REGEX "not supported") - if(NOT NATIVEFLAG AND NOT HAVE_ACLE_FLAG) - set(ACLEFLAG "-march=armv8-a+crc+simd" CACHE INTERNAL "Compiler option to enable ACLE support" FORCE) - # Check whether compiler supports ACLE flag - set(CMAKE_REQUIRED_FLAGS "${ACLEFLAG}") - check_c_source_compiles( - "int main() { return 0; }" - HAVE_ACLE_FLAG2 FAIL_REGEX "not supported") - set(HAVE_ACLE_FLAG ${HAVE_ACLE_FLAG2} CACHE INTERNAL "Have compiler option to enable ACLE intrinsics" FORCE) - unset(HAVE_ACLE_FLAG2 CACHE) # Don't cache this internal variable - endif() - set(CMAKE_REQUIRED_FLAGS) endif() + # Check whether compiler supports ARMv8 CRC intrinsics + set(CMAKE_REQUIRED_FLAGS "${ACLEFLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") + check_c_source_compiles( + "#if defined(_MSC_VER) + #include + #else + #include + #endif + unsigned int f(unsigned int a, unsigned int b) { + return __crc32w(a, b); + } + int main(void) { return 0; }" + HAVE_ACLE_FLAG + ) + set(CMAKE_REQUIRED_FLAGS) endmacro() macro(check_armv6_compiler_flag) - if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") check_c_compiler_flag("-march=armv6" HAVE_MARCH_ARMV6) if(HAVE_MARCH_ARMV6) set(ARMV6FLAG "-march=armv6" CACHE INTERNAL "Compiler option to enable ARMv6 support") @@ -74,14 +73,14 @@ macro(check_armv6_compiler_flag) endmacro() macro(check_avx512_intrinsics) - if(CMAKE_C_COMPILER_ID MATCHES "Intel") - if(CMAKE_HOST_UNIX OR APPLE) - set(AVX512FLAG "-mavx512f -mavx512dq -mavx512bw -mavx512vl") - else() - set(AVX512FLAG "/arch:AVX512") - endif() - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "Intel") + if(CMAKE_HOST_UNIX OR APPLE) + set(AVX512FLAG "-mavx512f -mavx512dq -mavx512bw -mavx512vl") + else() + set(AVX512FLAG "/arch:AVX512") + endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") # For CPUs that can benefit from AVX512, it seems GCC generates suboptimal # instruction scheduling unless you specify a reasonable -mtune= target set(AVX512FLAG "-mavx512f -mavx512dq -mavx512bw -mavx512vl") @@ -94,9 +93,9 @@ macro(check_avx512_intrinsics) endif() unset(HAVE_CASCADE_LAKE) endif() + elseif(MSVC) + set(AVX512FLAG "/arch:AVX512") endif() - elseif(MSVC) - set(AVX512FLAG "/arch:AVX512") endif() # Check whether compiler supports AVX512 intrinsics set(CMAKE_REQUIRED_FLAGS "${AVX512FLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") @@ -109,26 +108,17 @@ macro(check_avx512_intrinsics) int main(void) { return 0; }" HAVE_AVX512_INTRIN ) - - # Evidently both GCC and clang were late to implementing these - check_c_source_compiles( - "#include - __mmask16 f(__mmask16 x) { return _knot_mask16(x); } - int main(void) { return 0; }" - HAVE_MASK_INTRIN - ) - set(CMAKE_REQUIRED_FLAGS) endmacro() macro(check_avx512vnni_intrinsics) - if(CMAKE_C_COMPILER_ID MATCHES "Intel") - if(CMAKE_HOST_UNIX OR APPLE) - set(AVX512VNNIFLAG "-mavx512f -mavx512bw -mavx512dq -mavx512vl -mavx512vnni") - else() - set(AVX512VNNIFLAG "/arch:AVX512") - endif() - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "Intel") + if(CMAKE_HOST_UNIX OR APPLE OR CMAKE_C_COMPILER_ID MATCHES "IntelLLVM") + set(AVX512VNNIFLAG "-mavx512f -mavx512dq -mavx512bw -mavx512vl -mavx512vnni") + else() + set(AVX512VNNIFLAG "/arch:AVX512") + endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") set(AVX512VNNIFLAG "-mavx512f -mavx512dq -mavx512bw -mavx512vl -mavx512vnni") if(NOT MSVC) check_c_compiler_flag("-mtune=cascadelake" HAVE_CASCADE_LAKE) @@ -139,11 +129,10 @@ macro(check_avx512vnni_intrinsics) endif() unset(HAVE_CASCADE_LAKE) endif() + elseif(MSVC) + set(AVX512VNNIFLAG "/arch:AVX512") endif() - elseif(MSVC) - set(AVX512VNNIFLAG "/arch:AVX512") endif() - # Check whether compiler supports AVX512vnni intrinsics set(CMAKE_REQUIRED_FLAGS "${AVX512VNNIFLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") check_c_source_compiles( @@ -159,18 +148,18 @@ macro(check_avx512vnni_intrinsics) endmacro() macro(check_avx2_intrinsics) - if(CMAKE_C_COMPILER_ID MATCHES "Intel") - if(CMAKE_HOST_UNIX OR APPLE) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "Intel") + if(CMAKE_HOST_UNIX OR APPLE) + set(AVX2FLAG "-mavx2") + else() + set(AVX2FLAG "/arch:AVX2") + endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") set(AVX2FLAG "-mavx2") - else() + elseif(MSVC) set(AVX2FLAG "/arch:AVX2") endif() - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) - set(AVX2FLAG "-mavx2") - endif() - elseif(MSVC) - set(AVX2FLAG "/arch:AVX2") endif() # Check whether compiler supports AVX2 intrinics set(CMAKE_REQUIRED_FLAGS "${AVX2FLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") @@ -187,8 +176,8 @@ macro(check_avx2_intrinsics) endmacro() macro(check_neon_compiler_flag) - if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") if("${ARCH}" MATCHES "aarch64") set(NEONFLAG "-march=armv8-a+simd") else() @@ -206,12 +195,52 @@ macro(check_neon_compiler_flag) #endif int main() { return 0; }" NEON_AVAILABLE FAIL_REGEX "not supported") + # Check whether compiler native flag is enough for NEON support + # Some GCC versions don't enable FPU (vector unit) when using -march=native + if(NEON_AVAILABLE AND NATIVEFLAG AND (NOT "${ARCH}" MATCHES "aarch64")) + check_c_source_compiles( + "#include + uint8x16_t f(uint8x16_t x, uint8x16_t y) { + return vaddq_u8(x, y); + } + int main(int argc, char* argv[]) { + uint8x16_t a = vdupq_n_u8(argc); + uint8x16_t b = vdupq_n_u8(argc); + uint8x16_t result = f(a, b); + return result[0]; + }" + ARM_NEON_SUPPORT_NATIVE + ) + if(NOT ARM_NEON_SUPPORT_NATIVE) + set(CMAKE_REQUIRED_FLAGS "${NATIVEFLAG} -mfpu=neon ${ZNOLTOFLAG}") + check_c_source_compiles( + "#include + uint8x16_t f(uint8x16_t x, uint8x16_t y) { + return vaddq_u8(x, y); + } + int main(int argc, char* argv[]) { + uint8x16_t a = vdupq_n_u8(argc); + uint8x16_t b = vdupq_n_u8(argc); + uint8x16_t result = f(a, b); + return result[0]; + }" + ARM_NEON_SUPPORT_NATIVE_MFPU + ) + if(ARM_NEON_SUPPORT_NATIVE_MFPU) + set(NEONFLAG "-mfpu=neon") + else() + # Remove local NEON_AVAILABLE variable and overwrite the cache + unset(NEON_AVAILABLE) + set(NEON_AVAILABLE "" CACHE INTERNAL "NEON support available" FORCE) + endif() + endif() + endif() set(CMAKE_REQUIRED_FLAGS) endmacro() macro(check_neon_ld4_intrinsics) - if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") if("${ARCH}" MATCHES "aarch64") set(NEONFLAG "-march=armv8-a+simd") else() @@ -234,8 +263,8 @@ macro(check_neon_ld4_intrinsics) endmacro() macro(check_pclmulqdq_intrinsics) - if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "IntelLLVM") set(PCLMULFLAG "-mpclmul") endif() endif() @@ -257,8 +286,8 @@ macro(check_pclmulqdq_intrinsics) endmacro() macro(check_vpclmulqdq_intrinsics) - if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "IntelLLVM") set(VPCLMULFLAG "-mvpclmulqdq -mavx512f") endif() endif() @@ -341,8 +370,8 @@ macro(check_ppc_intrinsics) endmacro() macro(check_power8_intrinsics) - if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") set(POWER8FLAG "-mcpu=power8") endif() endif() @@ -364,12 +393,27 @@ macro(check_power8_intrinsics) }" HAVE_POWER8_INTRIN ) + if(NOT HAVE_POWER8_INTRIN AND HAVE_LINUX_AUXVEC_H) + check_c_source_compiles( + "#include + #include + int main() { + return (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07); + }" + HAVE_POWER8_INTRIN2 + ) + if(HAVE_POWER8_INTRIN2) + set(POWER8_NEED_AUXVEC_H 1) + set(HAVE_POWER8_INTRIN ${HAVE_POWER8_INTRIN2} CACHE INTERNAL "Have POWER8 intrinsics" FORCE) + unset(HAVE_POWER8_INTRIN2 CACHE) + endif() + endif() set(CMAKE_REQUIRED_FLAGS) endmacro() macro(check_rvv_intrinsics) - if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") set(RISCVFLAG "-march=rv64gcv") endif() endif() @@ -399,8 +443,8 @@ macro(check_s390_intrinsics) endmacro() macro(check_power9_intrinsics) - if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") set(POWER9FLAG "-mcpu=power9") endif() endif() @@ -422,22 +466,37 @@ macro(check_power9_intrinsics) }" HAVE_POWER9_INTRIN ) + if(NOT HAVE_POWER9_INTRIN AND HAVE_LINUX_AUXVEC_H) + check_c_source_compiles( + "#include + #include + int main() { + return (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_3_00); + }" + HAVE_POWER9_INTRIN2 + ) + if(HAVE_POWER9_INTRIN2) + set(POWER9_NEED_AUXVEC_H 1) + set(HAVE_POWER9_INTRIN ${HAVE_POWER9_INTRIN2} CACHE INTERNAL "Have POWER9 intrinsics" FORCE) + unset(HAVE_POWER9_INTRIN2 CACHE) + endif() + endif() set(CMAKE_REQUIRED_FLAGS) endmacro() macro(check_sse2_intrinsics) - if(CMAKE_C_COMPILER_ID MATCHES "Intel") - if(CMAKE_HOST_UNIX OR APPLE) - set(SSE2FLAG "-msse2") - else() - set(SSE2FLAG "/arch:SSE2") - endif() - elseif(MSVC) - if(NOT "${ARCH}" MATCHES "x86_64") - set(SSE2FLAG "/arch:SSE2") - endif() - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "Intel") + if(CMAKE_HOST_UNIX OR APPLE) + set(SSE2FLAG "-msse2") + else() + set(SSE2FLAG "/arch:SSE2") + endif() + elseif(MSVC) + if(NOT "${ARCH}" MATCHES "x86_64") + set(SSE2FLAG "/arch:SSE2") + endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") set(SSE2FLAG "-msse2") endif() endif() @@ -453,14 +512,14 @@ macro(check_sse2_intrinsics) endmacro() macro(check_ssse3_intrinsics) - if(CMAKE_C_COMPILER_ID MATCHES "Intel") - if(CMAKE_HOST_UNIX OR APPLE) - set(SSSE3FLAG "-mssse3") - else() - set(SSSE3FLAG "/arch:SSSE3") - endif() - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "Intel") + if(CMAKE_HOST_UNIX OR APPLE) + set(SSSE3FLAG "-mssse3") + else() + set(SSSE3FLAG "/arch:SSSE3") + endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") set(SSSE3FLAG "-mssse3") endif() endif() @@ -478,14 +537,14 @@ macro(check_ssse3_intrinsics) endmacro() macro(check_sse42_intrinsics) - if(CMAKE_C_COMPILER_ID MATCHES "Intel") - if(CMAKE_HOST_UNIX OR APPLE) - set(SSE42FLAG "-msse4.2") - else() - set(SSE42FLAG "/arch:SSE4.2") - endif() - elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - if(NOT NATIVEFLAG) + if(NOT NATIVEFLAG) + if(CMAKE_C_COMPILER_ID MATCHES "Intel") + if(CMAKE_HOST_UNIX OR APPLE) + set(SSE42FLAG "-msse4.2") + else() + set(SSE42FLAG "/arch:SSE4.2") + endif() + elseif(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") set(SSE42FLAG "-msse4.2") endif() endif() @@ -526,15 +585,17 @@ macro(check_vgfma_intrinsics) endmacro() macro(check_xsave_intrinsics) - if(NOT NATIVEFLAG AND NOT MSVC) + if(NOT NATIVEFLAG AND NOT MSVC AND NOT CMAKE_C_COMPILER_ID MATCHES "Intel") set(XSAVEFLAG "-mxsave") endif() set(CMAKE_REQUIRED_FLAGS "${XSAVEFLAG} ${NATIVEFLAG} ${ZNOLTOFLAG}") check_c_source_compiles( "#ifdef _MSC_VER # include + #elif __GNUC__ == 8 && __GNUC_MINOR__ > 1 + # include #else - # include + # include #endif unsigned int f(unsigned int a) { return (int) _xgetbv(a); } int main(void) { return 0; }" diff --git a/src/native/external/zlib-ng/configure b/src/native/external/zlib-ng/configure index 20fb91aeb0799d..8e693fe7b8c3e5 100644 --- a/src/native/external/zlib-ng/configure +++ b/src/native/external/zlib-ng/configure @@ -300,7 +300,9 @@ show $cc -c $test.c if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then echo "$cc" | tee -a configure.log CC="$cc" - CFLAGS="${CFLAGS} -std=c11" + if test "${CFLAGS#*"-std="}" = "$CFLAGS" ; then + CFLAGS="${CFLAGS} -std=c11" + fi # Re-check ARCH if the compiler is a cross-compiler. if $CC -print-multiarch 1> /dev/null 2>&1 && test -n "$($CC -print-multiarch)" 1> /dev/null 2>&1; then @@ -363,10 +365,10 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then case "$uname" in Linux* | linux* | GNU | GNU/* | solaris*) LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1},--version-script,${SRCDIR}/${MAPNAME}" ;; + LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1}" ;; *BSD | *bsd* | DragonFly) LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1},--version-script,${SRCDIR}/${MAPNAME}" + LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1}" LDCONFIG="ldconfig -m" ;; CYGWIN* | Cygwin* | cygwin*) visibility=0 @@ -384,7 +386,7 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then SHAREDTARGET=$SHAREDLIB IMPORTLIB="${LIBNAME}.dll.a" LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,--out-implib,${IMPORTLIB},--version-script,${SRCDIR}/${MAPNAME}" + LDSHAREDFLAGS="-shared -Wl,--out-implib,${IMPORTLIB}" LDSHAREDLIBC="" if test $gzfileops -eq 0; then DEFFILE='win32/${LIBNAME2}.def' @@ -433,7 +435,7 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then SHAREDTARGET=$SHAREDLIB IMPORTLIB="${LIBNAME}.dll.a" LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,--out-implib=${IMPORTLIB} -Wl,--version-script=${SRCDIR}/${MAPNAME}" + LDSHAREDFLAGS="-shared -Wl,--out-implib=${IMPORTLIB}" LDSHAREDLIBC="" if test $gzfileops -eq 0; then DEFFILE='win32/${LIBNAME2}.def' @@ -471,7 +473,9 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then SHAREDTARGET=$SHAREDLIBV LDSHARED=${LDSHARED-"$cc"} LDSHAREDFLAGS="-dynamiclib -install_name @rpath/${SHAREDLIBM} -compatibility_version ${VER1} -current_version ${VER3}" - if libtool -V 2>&1 | grep Apple > /dev/null; then + 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" @@ -479,7 +483,7 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then ARFLAGS="-o" ;; aarch64) LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1} -Wl,--version-script,${SRCDIR}/${MAPNAME}" + LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1}" LDSHAREDLIBC="-Wl,--start-group -lc -lrdimon -Wl,--end-group" ;; *) LDSHARED=${LDSHARED-"$cc"} @@ -597,7 +601,7 @@ EOF if test $shared -eq 1; then printf "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 $LDSHAREDFLAGS $LDFLAGS -o $test$shared_ext $test.o $LDSHAREDLIBC; then echo "Building shared library $SHAREDTARGET with $CC." | tee -a configure.log elif test -z "$old_cc" -a -z "$old_cflags"; then @@ -626,6 +630,29 @@ fi echo >> configure.log +# check for version script support +cat > $test.c < $test.map <> configure.log + # check for large file support, and if none, check for fseeko() cat > $test.c < @@ -858,7 +885,7 @@ fi # enable reduced memory configuration if test $reducedmem -eq 1; then echo "Configuring for reduced memory environment." | tee -a configure.log - CFLAGS="${CFLAGS} -DHASH_SIZE=32768u -DGZBUFSIZE=8192" + CFLAGS="${CFLAGS} -DHASH_SIZE=32768u -DGZBUFSIZE=8192 -DNO_LIT_MEM" fi # if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X @@ -973,6 +1000,24 @@ else echo "Checking for attribute(aligned) ... No." | tee -a configure.log fi +# Check for __builtin_assume_aligned(x,n) support in compiler +cat > $test.c << EOF +char *test(char *buffer) { + char *abuffer = __builtin_assume_aligned(buffer,64); + return abuffer; +} +int main() { + return 0; +} +EOF +if try ${CC} ${CFLAGS} $test.c $LDSHAREDLIBC; then + echo "Checking for __builtin_assume_aligned() ... Yes." | tee -a configure.log + CFLAGS="$CFLAGS -DHAVE_BUILTIN_ASSUME_ALIGNED" + SFLAGS="$SFLAGS -DHAVE_BUILTIN_ASSUME_ALIGNED" +else + echo "Checking for __builtin_assume_aligned() ... No." | tee -a configure.log +fi + # Check for __builtin_ctz() support in compiler cat > $test.c << EOF long f(unsigned int x) { return __builtin_ctz(x); } @@ -1085,42 +1130,39 @@ EOF fi } -check_mask_intrinsics() { - # Check whether compiler supports AVX512 k-mask intrinsics - cat > $test.c << EOF -#include -__mmask16 f(__mmask16 x) { return _knot_mask16(x); } -int main(void) { return 0; } -EOF - if try ${CC} ${CFLAGS} ${avx512flag} $test.c; then - echo "Checking for AVX512 k-mask intrinsics ... Yes." | tee -a configure.log - HAVE_MASK_INTRIN=1 - else - echo "Checking for AVX512 k-mask intrinsics ... No." | tee -a configure.log - HAVE_MASK_INTRIN=0 - fi -} - check_acle_compiler_flag() { # Check whether -march=armv8-a+crc works correctly cat > $test.c << EOF int main() { return 0; } EOF if try $CC -c $CFLAGS -march=armv8-a+crc $test.c; then - ACLE_AVAILABLE=1 echo "Check whether -march=armv8-a+crc works ... Yes." | tee -a configure.log acleflag="-march=armv8-a+crc" else echo "Check whether -march=armv8-a+crc works ... No." | tee -a configure.log if try $CC -c $CFLAGS -march=armv8-a+crc+simd $test.c; then - ACLE_AVAILABLE=1 echo "Check whether -march=armv8-a+crc+simd works ... Yes." | tee -a configure.log acleflag="-march=armv8-a+crc+simd" else - ACLE_AVAILABLE=0 echo "Check whether -march=armv8-a+crc+simd works ... No." | tee -a configure.log fi fi + + # Check whether compiler supports ARMv8 CRC intrinsics + cat > $test.c << EOF +#include +unsigned int f(unsigned int a, unsigned int b) { + return __crc32w(a, b); +} +int main(void) { return 0; } +EOF + if try ${CC} ${CFLAGS} ${acleflag} $test.c; then + echo "Checking for ARMv8 CRC intrinsics ... Yes." | tee -a configure.log + ACLE_AVAILABLE=1 + else + echo "Checking for ARMv8 CRC intrinsics ... No." | tee -a configure.log + ACLE_AVAILABLE=0 + fi } check_neon_compiler_flag() { @@ -1254,8 +1296,10 @@ check_xsave_intrinsics() { cat > $test.c << EOF #ifdef _MSC_VER # include +#elif __GNUC__ == 8 && __GNUC_MINOR__ > 1 +# include #else -# include +# include #endif unsigned int f(unsigned int a) { return (int) _xgetbv(a); } int main(void) { return 0; } @@ -1480,6 +1524,56 @@ case "${ARCH}" in ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} x86_features.o" ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} x86_features.lo" + check_xsave_intrinsics + + if test ${HAVE_XSAVE_INTRIN} -eq 1; then + CFLAGS="${CFLAGS} -DX86_HAVE_XSAVE_INTRIN" + SFLAGS="${SFLAGS} -DX86_HAVE_XSAVE_INTRIN" + else + xsaveflag="" + fi + + check_sse2_intrinsics + + if test ${HAVE_SSE2_INTRIN} -eq 1; then + CFLAGS="${CFLAGS} -DX86_SSE2" + SFLAGS="${SFLAGS} -DX86_SSE2" + ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} chunkset_sse2.o compare256_sse2.o slide_hash_sse2.o" + ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} chunkset_sse2.lo compare256_sse2.lo slide_hash_sse2.lo" + + if test $forcesse2 -eq 1; then + CFLAGS="${CFLAGS} -DX86_NOCHECK_SSE2" + SFLAGS="${SFLAGS} -DX86_NOCHECK_SSE2" + fi + fi + + check_ssse3_intrinsics + + if test ${HAVE_SSSE3_INTRIN} -eq 1; then + CFLAGS="${CFLAGS} -DX86_SSSE3" + SFLAGS="${SFLAGS} -DX86_SSSE3" + ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_ssse3.o chunkset_ssse3.o" + ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_ssse3.lo chunkset_ssse3.lo" + fi + + check_sse42_intrinsics + + if test ${HAVE_SSE42_INTRIN} -eq 1; then + CFLAGS="${CFLAGS} -DX86_SSE42" + SFLAGS="${SFLAGS} -DX86_SSE42" + ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_sse42.o" + ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_sse42.lo" + fi + + check_pclmulqdq_intrinsics + + if test ${HAVE_PCLMULQDQ_INTRIN} -eq 1; then + CFLAGS="${CFLAGS} -DX86_PCLMULQDQ_CRC" + SFLAGS="${SFLAGS} -DX86_PCLMULQDQ_CRC" + ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32_pclmulqdq.o" + ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32_pclmulqdq.lo" + fi + check_avx2_intrinsics if test ${HAVE_AVX2_INTRIN} -eq 1; then @@ -1496,13 +1590,6 @@ case "${ARCH}" in SFLAGS="${SFLAGS} -DX86_AVX512" ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_avx512.o" ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_avx512.lo" - - check_mask_intrinsics - - if test ${HAVE_MASK_INTRIN} -eq 1; then - CFLAGS="${CFLAGS} -DX86_MASK_INTRIN" - SFLAGS="${SFLAGS} -DX86_MASK_INTRIN" - fi fi check_mtune_cascadelake_compiler_flag @@ -1526,63 +1613,16 @@ case "${ARCH}" in ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_avx512_vnni.lo" fi - check_sse42_intrinsics + if test $buildvpclmulqdq -eq 1 && test ${HAVE_PCLMULQDQ_INTRIN} -eq 1 && test ${HAVE_AVX512_INTRIN} -eq 1; then + check_vpclmulqdq_intrinsics - if test ${HAVE_SSE42_INTRIN} -eq 1; then - CFLAGS="${CFLAGS} -DX86_SSE42" - SFLAGS="${SFLAGS} -DX86_SSE42" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_sse42.o insert_string_sse42.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_sse42.lo insert_string_sse42.lo" - fi - - check_sse2_intrinsics - - if test ${HAVE_SSE2_INTRIN} -eq 1; then - CFLAGS="${CFLAGS} -DX86_SSE2" - SFLAGS="${SFLAGS} -DX86_SSE2" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} chunkset_sse2.o compare256_sse2.o slide_hash_sse2.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} chunkset_sse2.lo compare256_sse2.lo slide_hash_sse2.lo" - - if test $forcesse2 -eq 1; then - CFLAGS="${CFLAGS} -DX86_NOCHECK_SSE2" - SFLAGS="${SFLAGS} -DX86_NOCHECK_SSE2" + if test ${HAVE_VPCLMULQDQ_INTRIN} -eq 1; then + CFLAGS="${CFLAGS} -DX86_VPCLMULQDQ_CRC" + SFLAGS="${SFLAGS} -DX86_VPCLMULQDQ_CRC" + ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32_vpclmulqdq.o" + ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32_vpclmulqdq.lo" fi fi - - check_ssse3_intrinsics - - if test ${HAVE_SSSE3_INTRIN} -eq 1; then - CFLAGS="${CFLAGS} -DX86_SSSE3" - SFLAGS="${SFLAGS} -DX86_SSSE3" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_ssse3.o chunkset_ssse3.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_ssse3.lo chunkset_ssse3.lo" - fi - - check_pclmulqdq_intrinsics - - if test ${HAVE_PCLMULQDQ_INTRIN} -eq 1; then - CFLAGS="${CFLAGS} -DX86_PCLMULQDQ_CRC" - SFLAGS="${SFLAGS} -DX86_PCLMULQDQ_CRC" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32_pclmulqdq.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32_pclmulqdq.lo" - - if test $buildvpclmulqdq -eq 1; then - check_vpclmulqdq_intrinsics - - if test ${HAVE_VPCLMULQDQ_INTRIN} -eq 1 && test ${HAVE_AVX512_INTRIN} -eq 1; then - CFLAGS="${CFLAGS} -DX86_VPCLMULQDQ_CRC" - SFLAGS="${SFLAGS} -DX86_VPCLMULQDQ_CRC" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32_vpclmulqdq.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32_vpclmulqdq.lo" - fi - fi - fi - - check_xsave_intrinsics - - if test ${HAVE_XSAVE_INTRIN} -eq 0; then - xsaveflag="" - fi fi ;; @@ -1603,11 +1643,11 @@ case "${ARCH}" in cat > $test.c << EOF int main() { return 0; } EOF - if try $CC -w -c $SFLAGS $test.c -mfloat-abi=softfp && + if try $CC -c $SFLAGS $test.c -mfloat-abi=softfp && try $LDSHARED $LDSHAREDFLAGS $LDFLAGS -o $test$shared_ext $test.o $LDSHAREDLIBC; then floatabi="-mfloat-abi=softfp" else - if try $CC -w -c $SFLAGS $test.c -mfloat-abi=hard && + if try $CC -c $SFLAGS $test.c -mfloat-abi=hard && try $LDSHARED $LDSHAREDFLAGS $LDFLAGS -o $test$shared_ext $test.o $LDSHAREDLIBC; then floatabi="-mfloat-abi=hard" fi @@ -1713,8 +1753,8 @@ EOF CFLAGS="${CFLAGS} -DARM_ACLE" SFLAGS="${SFLAGS} -DARM_ACLE" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32_acle.o insert_string_acle.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32_acle.lo insert_string_acle.lo" + ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32_acle.o" + ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32_acle.lo" fi fi @@ -1828,11 +1868,6 @@ EOF ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} s390_features.lo" fi - if test $builddfltccdeflate -eq 1 -o $builddfltccinflate -eq 1; then - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} dfltcc_common.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} dfltcc_common.lo" - fi - if test $builddfltccdeflate -eq 1; then CFLAGS="${CFLAGS} -DS390_DFLTCC_DEFLATE" SFLAGS="${SFLAGS} -DS390_DFLTCC_DEFLATE" @@ -1941,7 +1976,7 @@ replace_in_file() { # update Makefile with the configure results -INCLUDES="-I$SRCDIR" +INCLUDES="-I$SRCDIR -I$SRCDIR/$ARCHDIR -I$SRCDIR/arch/generic" if [ "$SRCDIR" != "$BUILDDIR" ]; then INCLUDES="-I$BUILDDIR ${INCLUDES}"; fi sed < $SRCDIR/Makefile.in " @@ -1951,6 +1986,7 @@ sed < $SRCDIR/Makefile.in " /^LDFLAGS *=/s#=.*#=$LDFLAGS# /^LDSHARED *=/s#=.*#=$LDSHARED# /^LDSHAREDFLAGS *=/s#=.*#=$LDSHAREDFLAGS# +/^LDVERSIONSCRIPT *=/s#=.*#=$LDVERSIONSCRIPT# /^LIBNAME1 *=/s#=.*#=$LIBNAME# /^LIBNAME2 *=/s#=.*#=$LIBNAME2# /^SUFFIX *=/s#=.*#=$SUFFIX# @@ -2044,15 +2080,12 @@ done # Generate Makefile in arch dir mkdir -p $ARCHDIR -ARCHINCLUDES="-I$SRCDIR/$ARCHDIR -I$SRCDIR" -if [ "$SRCDIR" != "$BUILDDIR" ]; then ARCHINCLUDES="-I$BUILDDIR ${ARCHINCLUDES}"; fi - sed < $SRCDIR/$ARCHDIR/Makefile.in " /^CC *=/s#=.*#=$CC# /^CFLAGS *=/s#=.*#=$CFLAGS# /^SFLAGS *=/s#=.*#=$SFLAGS# /^LDFLAGS *=/s#=.*#=$LDFLAGS# -/^INCLUDES *=/s#=.*#=$ARCHINCLUDES# +/^INCLUDES *=/s#=.*#=$INCLUDES# /^SUFFIX *=/s#=.*#=$SUFFIX# /^SRCDIR *=/s#=.*#=$SRCDIR/$ARCHDIR# /^SRCTOP *=/s#=.*#=$SRCDIR# @@ -2112,6 +2145,21 @@ for file in $SRCDIR/$ARCHDIR/*.c; do fi done +# Generate Makefile in generic arch dir +mkdir -p arch/generic + +sed < $SRCDIR/arch/generic/Makefile.in " +/^CC *=/s#=.*#=$CC# +/^CFLAGS *=/s#=.*#=$CFLAGS# +/^SFLAGS *=/s#=.*#=$SFLAGS# +/^INCLUDES *=/s#=.*#=$INCLUDES# +/^SRCDIR *=/s#=.*#=$SRCDIR/arch/generic# +/^SRCTOP *=/s#=.*#=$SRCDIR# +/^BUILDDIR *=/s#=.*#=$BUILDDIR# +" > arch/generic/Makefile + +## TODO: Process header dependencies + # Emscripten does not support large amounts of data via stdin/out # https://github.com/emscripten-core/emscripten/issues/16755#issuecomment-1102732849 if test "$CHOST" != "wasm32"; then diff --git a/src/native/external/zlib-ng/cpu_features.h b/src/native/external/zlib-ng/cpu_features.h index 00fa6c747c5ffd..8708724bc0d53e 100644 --- a/src/native/external/zlib-ng/cpu_features.h +++ b/src/native/external/zlib-ng/cpu_features.h @@ -6,12 +6,10 @@ #ifndef CPU_FEATURES_H_ #define CPU_FEATURES_H_ -#include "adler32_fold.h" -#include "crc32_fold.h" +#ifndef DISABLE_RUNTIME_CPU_DETECTION #if defined(X86_FEATURES) # include "arch/x86/x86_features.h" -# include "fallback_builtins.h" #elif defined(ARM_FEATURES) # include "arch/arm/arm_features.h" #elif defined(PPC_FEATURES) || defined(POWER_FEATURES) @@ -38,266 +36,8 @@ struct cpu_features { #endif }; -extern void cpu_check_features(struct cpu_features *features); +void cpu_check_features(struct cpu_features *features); -/* adler32 */ -typedef uint32_t (*adler32_func)(uint32_t adler, const uint8_t *buf, size_t len); - -extern uint32_t adler32_c(uint32_t adler, const uint8_t *buf, size_t len); -#ifdef ARM_NEON -extern uint32_t adler32_neon(uint32_t adler, const uint8_t *buf, size_t len); -#endif -#ifdef PPC_VMX -extern uint32_t adler32_vmx(uint32_t adler, const uint8_t *buf, size_t len); -#endif -#ifdef RISCV_RVV -extern uint32_t adler32_rvv(uint32_t adler, const uint8_t *buf, size_t len); -#endif -#ifdef X86_SSSE3 -extern uint32_t adler32_ssse3(uint32_t adler, const uint8_t *buf, size_t len); -#endif -#ifdef X86_AVX2 -extern uint32_t adler32_avx2(uint32_t adler, const uint8_t *buf, size_t len); -#endif -#ifdef X86_AVX512 -extern uint32_t adler32_avx512(uint32_t adler, const uint8_t *buf, size_t len); -#endif -#ifdef X86_AVX512VNNI -extern uint32_t adler32_avx512_vnni(uint32_t adler, const uint8_t *buf, size_t len); -#endif -#ifdef POWER8_VSX -extern uint32_t adler32_power8(uint32_t adler, const uint8_t *buf, size_t len); -#endif - -/* adler32 folding */ -#ifdef RISCV_RVV -extern uint32_t adler32_fold_copy_rvv(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); -#endif -#ifdef X86_SSE42 -extern uint32_t adler32_fold_copy_sse42(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); -#endif -#ifdef X86_AVX2 -extern uint32_t adler32_fold_copy_avx2(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); -#endif -#ifdef X86_AVX512 -extern uint32_t adler32_fold_copy_avx512(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); -#endif -#ifdef X86_AVX512VNNI -extern uint32_t adler32_fold_copy_avx512_vnni(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len); -#endif - -/* CRC32 folding */ -#ifdef X86_PCLMULQDQ_CRC -extern uint32_t crc32_fold_pclmulqdq_reset(crc32_fold *crc); -extern void crc32_fold_pclmulqdq_copy(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len); -extern void crc32_fold_pclmulqdq(crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc); -extern uint32_t crc32_fold_pclmulqdq_final(crc32_fold *crc); -extern uint32_t crc32_pclmulqdq(uint32_t crc32, const uint8_t *buf, size_t len); -#endif -#if defined(X86_PCLMULQDQ_CRC) && defined(X86_VPCLMULQDQ_CRC) -extern uint32_t crc32_fold_vpclmulqdq_reset(crc32_fold *crc); -extern void crc32_fold_vpclmulqdq_copy(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len); -extern void crc32_fold_vpclmulqdq(crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc); -extern uint32_t crc32_fold_vpclmulqdq_final(crc32_fold *crc); -extern uint32_t crc32_vpclmulqdq(uint32_t crc32, const uint8_t *buf, size_t len); -#endif - -/* memory chunking */ -extern uint32_t chunksize_c(void); -extern uint8_t* chunkmemset_safe_c(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#ifdef X86_SSE2 -extern uint32_t chunksize_sse2(void); -extern uint8_t* chunkmemset_safe_sse2(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#endif -#ifdef X86_SSSE3 -extern uint8_t* chunkmemset_safe_ssse3(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#endif -#ifdef X86_AVX2 -extern uint32_t chunksize_avx2(void); -extern uint8_t* chunkmemset_safe_avx2(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#endif -#ifdef ARM_NEON -extern uint32_t chunksize_neon(void); -extern uint8_t* chunkmemset_safe_neon(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#endif -#ifdef POWER8_VSX -extern uint32_t chunksize_power8(void); -extern uint8_t* chunkmemset_safe_power8(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#endif -#ifdef RISCV_RVV -extern uint32_t chunksize_rvv(void); -extern uint8_t* chunkmemset_safe_rvv(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#endif - -#ifdef ZLIB_COMPAT -typedef struct z_stream_s z_stream; -#else -typedef struct zng_stream_s zng_stream; -#endif - -/* inflate fast loop */ -extern void inflate_fast_c(PREFIX3(stream) *strm, uint32_t start); -#ifdef X86_SSE2 -extern void inflate_fast_sse2(PREFIX3(stream) *strm, uint32_t start); -#endif -#ifdef X86_SSSE3 -extern void inflate_fast_ssse3(PREFIX3(stream) *strm, uint32_t start); -#endif -#ifdef X86_AVX2 -extern void inflate_fast_avx2(PREFIX3(stream) *strm, uint32_t start); -#endif -#ifdef ARM_NEON -extern void inflate_fast_neon(PREFIX3(stream) *strm, uint32_t start); -#endif -#ifdef POWER8_VSX -extern void inflate_fast_power8(PREFIX3(stream) *strm, uint32_t start); -#endif -#ifdef RISCV_RVV -extern void inflate_fast_rvv(PREFIX3(stream) *strm, uint32_t start); -#endif - -/* CRC32 */ -typedef uint32_t (*crc32_func)(uint32_t crc32, const uint8_t *buf, size_t len); - -extern uint32_t PREFIX(crc32_braid)(uint32_t crc, const uint8_t *buf, size_t len); -#ifdef ARM_ACLE -extern uint32_t crc32_acle(uint32_t crc, const uint8_t *buf, size_t len); -#elif defined(POWER8_VSX) -extern uint32_t crc32_power8(uint32_t crc, const uint8_t *buf, size_t len); -#elif defined(S390_CRC32_VX) -extern uint32_t crc32_s390_vx(uint32_t crc, const uint8_t *buf, size_t len); -#endif - -/* compare256 */ -typedef uint32_t (*compare256_func)(const uint8_t *src0, const uint8_t *src1); - -extern uint32_t compare256_c(const uint8_t *src0, const uint8_t *src1); -#if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN -extern uint32_t compare256_unaligned_16(const uint8_t *src0, const uint8_t *src1); -#ifdef HAVE_BUILTIN_CTZ -extern uint32_t compare256_unaligned_32(const uint8_t *src0, const uint8_t *src1); -#endif -#if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) -extern uint32_t compare256_unaligned_64(const uint8_t *src0, const uint8_t *src1); -#endif -#endif -#if defined(X86_SSE2) && defined(HAVE_BUILTIN_CTZ) -extern uint32_t compare256_sse2(const uint8_t *src0, const uint8_t *src1); -#endif -#if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) -extern uint32_t compare256_avx2(const uint8_t *src0, const uint8_t *src1); -#endif -#if defined(ARM_NEON) && defined(HAVE_BUILTIN_CTZLL) -extern uint32_t compare256_neon(const uint8_t *src0, const uint8_t *src1); -#endif -#ifdef POWER9 -extern uint32_t compare256_power9(const uint8_t *src0, const uint8_t *src1); -#endif -#ifdef RISCV_RVV -extern uint32_t compare256_rvv(const uint8_t *src0, const uint8_t *src1); -#endif - -#ifdef DEFLATE_H_ -/* insert_string */ -extern void insert_string_c(deflate_state *const s, const uint32_t str, uint32_t count); -#ifdef X86_SSE42 -extern void insert_string_sse42(deflate_state *const s, const uint32_t str, uint32_t count); -#elif defined(ARM_ACLE) -extern void insert_string_acle(deflate_state *const s, const uint32_t str, uint32_t count); -#endif - -/* longest_match */ -extern uint32_t longest_match_c(deflate_state *const s, Pos cur_match); -#if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN -extern uint32_t longest_match_unaligned_16(deflate_state *const s, Pos cur_match); -#ifdef HAVE_BUILTIN_CTZ -extern uint32_t longest_match_unaligned_32(deflate_state *const s, Pos cur_match); -#endif -#if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) -extern uint32_t longest_match_unaligned_64(deflate_state *const s, Pos cur_match); -#endif -#endif -#if defined(X86_SSE2) && defined(HAVE_BUILTIN_CTZ) -extern uint32_t longest_match_sse2(deflate_state *const s, Pos cur_match); -#endif -#if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) -extern uint32_t longest_match_avx2(deflate_state *const s, Pos cur_match); -#endif -#if defined(ARM_NEON) && defined(HAVE_BUILTIN_CTZLL) -extern uint32_t longest_match_neon(deflate_state *const s, Pos cur_match); -#endif -#ifdef POWER9 -extern uint32_t longest_match_power9(deflate_state *const s, Pos cur_match); -#endif -#ifdef RISCV_RVV -extern uint32_t longest_match_rvv(deflate_state *const s, Pos cur_match); -#endif - -/* longest_match_slow */ -extern uint32_t longest_match_slow_c(deflate_state *const s, Pos cur_match); -#if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN -extern uint32_t longest_match_slow_unaligned_16(deflate_state *const s, Pos cur_match); -extern uint32_t longest_match_slow_unaligned_32(deflate_state *const s, Pos cur_match); -#ifdef UNALIGNED64_OK -extern uint32_t longest_match_slow_unaligned_64(deflate_state *const s, Pos cur_match); -#endif -#endif -#if defined(X86_SSE2) && defined(HAVE_BUILTIN_CTZ) -extern uint32_t longest_match_slow_sse2(deflate_state *const s, Pos cur_match); -#endif -#if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) -extern uint32_t longest_match_slow_avx2(deflate_state *const s, Pos cur_match); -#endif -#if defined(ARM_NEON) && defined(HAVE_BUILTIN_CTZLL) -extern uint32_t longest_match_slow_neon(deflate_state *const s, Pos cur_match); -#endif -#ifdef POWER9 -extern uint32_t longest_match_slow_power9(deflate_state *const s, Pos cur_match); -#endif -#ifdef RISCV_RVV -extern uint32_t longest_match_slow_rvv(deflate_state *const s, Pos cur_match); -#endif - -/* quick_insert_string */ -extern Pos quick_insert_string_c(deflate_state *const s, const uint32_t str); -#ifdef X86_SSE42 -extern Pos quick_insert_string_sse42(deflate_state *const s, const uint32_t str); -#elif defined(ARM_ACLE) -extern Pos quick_insert_string_acle(deflate_state *const s, const uint32_t str); -#endif - -/* slide_hash */ -typedef void (*slide_hash_func)(deflate_state *s); - -#ifdef X86_SSE2 -extern void slide_hash_sse2(deflate_state *s); -#endif -#if defined(ARM_SIMD) -extern void slide_hash_armv6(deflate_state *s); -#endif -#if defined(ARM_NEON) -extern void slide_hash_neon(deflate_state *s); -#endif -#if defined(PPC_VMX) -extern void slide_hash_vmx(deflate_state *s); -#endif -#if defined(POWER8_VSX) -extern void slide_hash_power8(deflate_state *s); -#endif -#if defined(RISCV_RVV) -extern void slide_hash_rvv(deflate_state *s); -#endif -#ifdef X86_AVX2 -extern void slide_hash_avx2(deflate_state *s); -#endif - -/* update_hash */ -extern uint32_t update_hash_c(deflate_state *const s, uint32_t h, uint32_t val); -#ifdef X86_SSE42 -extern uint32_t update_hash_sse42(deflate_state *const s, uint32_t h, uint32_t val); -#elif defined(ARM_ACLE) -extern uint32_t update_hash_acle(deflate_state *const s, uint32_t h, uint32_t val); -#endif #endif #endif diff --git a/src/native/external/zlib-ng/crc32.c b/src/native/external/zlib-ng/crc32.c new file mode 100644 index 00000000000000..54f6ecd4208ca3 --- /dev/null +++ b/src/native/external/zlib-ng/crc32.c @@ -0,0 +1,42 @@ +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2022 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * + * 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. + */ + +#include "zbuild.h" +#include "functable.h" +#include "crc32_braid_tbl.h" + +/* ========================================================================= */ + +const uint32_t * Z_EXPORT PREFIX(get_crc_table)(void) { + return (const uint32_t *)crc_table; +} + +#ifdef ZLIB_COMPAT +unsigned long Z_EXPORT PREFIX(crc32_z)(unsigned long crc, const unsigned char *buf, size_t len) { + if (buf == NULL) return 0; + + return (unsigned long)FUNCTABLE_CALL(crc32)((uint32_t)crc, buf, len); +} +#else +uint32_t Z_EXPORT PREFIX(crc32_z)(uint32_t crc, const unsigned char *buf, size_t len) { + if (buf == NULL) return 0; + + return FUNCTABLE_CALL(crc32)(crc, buf, len); +} +#endif + +#ifdef ZLIB_COMPAT +unsigned long Z_EXPORT PREFIX(crc32)(unsigned long crc, const unsigned char *buf, unsigned int len) { + return (unsigned long)PREFIX(crc32_z)((uint32_t)crc, buf, len); +} +#else +uint32_t Z_EXPORT PREFIX(crc32)(uint32_t crc, const unsigned char *buf, uint32_t len) { + return PREFIX(crc32_z)(crc, buf, len); +} +#endif diff --git a/src/native/external/zlib-ng/crc32.h b/src/native/external/zlib-ng/crc32.h new file mode 100644 index 00000000000000..8c3d7a8a3ef2fc --- /dev/null +++ b/src/native/external/zlib-ng/crc32.h @@ -0,0 +1,16 @@ +/* crc32.h -- crc32 folding interface + * Copyright (C) 2021 Nathan Moinvaziri + * For conditions of distribution and use, see copyright notice in zlib.h + */ +#ifndef CRC32_H_ +#define CRC32_H_ + +#define CRC32_FOLD_BUFFER_SIZE (16 * 4) +/* sizeof(__m128i) * (4 folds) */ + +typedef struct crc32_fold_s { + uint8_t fold[CRC32_FOLD_BUFFER_SIZE]; + uint32_t value; +} crc32_fold; + +#endif diff --git a/src/native/external/zlib-ng/crc32_braid_comb.c b/src/native/external/zlib-ng/crc32_braid_comb.c index 75fb4742587394..f253ae10a24407 100644 --- a/src/native/external/zlib-ng/crc32_braid_comb.c +++ b/src/native/external/zlib-ng/crc32_braid_comb.c @@ -7,7 +7,6 @@ * Kadatch and Jenkins (2010). See doc/crc-doc.1.0.pdf in this distribution. */ -#include "zbuild.h" #include "zutil.h" #include "crc32_braid_p.h" #include "crc32_braid_tbl.h" diff --git a/src/native/external/zlib-ng/crc32_braid_p.h b/src/native/external/zlib-ng/crc32_braid_p.h index 1d8a07068a4c5b..003bf91920fa9c 100644 --- a/src/native/external/zlib-ng/crc32_braid_p.h +++ b/src/native/external/zlib-ng/crc32_braid_p.h @@ -1,7 +1,6 @@ #ifndef CRC32_BRAID_P_H_ #define CRC32_BRAID_P_H_ -#include "zbuild.h" #include "zendian.h" /* Define N */ @@ -25,7 +24,7 @@ # endif #else # ifndef W -# if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) +# if defined(__x86_64__) || defined(_M_AMD64) || defined(__aarch64__) || defined(_M_ARM64) || defined(__powerpc64__) # define W 8 # else # define W 4 @@ -42,9 +41,24 @@ # endif #endif +#if BYTE_ORDER == LITTLE_ENDIAN +# define ZSWAPWORD(word) (word) +# define BRAID_TABLE crc_braid_table +#elif BYTE_ORDER == BIG_ENDIAN +# if W == 8 +# define ZSWAPWORD(word) ZSWAP64(word) +# elif W == 4 +# define ZSWAPWORD(word) ZSWAP32(word) +# endif +# define BRAID_TABLE crc_braid_big_table +#else +# error "No endian defined" +#endif + +#define DO1 c = crc_table[(c ^ *buf++) & 0xff] ^ (c >> 8) +#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 + /* CRC polynomial. */ #define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */ -extern uint32_t PREFIX(crc32_braid)(uint32_t crc, const uint8_t *buf, size_t len); - #endif /* CRC32_BRAID_P_H_ */ diff --git a/src/native/external/zlib-ng/deflate.c b/src/native/external/zlib-ng/deflate.c index 2a0a20e5d29a99..66b5506a521e5c 100644 --- a/src/native/external/zlib-ng/deflate.c +++ b/src/native/external/zlib-ng/deflate.c @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2023 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 */ @@ -58,7 +58,7 @@ # undef deflateInit2 #endif -const char PREFIX(deflate_copyright)[] = " deflate 1.3.0 Copyright 1995-2023 Jean-loup Gailly and Mark Adler "; +const char PREFIX(deflate_copyright)[] = " 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 @@ -71,14 +71,16 @@ const char PREFIX(deflate_copyright)[] = " deflate 1.3.0 Copyright 1995-2023 Jea */ #ifdef S390_DFLTCC_DEFLATE # include "arch/s390/dfltcc_deflate.h" +/* DFLTCC instructions require window to be page-aligned */ +# define PAD_WINDOW PAD_4096 +# define WINDOW_PAD_SIZE 4096 +# define HINT_ALIGNED_WINDOW HINT_ALIGNED_4096 #else -/* Memory management for the deflate state. Useful for allocating arch-specific extension blocks. */ -# define ZALLOC_DEFLATE_STATE(strm) ((deflate_state *)ZALLOC(strm, 1, sizeof(deflate_state))) -# define ZFREE_STATE(strm, addr) ZFREE(strm, addr) -# define ZCOPY_DEFLATE_STATE(dst, src) memcpy(dst, src, sizeof(deflate_state)) -/* Memory management for the window. Useful for allocation the aligned window. */ -# define ZALLOC_WINDOW(strm, items, size) ZALLOC(strm, items, size) -# define TRY_FREE_WINDOW(strm, addr) TRY_FREE(strm, addr) +# define PAD_WINDOW PAD_64 +# define WINDOW_PAD_SIZE 64 +# define HINT_ALIGNED_WINDOW HINT_ALIGNED_64 +/* Adjust the window size for the arch-specific deflate code. */ +# define DEFLATE_ADJUST_WINDOW_SIZE(n) (n) /* Invoked at the beginning of deflateSetDictionary(). Useful for checking arch-specific window data. */ # define DEFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) do {} while (0) /* Invoked at the beginning of deflateGetDictionary(). Useful for adjusting arch-specific window data. */ @@ -120,10 +122,6 @@ static void lm_set_level (deflate_state *s, int level); static void lm_init (deflate_state *s); Z_INTERNAL unsigned read_buf (PREFIX3(stream) *strm, unsigned char *buf, unsigned size); -extern uint32_t update_hash_roll (deflate_state *const s, uint32_t h, uint32_t val); -extern void insert_string_roll (deflate_state *const s, uint32_t str, uint32_t count); -extern Pos quick_insert_string_roll(deflate_state *const s, uint32_t str); - /* =========================================================================== * Local data */ @@ -185,17 +183,111 @@ static const config configuration_table[10] = { memset((unsigned char *)s->head, 0, HASH_SIZE * sizeof(*s->head)); \ } while (0) -/* ========================================================================= */ -/* This function is hidden in ZLIB_COMPAT builds. */ + +#ifdef DEF_ALLOC_DEBUG +# include +# define LOGSZ(name,size) fprintf(stderr, "%s is %d bytes\n", name, size) +# define LOGSZP(name,size,loc,pad) fprintf(stderr, "%s is %d bytes, offset %d, padded %d\n", name, size, loc, pad) +# define LOGSZPL(name,size,loc,pad) fprintf(stderr, "%s is %d bytes, offset %ld, padded %d\n", name, size, loc, pad) +#else +# define LOGSZ(name,size) +# define LOGSZP(name,size,loc,pad) +# define LOGSZPL(name,size,loc,pad) +#endif + +/* =========================================================================== + * Allocate a big buffer and divide it up into the various buffers deflate needs. + * Handles alignment of allocated buffer and alignment of individual buffers. + */ +Z_INTERNAL deflate_allocs* alloc_deflate(PREFIX3(stream) *strm, int windowBits, int lit_bufsize) { + int curr_size = 0; + + /* Define sizes */ + int window_size = DEFLATE_ADJUST_WINDOW_SIZE((1 << windowBits) * 2); + int prev_size = (1 << windowBits) * sizeof(Pos); + int head_size = HASH_SIZE * sizeof(Pos); + int pending_size = lit_bufsize * LIT_BUFS; + int state_size = sizeof(deflate_state); + int alloc_size = sizeof(deflate_allocs); + + /* Calculate relative buffer positions and paddings */ + LOGSZP("window", window_size, PAD_WINDOW(curr_size), PADSZ(curr_size,WINDOW_PAD_SIZE)); + int window_pos = PAD_WINDOW(curr_size); + curr_size = window_pos + window_size; + + LOGSZP("prev", prev_size, PAD_64(curr_size), PADSZ(curr_size,64)); + int prev_pos = PAD_64(curr_size); + curr_size = prev_pos + prev_size; + + LOGSZP("head", head_size, PAD_64(curr_size), PADSZ(curr_size,64)); + int head_pos = PAD_64(curr_size); + curr_size = head_pos + head_size; + + LOGSZP("pending", pending_size, PAD_64(curr_size), PADSZ(curr_size,64)); + int pending_pos = PAD_64(curr_size); + curr_size = pending_pos + pending_size; + + LOGSZP("state", state_size, PAD_64(curr_size), PADSZ(curr_size,64)); + int state_pos = PAD_64(curr_size); + curr_size = state_pos + state_size; + + LOGSZP("alloc", alloc_size, PAD_16(curr_size), PADSZ(curr_size,16)); + int alloc_pos = PAD_16(curr_size); + curr_size = alloc_pos + alloc_size; + + /* Add 64-1 or 4096-1 to allow window alignment, and round size of buffer up to multiple of 64 */ + int total_size = PAD_64(curr_size + (WINDOW_PAD_SIZE - 1)); + + /* Allocate buffer, align to 64-byte cacheline, and zerofill the resulting buffer */ + char *original_buf = strm->zalloc(strm->opaque, 1, total_size); + if (original_buf == NULL) + return NULL; + + char *buff = (char *)HINT_ALIGNED_WINDOW((char *)PAD_WINDOW(original_buf)); + LOGSZPL("Buffer alloc", total_size, PADSZ((uintptr_t)original_buf,WINDOW_PAD_SIZE), PADSZ(curr_size,WINDOW_PAD_SIZE)); + + /* Initialize alloc_bufs */ + deflate_allocs *alloc_bufs = (struct deflate_allocs_s *)(buff + alloc_pos); + alloc_bufs->buf_start = (char *)original_buf; + alloc_bufs->zfree = strm->zfree; + + /* Assign buffers */ + alloc_bufs->window = (unsigned char *)HINT_ALIGNED_WINDOW(buff + window_pos); + alloc_bufs->prev = (Pos *)HINT_ALIGNED_64(buff + prev_pos); + alloc_bufs->head = (Pos *)HINT_ALIGNED_64(buff + head_pos); + alloc_bufs->pending_buf = (unsigned char *)HINT_ALIGNED_64(buff + pending_pos); + alloc_bufs->state = (deflate_state *)HINT_ALIGNED_16(buff + state_pos); + + memset((char *)alloc_bufs->prev, 0, prev_size); + + return alloc_bufs; +} + +/* =========================================================================== + * Free all allocated deflate buffers + */ +static inline void free_deflate(PREFIX3(stream) *strm) { + deflate_state *state = (deflate_state *)strm->state; + + if (state->alloc_bufs != NULL) { + deflate_allocs *alloc_bufs = state->alloc_bufs; + alloc_bufs->zfree(strm->opaque, alloc_bufs->buf_start); + strm->state = NULL; + } +} + +/* =========================================================================== + * Initialize deflate state and buffers. + * This function is hidden in ZLIB_COMPAT builds. + */ int32_t ZNG_CONDEXPORT PREFIX(deflateInit2)(PREFIX3(stream) *strm, int32_t level, int32_t method, int32_t windowBits, int32_t memLevel, int32_t strategy) { /* Todo: ignore strm->next_in if we use it as window */ - uint32_t window_padding = 0; deflate_state *s; int wrap = 1; - /* Force initialization functable, because deflate captures function pointers from functable. */ - functable.force_init(); + /* Initialize functable */ + FUNCTABLE_INIT; if (strm == NULL) return Z_STREAM_ERROR; @@ -230,9 +322,19 @@ int32_t ZNG_CONDEXPORT PREFIX(deflateInit2)(PREFIX3(stream) *strm, int32_t level if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ - s = ZALLOC_DEFLATE_STATE(strm); - if (s == NULL) + /* Allocate buffers */ + int lit_bufsize = 1 << (memLevel + 6); + deflate_allocs *alloc_bufs = alloc_deflate(strm, windowBits, lit_bufsize); + if (alloc_bufs == NULL) return Z_MEM_ERROR; + + s = alloc_bufs->state; + s->alloc_bufs = alloc_bufs; + s->window = alloc_bufs->window; + s->prev = alloc_bufs->prev; + s->head = alloc_bufs->head; + s->pending_buf = alloc_bufs->pending_buf; + strm->state = (struct internal_state *)s; s->strm = strm; s->status = INIT_STATE; /* to pass state test in deflateReset() */ @@ -243,18 +345,9 @@ int32_t ZNG_CONDEXPORT PREFIX(deflateInit2)(PREFIX3(stream) *strm, int32_t level s->w_size = 1 << s->w_bits; s->w_mask = s->w_size - 1; -#ifdef X86_PCLMULQDQ_CRC - window_padding = 8; -#endif - - s->window = (unsigned char *) ZALLOC_WINDOW(strm, s->w_size + window_padding, 2*sizeof(unsigned char)); - s->prev = (Pos *) ZALLOC(strm, s->w_size, sizeof(Pos)); - memset(s->prev, 0, s->w_size * sizeof(Pos)); - s->head = (Pos *) ZALLOC(strm, HASH_SIZE, sizeof(Pos)); - s->high_water = 0; /* nothing written to s->window yet */ - s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + s->lit_bufsize = lit_bufsize; /* 16K elements by default */ /* 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 @@ -295,7 +388,6 @@ int32_t ZNG_CONDEXPORT PREFIX(deflateInit2)(PREFIX3(stream) *strm, int32_t level * symbols from which it is being constructed. */ - s->pending_buf = (unsigned char *) ZALLOC(strm, s->lit_bufsize, 4); s->pending_buf_size = s->lit_bufsize * 4; if (s->window == NULL || s->prev == NULL || s->head == NULL || s->pending_buf == NULL) { @@ -304,8 +396,15 @@ int32_t ZNG_CONDEXPORT PREFIX(deflateInit2)(PREFIX3(stream) *strm, int32_t level PREFIX(deflateEnd)(strm); return Z_MEM_ERROR; } + +#ifdef LIT_MEM + s->d_buf = (uint16_t *)(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. @@ -348,7 +447,7 @@ static int deflateStateCheck(PREFIX3(stream) *strm) { if (strm == NULL || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) return 1; s = strm->state; - if (s == NULL || s->strm != strm || (s->status < INIT_STATE || s->status > MAX_STATE)) + if (s == NULL || s->alloc_bufs == NULL || s->strm != strm || (s->status < INIT_STATE || s->status > MAX_STATE)) return 1; return 0; } @@ -370,7 +469,7 @@ int32_t Z_EXPORT PREFIX(deflateSetDictionary)(PREFIX3(stream) *strm, const uint8 /* when using zlib wrappers, compute Adler-32 for provided dictionary */ if (wrap == 1) - strm->adler = functable.adler32(strm->adler, dictionary, dictLength); + strm->adler = FUNCTABLE_CALL(adler32)(strm->adler, dictionary, dictLength); DEFLATE_SET_DICTIONARY_HOOK(strm, dictionary, dictLength); /* hook for IBM Z DFLTCC */ s->wrap = 0; /* avoid computing Adler-32 in read_buf */ @@ -457,7 +556,7 @@ int32_t Z_EXPORT PREFIX(deflateResetKeep)(PREFIX3(stream) *strm) { #ifdef GZIP if (s->wrap == 2) { - strm->adler = functable.crc32_fold_reset(&s->crc_fold); + strm->adler = FUNCTABLE_CALL(crc32_fold_reset)(&s->crc_fold); } else #endif strm->adler = ADLER32_INITIAL_VALUE; @@ -506,9 +605,17 @@ int32_t Z_EXPORT PREFIX(deflatePrime)(PREFIX3(stream) *strm, int32_t bits, int32 if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; + +#ifdef LIT_MEM + if (bits < 0 || bits > BIT_BUF_SIZE || + (unsigned char *)s->d_buf < s->pending_out + ((BIT_BUF_SIZE + 7) >> 3)) + return Z_BUF_ERROR; +#else if (bits < 0 || bits > BIT_BUF_SIZE || bits > (int32_t)(sizeof(value) << 3) || s->sym_buf < s->pending_out + ((BIT_BUF_SIZE + 7) >> 3)) return Z_BUF_ERROR; +#endif + do { put = BIT_BUF_SIZE - s->bi_valid; put = MIN(put, bits); @@ -555,7 +662,7 @@ int32_t Z_EXPORT PREFIX(deflateParams)(PREFIX3(stream) *strm, int32_t level, int if (s->level != level) { if (s->level == 0 && s->matches != 0) { if (s->matches == 1) { - functable.slide_hash(s); + FUNCTABLE_CALL(slide_hash)(s); } else { CLEAR_HASH(s); } @@ -794,7 +901,7 @@ int32_t Z_EXPORT PREFIX(deflate)(PREFIX3(stream) *strm, int32_t flush) { #ifdef GZIP if (s->status == GZIP_STATE) { /* gzip header */ - functable.crc32_fold_reset(&s->crc_fold); + FUNCTABLE_CALL(crc32_fold_reset)(&s->crc_fold); put_byte(s, 31); put_byte(s, 139); put_byte(s, 8); @@ -911,7 +1018,7 @@ int32_t Z_EXPORT PREFIX(deflate)(PREFIX3(stream) *strm, int32_t flush) { } } put_short(s, (uint16_t)strm->adler); - functable.crc32_fold_reset(&s->crc_fold); + FUNCTABLE_CALL(crc32_fold_reset)(&s->crc_fold); } s->status = BUSY_STATE; @@ -982,7 +1089,7 @@ int32_t Z_EXPORT PREFIX(deflate)(PREFIX3(stream) *strm, int32_t flush) { /* Write the trailer */ #ifdef GZIP if (s->wrap == 2) { - strm->adler = functable.crc32_fold_final(&s->crc_fold); + strm->adler = FUNCTABLE_CALL(crc32_fold_final)(&s->crc_fold); put_uint32(s, strm->adler); put_uint32(s, (uint32_t)strm->total_in); @@ -1007,21 +1114,13 @@ int32_t Z_EXPORT PREFIX(deflate)(PREFIX3(stream) *strm, int32_t flush) { /* ========================================================================= */ int32_t Z_EXPORT PREFIX(deflateEnd)(PREFIX3(stream) *strm) { - int32_t status; - if (deflateStateCheck(strm)) return Z_STREAM_ERROR; - status = strm->state->status; - - /* Deallocate in reverse order of allocations: */ - TRY_FREE(strm, strm->state->pending_buf); - TRY_FREE(strm, strm->state->head); - TRY_FREE(strm, strm->state->prev); - TRY_FREE_WINDOW(strm, strm->state->window); + int32_t status = strm->state->status; - ZFREE_STATE(strm, strm->state); - strm->state = NULL; + /* Free allocated buffers */ + free_deflate(strm); return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; } @@ -1032,7 +1131,6 @@ int32_t Z_EXPORT PREFIX(deflateEnd)(PREFIX3(stream) *strm) { int32_t Z_EXPORT PREFIX(deflateCopy)(PREFIX3(stream) *dest, PREFIX3(stream) *source) { deflate_state *ds; deflate_state *ss; - uint32_t window_padding = 0; if (deflateStateCheck(source) || dest == NULL) return Z_STREAM_ERROR; @@ -1041,34 +1139,39 @@ int32_t Z_EXPORT PREFIX(deflateCopy)(PREFIX3(stream) *dest, PREFIX3(stream) *sou memcpy((void *)dest, (void *)source, sizeof(PREFIX3(stream))); - ds = ZALLOC_DEFLATE_STATE(dest); - if (ds == NULL) + deflate_allocs *alloc_bufs = alloc_deflate(dest, ss->w_bits, ss->lit_bufsize); + if (alloc_bufs == NULL) return Z_MEM_ERROR; + + ds = alloc_bufs->state; + dest->state = (struct internal_state *) ds; - ZCOPY_DEFLATE_STATE(ds, ss); + memcpy(ds, ss, sizeof(deflate_state)); ds->strm = dest; -#ifdef X86_PCLMULQDQ_CRC - window_padding = 8; -#endif - - ds->window = (unsigned char *) ZALLOC_WINDOW(dest, ds->w_size + window_padding, 2*sizeof(unsigned char)); - ds->prev = (Pos *) ZALLOC(dest, ds->w_size, sizeof(Pos)); - ds->head = (Pos *) ZALLOC(dest, HASH_SIZE, sizeof(Pos)); - ds->pending_buf = (unsigned char *) ZALLOC(dest, ds->lit_bufsize, 4); + ds->alloc_bufs = alloc_bufs; + ds->window = alloc_bufs->window; + ds->prev = alloc_bufs->prev; + ds->head = alloc_bufs->head; + ds->pending_buf = alloc_bufs->pending_buf; if (ds->window == NULL || ds->prev == NULL || ds->head == NULL || ds->pending_buf == NULL) { PREFIX(deflateEnd)(dest); return Z_MEM_ERROR; } - memcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(unsigned char)); + memcpy(ds->window, ss->window, DEFLATE_ADJUST_WINDOW_SIZE(ds->w_size * 2 * sizeof(unsigned char))); memcpy((void *)ds->prev, (void *)ss->prev, ds->w_size * sizeof(Pos)); memcpy((void *)ds->head, (void *)ss->head, HASH_SIZE * sizeof(Pos)); - memcpy(ds->pending_buf, ss->pending_buf, ds->pending_buf_size); + memcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); +#ifdef LIT_MEM + ds->d_buf = (uint16_t *)(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; @@ -1095,10 +1198,10 @@ Z_INTERNAL unsigned PREFIX(read_buf)(PREFIX3(stream) *strm, unsigned char *buf, memcpy(buf, strm->next_in, len); #ifdef GZIP } else if (strm->state->wrap == 2) { - functable.crc32_fold_copy(&strm->state->crc_fold, buf, strm->next_in, len); + FUNCTABLE_CALL(crc32_fold_copy)(&strm->state->crc_fold, buf, strm->next_in, len); #endif } else if (strm->state->wrap == 1) { - strm->adler = functable.adler32_fold_copy(strm->adler, buf, strm->next_in, len); + strm->adler = FUNCTABLE_CALL(adler32_fold_copy)(strm->adler, buf, strm->next_in, len); } else { memcpy(buf, strm->next_in, len); } @@ -1125,9 +1228,9 @@ static void lm_set_level(deflate_state *s, int level) { s->insert_string = &insert_string_roll; s->quick_insert_string = &quick_insert_string_roll; } else { - s->update_hash = functable.update_hash; - s->insert_string = functable.insert_string; - s->quick_insert_string = functable.quick_insert_string; + s->update_hash = update_hash; + s->insert_string = insert_string; + s->quick_insert_string = quick_insert_string; } s->level = level; @@ -1191,7 +1294,7 @@ void Z_INTERNAL PREFIX(fill_window)(deflate_state *s) { s->block_start -= (int)wsize; if (s->insert > s->strstart) s->insert = s->strstart; - functable.slide_hash(s); + FUNCTABLE_CALL(slide_hash)(s); more += wsize; } if (s->strm->avail_in == 0) @@ -1217,7 +1320,7 @@ void Z_INTERNAL PREFIX(fill_window)(deflate_state *s) { if (s->lookahead + s->insert >= STD_MIN_MATCH) { unsigned int str = s->strstart - s->insert; if (UNLIKELY(s->max_chain_length > 1024)) { - s->ins_h = s->update_hash(s, s->window[str], s->window[str+1]); + s->ins_h = s->update_hash(s->window[str], s->window[str+1]); } else if (str >= 1) { s->quick_insert_string(s, str + 2 - STD_MIN_MATCH); } diff --git a/src/native/external/zlib-ng/deflate.h b/src/native/external/zlib-ng/deflate.h index 8001b47c999d8f..e122ae1aad6570 100644 --- a/src/native/external/zlib-ng/deflate.h +++ b/src/native/external/zlib-ng/deflate.h @@ -12,8 +12,12 @@ #include "zutil.h" #include "zendian.h" -#include "adler32_fold.h" -#include "crc32_fold.h" +#include "crc32.h" + +#ifdef S390_DFLTCC_DEFLATE +# include "arch/s390/dfltcc_common.h" +# define HAVE_ARCH_DEFLATE_STATE +#endif /* define NO_GZIP when compiling if you want to disable gzip header and trailer creation by deflate(). NO_GZIP would be used to avoid linking in @@ -23,6 +27,12 @@ # 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 */ +#ifndef NO_LIT_MEM +# define LIT_MEM +#endif + /* =========================================================================== * Internal compression state. */ @@ -108,11 +118,30 @@ typedef uint16_t Pos; /* Type definitions for hash callbacks */ typedef struct internal_state deflate_state; -typedef uint32_t (* update_hash_cb) (deflate_state *const s, uint32_t h, uint32_t val); +typedef uint32_t (* update_hash_cb) (uint32_t h, uint32_t val); typedef void (* insert_string_cb) (deflate_state *const s, uint32_t str, uint32_t count); typedef Pos (* quick_insert_string_cb)(deflate_state *const s, uint32_t str); -struct internal_state { +uint32_t update_hash (uint32_t h, uint32_t val); +void insert_string (deflate_state *const s, uint32_t str, uint32_t count); +Pos quick_insert_string (deflate_state *const s, uint32_t str); + +uint32_t update_hash_roll (uint32_t h, uint32_t val); +void insert_string_roll (deflate_state *const s, uint32_t str, uint32_t count); +Pos quick_insert_string_roll(deflate_state *const s, uint32_t str); + +/* Struct for memory allocation handling */ +typedef struct deflate_allocs_s { + char *buf_start; + free_func zfree; + deflate_state *state; + unsigned char *window; + unsigned char *pending_buf; + Pos *prev; + Pos *head; +} deflate_allocs; + +struct ALIGNED_(64) internal_state { PREFIX3(stream) *strm; /* pointer back to this zlib stream */ unsigned char *pending_buf; /* output still pending */ unsigned char *pending_out; /* next pending byte to output to the stream */ @@ -260,8 +289,16 @@ struct internal_state { * - I can't count above 4 */ +#ifdef LIT_MEM +# define LIT_BUFS 5 + uint16_t *d_buf; /* buffer for distances */ + unsigned char *l_buf; /* buffer for literals/lengths */ +#else +# define LIT_BUFS 4 unsigned char *sym_buf; /* buffer for distances and literals/lengths */ - unsigned int sym_next; /* running index in sym_buf */ +#endif + + unsigned int sym_next; /* running index in symbol buffer */ unsigned int sym_end; /* symbol table full when sym_next reaches this */ unsigned long opt_len; /* bit length of current block with optimal trees */ @@ -273,8 +310,11 @@ struct internal_state { unsigned long compressed_len; /* total bit length of compressed file mod 2^32 */ unsigned long bits_sent; /* bit length of compressed data sent mod 2^32 */ - /* Reserved for future use and alignment purposes */ - char *reserved_p; + deflate_allocs *alloc_bufs; + +#ifdef HAVE_ARCH_DEFLATE_STATE + arch_deflate_state arch; /* architecture-specific extensions */ +#endif uint64_t bi_buf; /* Output buffer. bits are inserted starting at the bottom (least significant bits). */ @@ -284,7 +324,7 @@ struct internal_state { /* Reserved for future use and alignment purposes */ int32_t reserved[11]; -} ALIGNED_(8); +}; typedef enum { need_more, /* block not completed, need more input or more output */ diff --git a/src/native/external/zlib-ng/deflate_fast.c b/src/native/external/zlib-ng/deflate_fast.c index eada7b46e329a9..2d0444cd73bbfb 100644 --- a/src/native/external/zlib-ng/deflate_fast.c +++ b/src/native/external/zlib-ng/deflate_fast.c @@ -1,6 +1,6 @@ /* deflate_fast.c -- compress data using the fast strategy of deflation algorithm * - * Copyright (C) 1995-2013 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 */ @@ -41,7 +41,7 @@ Z_INTERNAL block_state deflate_fast(deflate_state *s, int flush) { * dictionary, and set hash_head to the head of the hash chain: */ if (s->lookahead >= WANT_MIN_MATCH) { - hash_head = functable.quick_insert_string(s, s->strstart); + hash_head = quick_insert_string(s, s->strstart); dist = (int64_t)s->strstart - hash_head; /* Find the longest match, discarding those <= prev_length. @@ -52,15 +52,13 @@ Z_INTERNAL block_state deflate_fast(deflate_state *s, int flush) { * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ - match_len = functable.longest_match(s, hash_head); + match_len = FUNCTABLE_CALL(longest_match)(s, hash_head); /* longest_match() sets match_start */ } } if (match_len >= WANT_MIN_MATCH) { - Assert(s->strstart <= UINT16_MAX, "strstart should fit in uint16_t"); - Assert(s->match_start <= UINT16_MAX, "match_start should fit in uint16_t"); - check_match(s, (Pos)s->strstart, (Pos)s->match_start, match_len); + check_match(s, s->strstart, s->match_start, match_len); bflush = zng_tr_tally_dist(s, s->strstart - s->match_start, match_len - STD_MIN_MATCH); @@ -73,11 +71,11 @@ Z_INTERNAL block_state deflate_fast(deflate_state *s, int flush) { match_len--; /* string at strstart already in table */ s->strstart++; - functable.insert_string(s, s->strstart, match_len); + insert_string(s, s->strstart, match_len); s->strstart += match_len; } else { s->strstart += match_len; - functable.quick_insert_string(s, s->strstart + 2 - STD_MIN_MATCH); + quick_insert_string(s, s->strstart + 2 - STD_MIN_MATCH); /* If lookahead < STD_MIN_MATCH, ins_h is garbage, but it does not * matter since it will be recomputed at next deflate call. diff --git a/src/native/external/zlib-ng/deflate_huff.c b/src/native/external/zlib-ng/deflate_huff.c index b197e24d7c38f1..d5a234b114a42a 100644 --- a/src/native/external/zlib-ng/deflate_huff.c +++ b/src/native/external/zlib-ng/deflate_huff.c @@ -1,6 +1,6 @@ /* deflate_huff.c -- compress data using huffman encoding only strategy * - * Copyright (C) 1995-2013 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 */ diff --git a/src/native/external/zlib-ng/deflate_medium.c b/src/native/external/zlib-ng/deflate_medium.c index 47796e32217a1c..2aeebe2026bda8 100644 --- a/src/native/external/zlib-ng/deflate_medium.c +++ b/src/native/external/zlib-ng/deflate_medium.c @@ -45,16 +45,18 @@ static void insert_match(deflate_state *s, struct match match) { if (UNLIKELY(s->lookahead <= (unsigned int)(match.match_length + WANT_MIN_MATCH))) return; + /* string at strstart already in table */ + match.strstart++; + match.match_length--; + /* matches that are not long enough we need to emit as literals */ - if (LIKELY(match.match_length < WANT_MIN_MATCH)) { - match.strstart++; - match.match_length--; + if (LIKELY(match.match_length < WANT_MIN_MATCH - 1)) { if (UNLIKELY(match.match_length > 0)) { if (match.strstart >= match.orgstart) { if (match.strstart + match.match_length - 1 >= match.orgstart) { - functable.insert_string(s, match.strstart, match.match_length); + insert_string(s, match.strstart, match.match_length); } else { - functable.insert_string(s, match.strstart, match.orgstart - match.strstart + 1); + insert_string(s, match.strstart, match.orgstart - match.strstart + 1); } match.strstart += match.match_length; match.match_length = 0; @@ -63,35 +65,18 @@ static void insert_match(deflate_state *s, struct match match) { return; } - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ - if (match.match_length <= 16 * s->max_insert_length && s->lookahead >= WANT_MIN_MATCH) { - match.match_length--; /* string at strstart already in table */ - match.strstart++; - - if (LIKELY(match.strstart >= match.orgstart)) { - if (LIKELY(match.strstart + match.match_length - 1 >= match.orgstart)) { - functable.insert_string(s, match.strstart, match.match_length); - } else { - functable.insert_string(s, match.strstart, match.orgstart - match.strstart + 1); - } - } else if (match.orgstart < match.strstart + match.match_length) { - functable.insert_string(s, match.orgstart, match.strstart + match.match_length - match.orgstart); + /* Insert into hash table. */ + if (LIKELY(match.strstart >= match.orgstart)) { + if (LIKELY(match.strstart + match.match_length - 1 >= match.orgstart)) { + insert_string(s, match.strstart, match.match_length); + } else { + insert_string(s, match.strstart, match.orgstart - match.strstart + 1); } - match.strstart += match.match_length; - match.match_length = 0; - } else { - match.strstart += match.match_length; - match.match_length = 0; - - if (match.strstart >= (STD_MIN_MATCH - 2)) - functable.quick_insert_string(s, match.strstart + 2 - STD_MIN_MATCH); - - /* If lookahead < WANT_MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ + } else if (match.orgstart < match.strstart + match.match_length) { + insert_string(s, match.orgstart, match.strstart + match.match_length - match.orgstart); } + match.strstart += match.match_length; + match.match_length = 0; } static void fizzle_matches(deflate_state *s, struct match *current, struct match *next) { @@ -199,7 +184,7 @@ Z_INTERNAL block_state deflate_medium(deflate_state *s, int flush) { } else { hash_head = 0; if (s->lookahead >= WANT_MIN_MATCH) { - hash_head = functable.quick_insert_string(s, s->strstart); + hash_head = quick_insert_string(s, s->strstart); } current_match.strstart = (uint16_t)s->strstart; @@ -215,7 +200,7 @@ Z_INTERNAL block_state deflate_medium(deflate_state *s, int flush) { * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ - current_match.match_length = (uint16_t)functable.longest_match(s, hash_head); + current_match.match_length = (uint16_t)FUNCTABLE_CALL(longest_match)(s, hash_head); current_match.match_start = (uint16_t)s->match_start; if (UNLIKELY(current_match.match_length < WANT_MIN_MATCH)) current_match.match_length = 1; @@ -235,7 +220,7 @@ Z_INTERNAL block_state deflate_medium(deflate_state *s, int flush) { /* now, look ahead one */ if (LIKELY(!early_exit && s->lookahead > MIN_LOOKAHEAD && (uint32_t)(current_match.strstart + current_match.match_length) < (s->window_size - MIN_LOOKAHEAD))) { s->strstart = current_match.strstart + current_match.match_length; - hash_head = functable.quick_insert_string(s, s->strstart); + hash_head = quick_insert_string(s, s->strstart); next_match.strstart = (uint16_t)s->strstart; next_match.orgstart = next_match.strstart; @@ -250,7 +235,7 @@ Z_INTERNAL block_state deflate_medium(deflate_state *s, int flush) { * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ - next_match.match_length = (uint16_t)functable.longest_match(s, hash_head); + next_match.match_length = (uint16_t)FUNCTABLE_CALL(longest_match)(s, hash_head); next_match.match_start = (uint16_t)s->match_start; if (UNLIKELY(next_match.match_start >= next_match.strstart)) { /* this can happen due to some restarts */ diff --git a/src/native/external/zlib-ng/deflate_p.h b/src/native/external/zlib-ng/deflate_p.h index dd2021a0f59a16..7c74ebf5ad771a 100644 --- a/src/native/external/zlib-ng/deflate_p.h +++ b/src/native/external/zlib-ng/deflate_p.h @@ -1,7 +1,7 @@ /* deflate_p.h -- Private inline functions and macros shared with more than * one deflate method * - * Copyright (C) 1995-2013 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 * */ @@ -60,27 +60,37 @@ extern const unsigned char Z_INTERNAL zng_dist_code[]; static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) { /* c is the unmatched char */ +#ifdef LIT_MEM + s->d_buf[s->sym_next] = 0; + s->l_buf[s->sym_next++] = c; +#else s->sym_buf[s->sym_next++] = 0; s->sym_buf[s->sym_next++] = 0; s->sym_buf[s->sym_next++] = c; +#endif s->dyn_ltree[c].Freq++; Tracevv((stderr, "%c", c)); Assert(c <= (STD_MAX_MATCH-STD_MIN_MATCH), "zng_tr_tally: bad literal"); return (s->sym_next == s->sym_end); } -static inline int zng_tr_tally_dist(deflate_state *s, uint32_t dist, uint32_t len) { +static inline int zng_tr_tally_dist(deflate_state* s, uint32_t dist, uint32_t len) { /* dist: distance of matched string */ /* len: match length-STD_MIN_MATCH */ +#ifdef LIT_MEM + s->d_buf[s->sym_next] = dist; + s->l_buf[s->sym_next++] = len; +#else s->sym_buf[s->sym_next++] = (uint8_t)(dist); s->sym_buf[s->sym_next++] = (uint8_t)(dist >> 8); s->sym_buf[s->sym_next++] = (uint8_t)len; +#endif s->matches++; dist--; Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES, "zng_tr_tally: bad match"); - s->dyn_ltree[zng_length_code[len]+LITERALS+1].Freq++; + s->dyn_ltree[zng_length_code[len] + LITERALS + 1].Freq++; s->dyn_dtree[d_code(dist)].Freq++; return (s->sym_next == s->sym_end); } diff --git a/src/native/external/zlib-ng/deflate_quick.c b/src/native/external/zlib-ng/deflate_quick.c index 6dfd35df510f85..5a1937b6799028 100644 --- a/src/native/external/zlib-ng/deflate_quick.c +++ b/src/native/external/zlib-ng/deflate_quick.c @@ -86,7 +86,7 @@ Z_INTERNAL block_state deflate_quick(deflate_state *s, int flush) { } if (LIKELY(s->lookahead >= WANT_MIN_MATCH)) { - hash_head = functable.quick_insert_string(s, s->strstart); + hash_head = quick_insert_string(s, s->strstart); dist = (int64_t)s->strstart - hash_head; if (dist <= MAX_DIST(s) && dist > 0) { @@ -94,7 +94,7 @@ Z_INTERNAL block_state deflate_quick(deflate_state *s, int flush) { const uint8_t *match_start = s->window + hash_head; if (zng_memcmp_2(str_start, match_start) == 0) { - match_len = functable.compare256(str_start+2, match_start+2) + 2; + match_len = FUNCTABLE_CALL(compare256)(str_start+2, match_start+2) + 2; if (match_len >= WANT_MIN_MATCH) { if (UNLIKELY(match_len > s->lookahead)) @@ -102,8 +102,7 @@ Z_INTERNAL block_state deflate_quick(deflate_state *s, int flush) { if (UNLIKELY(match_len > STD_MAX_MATCH)) match_len = STD_MAX_MATCH; - Assert(s->strstart <= UINT16_MAX, "strstart should fit in uint16_t"); - check_match(s, (Pos)s->strstart, hash_head, match_len); + check_match(s, s->strstart, hash_head, match_len); zng_tr_emit_dist(s, static_ltree, static_dtree, match_len - STD_MIN_MATCH, (uint32_t)dist); s->lookahead -= match_len; diff --git a/src/native/external/zlib-ng/deflate_rle.c b/src/native/external/zlib-ng/deflate_rle.c index 9691b30a85c857..ee442141bea0d3 100644 --- a/src/native/external/zlib-ng/deflate_rle.c +++ b/src/native/external/zlib-ng/deflate_rle.c @@ -1,6 +1,6 @@ /* deflate_rle.c -- compress data using RLE strategy of deflation algorithm * - * Copyright (C) 1995-2013 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 */ @@ -58,9 +58,7 @@ Z_INTERNAL block_state deflate_rle(deflate_state *s, int flush) { /* Emit match if have run of STD_MIN_MATCH or longer, else emit literal */ if (match_len >= STD_MIN_MATCH) { - Assert(s->strstart <= UINT16_MAX, "strstart should fit in uint16_t"); - Assert(s->match_start <= UINT16_MAX, "match_start should fit in uint16_t"); - check_match(s, (Pos)s->strstart, (Pos)s->strstart - 1, match_len); + check_match(s, s->strstart, s->strstart - 1, match_len); bflush = zng_tr_tally_dist(s, 1, match_len - STD_MIN_MATCH); diff --git a/src/native/external/zlib-ng/deflate_slow.c b/src/native/external/zlib-ng/deflate_slow.c index 913d828928bf8e..de70cc1bba0bb4 100644 --- a/src/native/external/zlib-ng/deflate_slow.c +++ b/src/native/external/zlib-ng/deflate_slow.c @@ -1,6 +1,6 @@ /* deflate_slow.c -- compress data using the slow strategy of deflation algorithm * - * Copyright (C) 1995-2013 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 */ @@ -19,12 +19,12 @@ Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) { int bflush; /* set if current block must be flushed */ int64_t dist; uint32_t match_len; - match_func *longest_match; + match_func longest_match; if (s->max_chain_length <= 1024) - longest_match = &functable.longest_match; + longest_match = FUNCTABLE_FPTR(longest_match); else - longest_match = &functable.longest_match_slow; + longest_match = FUNCTABLE_FPTR(longest_match_slow); /* Process the input block. */ for (;;) { @@ -61,7 +61,7 @@ Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) { * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ - match_len = (*longest_match)(s, hash_head); + match_len = longest_match(s, hash_head); /* longest_match() sets match_start */ if (match_len <= 5 && (s->strategy == Z_FILTERED)) { @@ -78,8 +78,7 @@ Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) { unsigned int max_insert = s->strstart + s->lookahead - STD_MIN_MATCH; /* Do not insert strings in hash table beyond this. */ - Assert((s->strstart-1) <= UINT16_MAX, "strstart-1 should fit in uint16_t"); - check_match(s, (Pos)(s->strstart-1), s->prev_match, s->prev_length); + check_match(s, s->strstart-1, s->prev_match, s->prev_length); bflush = zng_tr_tally_dist(s, s->strstart -1 - s->prev_match, s->prev_length - STD_MIN_MATCH); @@ -130,7 +129,7 @@ Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) { } Assert(flush != Z_NO_FLUSH, "no flush?"); if (UNLIKELY(s->match_available)) { - (void) zng_tr_tally_lit(s, s->window[s->strstart-1]); + Z_UNUSED(zng_tr_tally_lit(s, s->window[s->strstart-1])); s->match_available = 0; } s->insert = s->strstart < (STD_MIN_MATCH - 1) ? s->strstart : (STD_MIN_MATCH - 1); diff --git a/src/native/external/zlib-ng/deflate_stored.c b/src/native/external/zlib-ng/deflate_stored.c index 6160896b3fed47..9e5acfbf966109 100644 --- a/src/native/external/zlib-ng/deflate_stored.c +++ b/src/native/external/zlib-ng/deflate_stored.c @@ -1,6 +1,6 @@ /* deflate_stored.c -- store data without compression using deflation algorithm * - * Copyright (C) 1995-2013 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 */ @@ -22,7 +22,7 @@ * * 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. */ Z_INTERNAL block_state deflate_stored(deflate_state *s, int flush) { /* Smallest worthy block size when not flushing or finishing. By default diff --git a/src/native/external/zlib-ng/fallback_builtins.h b/src/native/external/zlib-ng/fallback_builtins.h index 79072a1028ecd1..8303508fa12015 100644 --- a/src/native/external/zlib-ng/fallback_builtins.h +++ b/src/native/external/zlib-ng/fallback_builtins.h @@ -5,9 +5,6 @@ #if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64) || defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC) #include -#ifdef X86_FEATURES -# include "arch/x86/x86_features.h" -#endif /* This is not a general purpose replacement for __builtin_ctz. The function expects that value is != 0. * Because of that assumption trailing_zero is not initialized and the return value is not checked. diff --git a/src/native/external/zlib-ng/functable.c b/src/native/external/zlib-ng/functable.c index 7ca05c98016730..495d11edd20081 100644 --- a/src/native/external/zlib-ng/functable.c +++ b/src/native/external/zlib-ng/functable.c @@ -2,18 +2,16 @@ * Copyright (C) 2017 Hans Kristian Rosbach * For conditions of distribution and use, see copyright notice in zlib.h */ - -#if defined(_MSC_VER) -# include -#endif +#ifndef DISABLE_RUNTIME_CPU_DETECTION #include "zbuild.h" -#include "zendian.h" -#include "crc32_braid_p.h" -#include "deflate.h" -#include "deflate_p.h" #include "functable.h" #include "cpu_features.h" +#include "arch_functions.h" + +#if defined(_MSC_VER) +# include +#endif /* Platform has pointer size atomic store */ #if defined(__GNUC__) || defined(__clang__) @@ -61,31 +59,10 @@ static void init_functable(void) { ft.crc32_fold_final = &crc32_fold_final_c; ft.crc32_fold_reset = &crc32_fold_reset_c; ft.inflate_fast = &inflate_fast_c; - ft.insert_string = &insert_string_c; - ft.quick_insert_string = &quick_insert_string_c; ft.slide_hash = &slide_hash_c; - ft.update_hash = &update_hash_c; - -#if defined(UNALIGNED_OK) && BYTE_ORDER == LITTLE_ENDIAN -# if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) - ft.longest_match = &longest_match_unaligned_64; - ft.longest_match_slow = &longest_match_slow_unaligned_64; - ft.compare256 = &compare256_unaligned_64; -# elif defined(HAVE_BUILTIN_CTZ) - ft.longest_match = &longest_match_unaligned_32; - ft.longest_match_slow = &longest_match_slow_unaligned_32; - ft.compare256 = &compare256_unaligned_32; -# else - ft.longest_match = &longest_match_unaligned_16; - ft.longest_match_slow = &longest_match_slow_unaligned_16; - ft.compare256 = &compare256_unaligned_16; -# endif -#else - ft.longest_match = &longest_match_c; - ft.longest_match_slow = &longest_match_slow_c; - ft.compare256 = &compare256_c; -#endif - + ft.longest_match = &longest_match_generic; + ft.longest_match_slow = &longest_match_slow_generic; + ft.compare256 = &compare256_generic; // Select arch-optimized functions @@ -110,19 +87,14 @@ static void init_functable(void) { #ifdef X86_SSSE3 if (cf.x86.has_ssse3) { ft.adler32 = &adler32_ssse3; -# ifdef X86_SSE2 ft.chunkmemset_safe = &chunkmemset_safe_ssse3; ft.inflate_fast = &inflate_fast_ssse3; -# endif } #endif // X86 - SSE4.2 #ifdef X86_SSE42 if (cf.x86.has_sse42) { ft.adler32_fold_copy = &adler32_fold_copy_sse42; - ft.insert_string = &insert_string_sse42; - ft.quick_insert_string = &quick_insert_string_sse42; - ft.update_hash = &update_hash_sse42; } #endif // X86 - PCLMUL @@ -151,8 +123,9 @@ static void init_functable(void) { # endif } #endif + // X86 - AVX512 (F,DQ,BW,Vl) #ifdef X86_AVX512 - if (cf.x86.has_avx512) { + if (cf.x86.has_avx512_common) { ft.adler32 = &adler32_avx512; ft.adler32_fold_copy = &adler32_fold_copy_avx512; } @@ -164,8 +137,8 @@ static void init_functable(void) { } #endif // X86 - VPCLMULQDQ -#if defined(X86_PCLMULQDQ_CRC) && defined(X86_VPCLMULQDQ_CRC) - if (cf.x86.has_pclmulqdq && cf.x86.has_avx512 && cf.x86.has_vpclmulqdq) { +#ifdef X86_VPCLMULQDQ_CRC + if (cf.x86.has_pclmulqdq && cf.x86.has_avx512_common && cf.x86.has_vpclmulqdq) { ft.crc32 = &crc32_vpclmulqdq; ft.crc32_fold = &crc32_fold_vpclmulqdq; ft.crc32_fold_copy = &crc32_fold_vpclmulqdq_copy; @@ -206,9 +179,6 @@ static void init_functable(void) { #ifdef ARM_ACLE if (cf.arm.has_crc32) { ft.crc32 = &crc32_acle; - ft.insert_string = &insert_string_acle; - ft.quick_insert_string = &quick_insert_string_acle; - ft.update_hash = &update_hash_acle; } #endif @@ -279,12 +249,9 @@ static void init_functable(void) { FUNCTABLE_ASSIGN(ft, crc32_fold_final); FUNCTABLE_ASSIGN(ft, crc32_fold_reset); FUNCTABLE_ASSIGN(ft, inflate_fast); - FUNCTABLE_ASSIGN(ft, insert_string); FUNCTABLE_ASSIGN(ft, longest_match); FUNCTABLE_ASSIGN(ft, longest_match_slow); - FUNCTABLE_ASSIGN(ft, quick_insert_string); FUNCTABLE_ASSIGN(ft, slide_hash); - FUNCTABLE_ASSIGN(ft, update_hash); // Memory barrier for weak memory order CPUs FUNCTABLE_BARRIER(); @@ -350,11 +317,6 @@ static void inflate_fast_stub(PREFIX3(stream) *strm, uint32_t start) { functable.inflate_fast(strm, start); } -static void insert_string_stub(deflate_state* const s, uint32_t str, uint32_t count) { - init_functable(); - functable.insert_string(s, str, count); -} - static uint32_t longest_match_stub(deflate_state* const s, Pos cur_match) { init_functable(); return functable.longest_match(s, cur_match); @@ -365,21 +327,11 @@ static uint32_t longest_match_slow_stub(deflate_state* const s, Pos cur_match) { return functable.longest_match_slow(s, cur_match); } -static Pos quick_insert_string_stub(deflate_state* const s, const uint32_t str) { - init_functable(); - return functable.quick_insert_string(s, str); -} - static void slide_hash_stub(deflate_state* s) { init_functable(); functable.slide_hash(s); } -static uint32_t update_hash_stub(deflate_state* const s, uint32_t h, uint32_t val) { - init_functable(); - return functable.update_hash(s, h, val); -} - /* functable init */ Z_INTERNAL struct functable_s functable = { force_init_stub, @@ -394,10 +346,9 @@ Z_INTERNAL struct functable_s functable = { crc32_fold_final_stub, crc32_fold_reset_stub, inflate_fast_stub, - insert_string_stub, longest_match_stub, longest_match_slow_stub, - quick_insert_string_stub, slide_hash_stub, - update_hash_stub }; + +#endif diff --git a/src/native/external/zlib-ng/functable.h b/src/native/external/zlib-ng/functable.h index 9f78188e10549a..173a030c660d52 100644 --- a/src/native/external/zlib-ng/functable.h +++ b/src/native/external/zlib-ng/functable.h @@ -7,14 +7,21 @@ #define FUNCTABLE_H_ #include "deflate.h" -#include "crc32_fold.h" -#include "adler32_fold.h" +#include "crc32.h" + +#ifdef DISABLE_RUNTIME_CPU_DETECTION + +# include "arch_functions.h" + +/* When compiling with native instructions it is not necessary to use functable. + * Instead we use native_ macro indicating the best available variant of arch-specific + * functions for the current platform. + */ +# define FUNCTABLE_INIT ((void)0) +# define FUNCTABLE_CALL(name) native_ ## name +# define FUNCTABLE_FPTR(name) &native_ ## name -#ifdef ZLIB_COMPAT -typedef struct z_stream_s z_stream; #else -typedef struct zng_stream_s zng_stream; -#endif struct functable_s { void (* force_init) (void); @@ -29,14 +36,20 @@ struct functable_s { uint32_t (* crc32_fold_final) (struct crc32_fold_s *crc); uint32_t (* crc32_fold_reset) (struct crc32_fold_s *crc); void (* inflate_fast) (PREFIX3(stream) *strm, uint32_t start); - void (* insert_string) (deflate_state *const s, uint32_t str, uint32_t count); uint32_t (* longest_match) (deflate_state *const s, Pos cur_match); uint32_t (* longest_match_slow) (deflate_state *const s, Pos cur_match); - Pos (* quick_insert_string)(deflate_state *const s, uint32_t str); void (* slide_hash) (deflate_state *s); - uint32_t (* update_hash) (deflate_state *const s, uint32_t h, uint32_t val); }; Z_INTERNAL extern struct functable_s functable; + +/* Explicitly indicate functions are conditionally dispatched. + */ +# define FUNCTABLE_INIT functable.force_init() +# define FUNCTABLE_CALL(name) functable.name +# define FUNCTABLE_FPTR(name) functable.name + +#endif + #endif diff --git a/src/native/external/zlib-ng/gzguts.h b/src/native/external/zlib-ng/gzguts.h index a663844b693efa..14f2391152a448 100644 --- a/src/native/external/zlib-ng/gzguts.h +++ b/src/native/external/zlib-ng/gzguts.h @@ -1,7 +1,7 @@ #ifndef GZGUTS_H_ #define GZGUTS_H_ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -135,7 +135,9 @@ typedef gz_state *gz_statep; /* shared functions */ void Z_INTERNAL gz_error(gz_state *, int, const char *); - +#ifdef ZLIB_COMPAT +unsigned Z_INTERNAL gz_intmax(void); +#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) */ diff --git a/src/native/external/zlib-ng/gzlib.c b/src/native/external/zlib-ng/gzlib.c index e613837efb52ec..b8a506b6a51f31 100644 --- a/src/native/external/zlib-ng/gzlib.c +++ b/src/native/external/zlib-ng/gzlib.c @@ -1,5 +1,5 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -523,3 +523,9 @@ void Z_INTERNAL gz_error(gz_state *state, int err, const char *msg) { } (void)snprintf(state->msg, strlen(state->path) + strlen(msg) + 3, "%s%s%s", state->path, ": ", msg); } + +#ifdef ZLIB_COMPAT +unsigned Z_INTERNAL gz_intmax(void) { + return INT_MAX; +} +#endif diff --git a/src/native/external/zlib-ng/infback.c b/src/native/external/zlib-ng/infback.c index 9f5042b4d3dcb8..307d05ca3ce036 100644 --- a/src/native/external/zlib-ng/infback.c +++ b/src/native/external/zlib-ng/infback.c @@ -43,10 +43,15 @@ int32_t ZNG_CONDEXPORT PREFIX(inflateBackInit)(PREFIX3(stream) *strm, int32_t wi } if (strm->zfree == NULL) strm->zfree = PREFIX(zcfree); - state = ZALLOC_INFLATE_STATE(strm); - if (state == NULL) + + inflate_allocs *alloc_bufs = alloc_inflate(strm); + if (alloc_bufs == NULL) return Z_MEM_ERROR; + + state = alloc_bufs->state; + state->alloc_bufs = alloc_bufs; Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state *)state; state->dmax = 32768U; state->wbits = (unsigned int)windowBits; @@ -55,7 +60,7 @@ int32_t ZNG_CONDEXPORT PREFIX(inflateBackInit)(PREFIX3(stream) *strm, int32_t wi state->wnext = 0; state->whave = 0; state->sane = 1; - state->chunksize = functable.chunksize(); + state->chunksize = FUNCTABLE_CALL(chunksize)(); return Z_OK; } @@ -357,7 +362,7 @@ int32_t Z_EXPORT PREFIX(inflateBack)(PREFIX3(stream) *strm, in_func in, void *in RESTORE(); if (state->whave < state->wsize) state->whave = state->wsize - left; - functable.inflate_fast(strm, state->wsize); + FUNCTABLE_CALL(inflate_fast)(strm, state->wsize); LOAD(); break; } @@ -504,8 +509,10 @@ int32_t Z_EXPORT PREFIX(inflateBack)(PREFIX3(stream) *strm, in_func in, void *in int32_t Z_EXPORT PREFIX(inflateBackEnd)(PREFIX3(stream) *strm) { if (strm == NULL || strm->state == NULL || strm->zfree == NULL) return Z_STREAM_ERROR; - ZFREE_STATE(strm, strm->state); - strm->state = NULL; + + /* Free allocated buffers */ + free_inflate(strm); + Tracev((stderr, "inflate: end\n")); return Z_OK; } diff --git a/src/native/external/zlib-ng/inflate.c b/src/native/external/zlib-ng/inflate.c index fe55c498e3122c..956f37db7dfb4d 100644 --- a/src/native/external/zlib-ng/inflate.c +++ b/src/native/external/zlib-ng/inflate.c @@ -19,7 +19,7 @@ /* function prototypes */ static int inflateStateCheck(PREFIX3(stream) *strm); -static int updatewindow(PREFIX3(stream) *strm, const uint8_t *end, uint32_t len, int32_t cksum); +static void updatewindow(PREFIX3(stream) *strm, const uint8_t *end, uint32_t len, int32_t cksum); static uint32_t syncsearch(uint32_t *have, const unsigned char *buf, uint32_t len); static inline void inf_chksum_cpy(PREFIX3(stream) *strm, uint8_t *dst, @@ -28,11 +28,11 @@ static inline void inf_chksum_cpy(PREFIX3(stream) *strm, uint8_t *dst, struct inflate_state *state = (struct inflate_state*)strm->state; #ifdef GUNZIP if (state->flags) { - functable.crc32_fold_copy(&state->crc_fold, dst, src, copy); + FUNCTABLE_CALL(crc32_fold_copy)(&state->crc_fold, dst, src, copy); } else #endif { - strm->adler = state->check = functable.adler32_fold_copy(state->check, dst, src, copy); + strm->adler = state->check = FUNCTABLE_CALL(adler32_fold_copy)(state->check, dst, src, copy); } } @@ -40,11 +40,11 @@ static inline void inf_chksum(PREFIX3(stream) *strm, const uint8_t *src, uint32_ struct inflate_state *state = (struct inflate_state*)strm->state; #ifdef GUNZIP if (state->flags) { - functable.crc32_fold(&state->crc_fold, src, len, 0); + FUNCTABLE_CALL(crc32_fold)(&state->crc_fold, src, len, 0); } else #endif { - strm->adler = state->check = functable.adler32(state->check, src, len); + strm->adler = state->check = FUNCTABLE_CALL(adler32)(state->check, src, len); } } @@ -53,7 +53,7 @@ static int inflateStateCheck(PREFIX3(stream) *strm) { if (strm == NULL || strm->zalloc == NULL || strm->zfree == NULL) return 1; state = (struct inflate_state *)strm->state; - if (state == NULL || state->strm != strm || state->mode < HEAD || state->mode > SYNC) + if (state == NULL || state->alloc_bufs == NULL || state->strm != strm || state->mode < HEAD || state->mode > SYNC) return 1; return 0; } @@ -120,13 +120,9 @@ int32_t Z_EXPORT PREFIX(inflateReset2)(PREFIX3(stream) *strm, int32_t windowBits #endif } - /* set number of window bits, free window if different */ + /* set number of window bits */ if (windowBits && (windowBits < MIN_WBITS || windowBits > MAX_WBITS)) return Z_STREAM_ERROR; - if (state->window != NULL && state->wbits != (unsigned)windowBits) { - ZFREE_WINDOW(strm, state->window); - state->window = NULL; - } /* update state and reset the rest of it */ state->wrap = wrap; @@ -134,13 +130,94 @@ int32_t Z_EXPORT PREFIX(inflateReset2)(PREFIX3(stream) *strm, int32_t windowBits return PREFIX(inflateReset)(strm); } -/* This function is hidden in ZLIB_COMPAT builds. */ +#ifdef INF_ALLOC_DEBUG +# include +# define LOGSZ(name,size) fprintf(stderr, "%s is %d bytes\n", name, size) +# define LOGSZP(name,size,loc,pad) fprintf(stderr, "%s is %d bytes, offset %d, padded %d\n", name, size, loc, pad) +# define LOGSZPL(name,size,loc,pad) fprintf(stderr, "%s is %d bytes, offset %ld, padded %d\n", name, size, loc, pad) +#else +# define LOGSZ(name,size) +# define LOGSZP(name,size,loc,pad) +# define LOGSZPL(name,size,loc,pad) +#endif + +/* =========================================================================== + * Allocate a big buffer and divide it up into the various buffers inflate needs. + * Handles alignment of allocated buffer and alignment of individual buffers. + */ +Z_INTERNAL inflate_allocs* alloc_inflate(PREFIX3(stream) *strm) { + int curr_size = 0; + + /* Define sizes */ + int window_size = INFLATE_ADJUST_WINDOW_SIZE((1 << MAX_WBITS) + 64); /* 64B padding for chunksize */ + int state_size = sizeof(inflate_state); + int alloc_size = sizeof(inflate_allocs); + + /* Calculate relative buffer positions and paddings */ + LOGSZP("window", window_size, PAD_WINDOW(curr_size), PADSZ(curr_size,WINDOW_PAD_SIZE)); + int window_pos = PAD_WINDOW(curr_size); + curr_size = window_pos + window_size; + + LOGSZP("state", state_size, PAD_64(curr_size), PADSZ(curr_size,64)); + int state_pos = PAD_64(curr_size); + curr_size = state_pos + state_size; + + LOGSZP("alloc", alloc_size, PAD_16(curr_size), PADSZ(curr_size,16)); + int alloc_pos = PAD_16(curr_size); + curr_size = alloc_pos + alloc_size; + + /* Add 64-1 or 4096-1 to allow window alignment, and round size of buffer up to multiple of 64 */ + int total_size = PAD_64(curr_size + (WINDOW_PAD_SIZE - 1)); + + /* Allocate buffer, align to 64-byte cacheline, and zerofill the resulting buffer */ + char *original_buf = strm->zalloc(strm->opaque, 1, total_size); + if (original_buf == NULL) + return NULL; + + char *buff = (char *)HINT_ALIGNED_WINDOW((char *)PAD_WINDOW(original_buf)); + LOGSZPL("Buffer alloc", total_size, PADSZ((uintptr_t)original_buf,WINDOW_PAD_SIZE), PADSZ(curr_size,WINDOW_PAD_SIZE)); + + /* Initialize alloc_bufs */ + inflate_allocs *alloc_bufs = (struct inflate_allocs_s *)(buff + alloc_pos); + alloc_bufs->buf_start = (char *)original_buf; + alloc_bufs->zfree = strm->zfree; + + alloc_bufs->window = (unsigned char *)HINT_ALIGNED_WINDOW((buff + window_pos)); + alloc_bufs->state = (inflate_state *)HINT_ALIGNED_64((buff + state_pos)); + +#ifdef Z_MEMORY_SANITIZER + /* This is _not_ to subvert the memory sanitizer but to instead unposion some + data we willingly and purposefully load uninitialized into vector registers + in order to safely read the last < chunksize bytes of the window. */ + __msan_unpoison(alloc_bufs->window + window_size, 64); +#endif + + return alloc_bufs; +} + +/* =========================================================================== + * Free all allocated inflate buffers + */ +Z_INTERNAL void free_inflate(PREFIX3(stream) *strm) { + struct inflate_state *state = (struct inflate_state *)strm->state; + + if (state->alloc_bufs != NULL) { + inflate_allocs *alloc_bufs = state->alloc_bufs; + alloc_bufs->zfree(strm->opaque, alloc_bufs->buf_start); + strm->state = NULL; + } +} + +/* =========================================================================== + * Initialize inflate state and buffers. + * This function is hidden in ZLIB_COMPAT builds. + */ int32_t ZNG_CONDEXPORT PREFIX(inflateInit2)(PREFIX3(stream) *strm, int32_t windowBits) { int32_t ret; struct inflate_state *state; - /* Initialize functable earlier. */ - functable.force_init(); + /* Initialize functable */ + FUNCTABLE_INIT; if (strm == NULL) return Z_STREAM_ERROR; @@ -151,19 +228,23 @@ int32_t ZNG_CONDEXPORT PREFIX(inflateInit2)(PREFIX3(stream) *strm, int32_t windo } if (strm->zfree == NULL) strm->zfree = PREFIX(zcfree); - state = ZALLOC_INFLATE_STATE(strm); - if (state == NULL) + + inflate_allocs *alloc_bufs = alloc_inflate(strm); + if (alloc_bufs == NULL) return Z_MEM_ERROR; + + state = alloc_bufs->state; + state->window = alloc_bufs->window; + state->alloc_bufs = alloc_bufs; Tracev((stderr, "inflate: allocated\n")); + strm->state = (struct internal_state *)state; state->strm = strm; - state->window = NULL; state->mode = HEAD; /* to pass state test in inflateReset2() */ - state->chunksize = functable.chunksize(); + state->chunksize = FUNCTABLE_CALL(chunksize)(); ret = PREFIX(inflateReset2)(strm, windowBits); if (ret != Z_OK) { - ZFREE_STATE(strm, state); - strm->state = NULL; + free_inflate(strm); } return ret; } @@ -222,31 +303,6 @@ void Z_INTERNAL PREFIX(fixedtables)(struct inflate_state *state) { state->distbits = 5; } -int Z_INTERNAL PREFIX(inflate_ensure_window)(struct inflate_state *state) { - /* if it hasn't been done already, allocate space for the window */ - if (state->window == NULL) { - unsigned wsize = 1U << state->wbits; - state->window = (unsigned char *)ZALLOC_WINDOW(state->strm, wsize + state->chunksize, sizeof(unsigned char)); - if (state->window == NULL) - return Z_MEM_ERROR; -#ifdef Z_MEMORY_SANITIZER - /* This is _not_ to subvert the memory sanitizer but to instead unposion some - data we willingly and purposefully load uninitialized into vector registers - in order to safely read the last < chunksize bytes of the window. */ - __msan_unpoison(state->window + wsize, state->chunksize); -#endif - } - - /* if window not in use yet, initialize */ - if (state->wsize == 0) { - state->wsize = 1U << state->wbits; - state->wnext = 0; - state->whave = 0; - } - - return Z_OK; -} - /* Update the window with the last wsize (normally 32K) bytes written before returning. If window does not exist yet, create it. This is only called @@ -261,20 +317,20 @@ int Z_INTERNAL PREFIX(inflate_ensure_window)(struct inflate_state *state) { 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. */ -static int32_t updatewindow(PREFIX3(stream) *strm, const uint8_t *end, uint32_t len, int32_t cksum) { +static void updatewindow(PREFIX3(stream) *strm, const uint8_t *end, uint32_t len, int32_t cksum) { struct inflate_state *state; uint32_t dist; state = (struct inflate_state *)strm->state; - if (PREFIX(inflate_ensure_window)(state)) return 1; + /* if window not in use yet, initialize */ + if (state->wsize == 0) + state->wsize = 1U << state->wbits; /* len state->wsize or less output bytes into the circular window */ if (len >= state->wsize) { /* Only do this if the caller specifies to checksum bytes AND the platform requires - * it (s/390 being the primary exception to this. Also, for now, do the adler checksums - * if not a gzip based header. The inline adler checksums will come in the near future, - * possibly the next commit */ + * it (s/390 being the primary exception to this) */ if (INFLATE_NEED_CHECKSUM(strm) && cksum) { /* We have to split the checksum over non-copied and copied bytes */ if (len > state->wsize) @@ -314,7 +370,6 @@ static int32_t updatewindow(PREFIX3(stream) *strm, const uint8_t *end, uint32_t state->whave += dist; } } - return 0; } /* @@ -636,7 +691,7 @@ int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) { } /* compute crc32 checksum if not in raw mode */ if ((state->wrap & 4) && state->flags) - strm->adler = state->check = functable.crc32_fold_reset(&state->crc_fold); + strm->adler = state->check = FUNCTABLE_CALL(crc32_fold_reset)(&state->crc_fold); state->mode = TYPE; break; #endif @@ -867,7 +922,7 @@ int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) { /* use inflate_fast() if we have enough input and output */ if (have >= INFLATE_FAST_MIN_HAVE && left >= INFLATE_FAST_MIN_LEFT) { RESTORE(); - functable.inflate_fast(strm, out); + FUNCTABLE_CALL(inflate_fast)(strm, out); LOAD(); if (state->mode == TYPE) state->back = -1; @@ -1026,7 +1081,7 @@ int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) { } else { copy = MIN(state->length, left); - put = functable.chunkmemset_safe(put, state->offset, copy, left); + put = FUNCTABLE_CALL(chunkmemset_safe)(put, state->offset, copy, left); } left -= copy; state->length -= copy; @@ -1056,7 +1111,7 @@ int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) { } #ifdef GUNZIP if (state->flags) - strm->adler = state->check = functable.crc32_fold_final(&state->crc_fold); + strm->adler = state->check = FUNCTABLE_CALL(crc32_fold_final)(&state->crc_fold); #endif } out = left; @@ -1098,9 +1153,6 @@ int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) { ret = Z_DATA_ERROR; goto inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: default: /* can't happen, but makes compilers happy */ @@ -1111,7 +1163,6 @@ int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) { Return from inflate(), updating the total counts and the check value. If there was no progress during the inflate() call, return a buffer error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. */ inf_leave: RESTORE(); @@ -1120,10 +1171,7 @@ int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) { (state->wsize || (out != strm->avail_out && state->mode < BAD && (state->mode < CHECK || flush != Z_FINISH)))) { /* update sliding window with respective checksum if not in "raw" mode */ - if (updatewindow(strm, strm->next_out, check_bytes, state->wrap & 4)) { - state->mode = MEM; - return Z_MEM_ERROR; - } + updatewindow(strm, strm->next_out, check_bytes, state->wrap & 4); } in -= strm->avail_in; out -= strm->avail_out; @@ -1144,14 +1192,12 @@ int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) { } int32_t Z_EXPORT PREFIX(inflateEnd)(PREFIX3(stream) *strm) { - struct inflate_state *state; if (inflateStateCheck(strm)) return Z_STREAM_ERROR; - state = (struct inflate_state *)strm->state; - if (state->window != NULL) - ZFREE_WINDOW(strm, state->window); - ZFREE_STATE(strm, strm->state); - strm->state = NULL; + + /* Free allocated buffers */ + free_inflate(strm); + Tracev((stderr, "inflate: end\n")); return Z_OK; } @@ -1179,7 +1225,6 @@ int32_t Z_EXPORT PREFIX(inflateGetDictionary)(PREFIX3(stream) *strm, uint8_t *di int32_t Z_EXPORT PREFIX(inflateSetDictionary)(PREFIX3(stream) *strm, const uint8_t *dictionary, uint32_t dictLength) { struct inflate_state *state; unsigned long dictid; - int32_t ret; /* check state */ if (inflateStateCheck(strm)) @@ -1190,7 +1235,7 @@ int32_t Z_EXPORT PREFIX(inflateSetDictionary)(PREFIX3(stream) *strm, const uint8 /* check for correct dictionary identifier */ if (state->mode == DICT) { - dictid = functable.adler32(ADLER32_INITIAL_VALUE, dictionary, dictLength); + dictid = FUNCTABLE_CALL(adler32)(ADLER32_INITIAL_VALUE, dictionary, dictLength); if (dictid != state->check) return Z_DATA_ERROR; } @@ -1199,11 +1244,8 @@ int32_t Z_EXPORT PREFIX(inflateSetDictionary)(PREFIX3(stream) *strm, const uint8 /* copy dictionary to window using updatewindow(), which will amend the existing dictionary if appropriate */ - ret = updatewindow(strm, dictionary + dictLength, dictLength, 0); - if (ret) { - state->mode = MEM; - return Z_MEM_ERROR; - } + updatewindow(strm, dictionary + dictLength, dictLength, 0); + state->havedict = 1; Tracev((stderr, "inflate: dictionary set\n")); return Z_OK; @@ -1271,7 +1313,7 @@ int32_t Z_EXPORT PREFIX(inflateSync)(PREFIX3(stream) *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) { @@ -1334,30 +1376,28 @@ int32_t Z_EXPORT PREFIX(inflateCopy)(PREFIX3(stream) *dest, PREFIX3(stream) *sou return Z_STREAM_ERROR; state = (struct inflate_state *)source->state; + /* copy stream */ + memcpy((void *)dest, (void *)source, sizeof(PREFIX3(stream))); + /* allocate space */ - copy = ZALLOC_INFLATE_STATE(source); - if (copy == NULL) + inflate_allocs *alloc_bufs = alloc_inflate(dest); + if (alloc_bufs == NULL) return Z_MEM_ERROR; + copy = alloc_bufs->state; /* copy state */ - memcpy((void *)dest, (void *)source, sizeof(PREFIX3(stream))); - ZCOPY_INFLATE_STATE(copy, state); + memcpy(copy, state, sizeof(struct inflate_state)); copy->strm = dest; if (state->lencode >= state->codes && state->lencode <= state->codes + ENOUGH - 1) { copy->lencode = copy->codes + (state->lencode - state->codes); copy->distcode = copy->codes + (state->distcode - state->codes); } copy->next = copy->codes + (state->next - state->codes); + copy->window = alloc_bufs->window; + copy->alloc_bufs = alloc_bufs; /* window */ - copy->window = NULL; - if (state->window != NULL) { - if (PREFIX(inflate_ensure_window)(copy)) { - ZFREE_STATE(source, copy); - return Z_MEM_ERROR; - } - ZCOPY_WINDOW(copy->window, state->window, (size_t)state->wsize); - } + memcpy(copy->window, state->window, INFLATE_ADJUST_WINDOW_SIZE((size_t)state->wsize)); dest->state = (struct internal_state *)copy; return Z_OK; diff --git a/src/native/external/zlib-ng/inflate.h b/src/native/external/zlib-ng/inflate.h index 39cdf5d683c39e..536da7d1f8fce0 100644 --- a/src/native/external/zlib-ng/inflate.h +++ b/src/native/external/zlib-ng/inflate.h @@ -11,8 +11,12 @@ #ifndef INFLATE_H_ #define INFLATE_H_ -#include "adler32_fold.h" -#include "crc32_fold.h" +#include "crc32.h" + +#ifdef S390_DFLTCC_INFLATE +# include "arch/s390/dfltcc_common.h" +# define HAVE_ARCH_INFLATE_STATE +#endif /* define NO_GZIP when compiling if you want to disable gzip header and trailer decoding by inflate(). NO_GZIP would be used to avoid linking in the crc code when it is not needed. @@ -53,14 +57,13 @@ typedef enum { LENGTH, /* i: waiting for 32-bit length (gzip) */ DONE, /* finished check, done -- remain here until reset */ BAD, /* got a data error -- remain here until reset */ - MEM, /* got an inflate() memory error -- remain here until reset */ SYNC /* looking for synchronization bytes to restart inflate() */ } inflate_mode; /* State transitions between above modes - - (most modes can go to BAD or MEM on error -- not shown for clarity) + (most modes can go to BAD on error -- not shown for clarity) Process header: HEAD -> (gzip) or (zlib) or (raw) @@ -81,10 +84,19 @@ typedef enum { Process trailer: CHECK -> LENGTH -> DONE */ +typedef struct inflate_state inflate_state; + +/* Struct for memory allocation handling */ +typedef struct inflate_allocs_s { + char *buf_start; + free_func zfree; + inflate_state *state; + unsigned char *window; +} inflate_allocs; /* State maintained between inflate() calls -- approximately 7K bytes, not including the allocated sliding window, which is up to 32K bytes. */ -struct inflate_state { +struct ALIGNED_(64) inflate_state { PREFIX3(stream) *strm; /* pointer back to this zlib stream */ inflate_mode mode; /* current inflate mode */ int last; /* true if processing last block */ @@ -132,9 +144,14 @@ struct inflate_state { int back; /* bits back of last unprocessed length/lit */ unsigned was; /* initial length of match */ uint32_t chunksize; /* size of memory copying chunk */ + inflate_allocs *alloc_bufs; /* struct for handling memory allocations */ +#ifdef HAVE_ARCH_INFLATE_STATE + arch_inflate_state arch; /* architecture-specific extensions */ +#endif }; -int Z_INTERNAL PREFIX(inflate_ensure_window)(struct inflate_state *state); void Z_INTERNAL PREFIX(fixedtables)(struct inflate_state *state); +Z_INTERNAL inflate_allocs* alloc_inflate(PREFIX3(stream) *strm); +Z_INTERNAL void free_inflate(PREFIX3(stream) *strm); #endif /* INFLATE_H_ */ diff --git a/src/native/external/zlib-ng/inflate_p.h b/src/native/external/zlib-ng/inflate_p.h index eff73876daf25e..c324b0486a1404 100644 --- a/src/native/external/zlib-ng/inflate_p.h +++ b/src/native/external/zlib-ng/inflate_p.h @@ -10,15 +10,16 @@ /* Architecture-specific hooks. */ #ifdef S390_DFLTCC_INFLATE # include "arch/s390/dfltcc_inflate.h" +/* DFLTCC instructions require window to be page-aligned */ +# define PAD_WINDOW PAD_4096 +# define WINDOW_PAD_SIZE 4096 +# define HINT_ALIGNED_WINDOW HINT_ALIGNED_4096 #else -/* Memory management for the inflate state. Useful for allocating arch-specific extension blocks. */ -# define ZALLOC_INFLATE_STATE(strm) ((struct inflate_state *)ZALLOC(strm, 1, sizeof(struct inflate_state))) -# define ZFREE_STATE(strm, addr) ZFREE(strm, addr) -# define ZCOPY_INFLATE_STATE(dst, src) memcpy(dst, src, sizeof(struct inflate_state)) -/* Memory management for the window. Useful for allocation the aligned window. */ -# define ZALLOC_WINDOW(strm, items, size) ZALLOC(strm, items, size) -# define ZCOPY_WINDOW(dest, src, n) memcpy(dest, src, n) -# define ZFREE_WINDOW(strm, addr) ZFREE(strm, addr) +# define PAD_WINDOW PAD_64 +# define WINDOW_PAD_SIZE 64 +# define HINT_ALIGNED_WINDOW HINT_ALIGNED_64 +/* Adjust the window size for the arch-specific inflate code. */ +# define INFLATE_ADJUST_WINDOW_SIZE(n) (n) /* Invoked at the end of inflateResetKeep(). Useful for initializing arch-specific extension blocks. */ # define INFLATE_RESET_KEEP_HOOK(strm) do {} while (0) /* Invoked at the beginning of inflatePrime(). Useful for updating arch-specific buffers. */ @@ -46,9 +47,9 @@ /* check function to use adler32() for zlib or crc32() for gzip */ #ifdef GUNZIP # define UPDATE(check, buf, len) \ - (state->flags ? PREFIX(crc32)(check, buf, len) : functable.adler32(check, buf, len)) + (state->flags ? PREFIX(crc32)(check, buf, len) : FUNCTABLE_CALL(adler32)(check, buf, len)) #else -# define UPDATE(check, buf, len) functable.adler32(check, buf, len) +# define UPDATE(check, buf, len) FUNCTABLE_CALL(adler32)(check, buf, len) #endif /* check macros for header crc */ diff --git a/src/native/external/zlib-ng/inftrees.c b/src/native/external/zlib-ng/inftrees.c index 423f7b461d7c66..5234fe7ae0cdd5 100644 --- a/src/native/external/zlib-ng/inftrees.c +++ b/src/native/external/zlib-ng/inftrees.c @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2023 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -7,7 +7,7 @@ #include "zutil.h" #include "inftrees.h" -const char PREFIX(inflate_copyright)[] = " inflate 1.3.0 Copyright 1995-2023 Mark Adler "; +const char PREFIX(inflate_copyright)[] = " 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 @@ -54,7 +54,7 @@ int Z_INTERNAL zng_inflate_table(codetype type, uint16_t *lens, unsigned codes, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const uint16_t 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 uint16_t 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/native/external/zlib-ng/insert_string.c b/src/native/external/zlib-ng/insert_string.c index cfe39837f86a54..11a5b97ffe86f3 100644 --- a/src/native/external/zlib-ng/insert_string.c +++ b/src/native/external/zlib-ng/insert_string.c @@ -1,6 +1,6 @@ /* insert_string.c -- insert_string integer hash variant * - * Copyright (C) 1995-2013 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 * */ @@ -10,12 +10,12 @@ #define HASH_SLIDE 16 -#define HASH_CALC(s, h, val) h = ((val * 2654435761U) >> HASH_SLIDE); +#define HASH_CALC(h, val) h = ((val * 2654435761U) >> HASH_SLIDE); #define HASH_CALC_VAR h #define HASH_CALC_VAR_INIT uint32_t h = 0 -#define UPDATE_HASH update_hash_c -#define INSERT_STRING insert_string_c -#define QUICK_INSERT_STRING quick_insert_string_c +#define UPDATE_HASH update_hash +#define INSERT_STRING insert_string +#define QUICK_INSERT_STRING quick_insert_string #include "insert_string_tpl.h" diff --git a/src/native/external/zlib-ng/insert_string_roll.c b/src/native/external/zlib-ng/insert_string_roll.c index dfea347bccb75a..8693f96f59021e 100644 --- a/src/native/external/zlib-ng/insert_string_roll.c +++ b/src/native/external/zlib-ng/insert_string_roll.c @@ -1,6 +1,6 @@ /* insert_string_roll.c -- insert_string rolling hash variant * - * Copyright (C) 1995-2013 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 * */ @@ -10,7 +10,7 @@ #define HASH_SLIDE 5 -#define HASH_CALC(s, h, val) h = ((h << HASH_SLIDE) ^ ((uint8_t)val)) +#define HASH_CALC(h, val) h = ((h << HASH_SLIDE) ^ ((uint8_t)val)) #define HASH_CALC_VAR s->ins_h #define HASH_CALC_VAR_INIT #define HASH_CALC_READ val = strstart[0] diff --git a/src/native/external/zlib-ng/insert_string_tpl.h b/src/native/external/zlib-ng/insert_string_tpl.h index c84617730ac375..281c0134631048 100644 --- a/src/native/external/zlib-ng/insert_string_tpl.h +++ b/src/native/external/zlib-ng/insert_string_tpl.h @@ -1,10 +1,10 @@ #ifndef INSERT_STRING_H_ #define INSERT_STRING_H_ -/* insert_string.h -- Private insert_string functions shared with more than - * one insert string implementation +/* insert_string_tpl.h -- Private insert_string functions shared with more than + * one insert string implementation * - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler * * Copyright (C) 2013 Intel Corporation. All rights reserved. * Authors: @@ -47,9 +47,8 @@ * input characters, so that a running hash key can be computed from the * previous key instead of complete recalculation each time. */ -Z_INTERNAL uint32_t UPDATE_HASH(deflate_state *const s, uint32_t h, uint32_t val) { - (void)s; - HASH_CALC(s, h, val); +Z_INTERNAL uint32_t UPDATE_HASH(uint32_t h, uint32_t val) { + HASH_CALC(h, val); return h & HASH_CALC_MASK; } @@ -65,7 +64,7 @@ Z_INTERNAL Pos QUICK_INSERT_STRING(deflate_state *const s, uint32_t str) { HASH_CALC_VAR_INIT; HASH_CALC_READ; - HASH_CALC(s, HASH_CALC_VAR, val); + HASH_CALC(HASH_CALC_VAR, val); HASH_CALC_VAR &= HASH_CALC_MASK; hm = HASH_CALC_VAR; @@ -94,7 +93,7 @@ Z_INTERNAL void INSERT_STRING(deflate_state *const s, uint32_t str, uint32_t cou HASH_CALC_VAR_INIT; HASH_CALC_READ; - HASH_CALC(s, HASH_CALC_VAR, val); + HASH_CALC(HASH_CALC_VAR, val); HASH_CALC_VAR &= HASH_CALC_MASK; hm = HASH_CALC_VAR; diff --git a/src/native/external/zlib-ng/match_tpl.h b/src/native/external/zlib-ng/match_tpl.h index d076798520eeda..9c258242cd7640 100644 --- a/src/native/external/zlib-ng/match_tpl.h +++ b/src/native/external/zlib-ng/match_tpl.h @@ -1,6 +1,6 @@ /* match_tpl.h -- find longest match template for compare256 variants * - * Copyright (C) 1995-2013 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 * * Portions copyright (C) 2014-2021 Konstantin Nosov @@ -8,11 +8,6 @@ * https://github.com/gildor2/fast_zlib */ -#include "zbuild.h" -#include "zutil_p.h" -#include "deflate.h" -#include "functable.h" - #ifndef MATCH_TPL_H #define MATCH_TPL_H @@ -107,11 +102,11 @@ Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) { * to cur_match). We cannot use s->prev[strstart+1,...] immediately, because * these strings are not yet inserted into the hash table. */ - hash = s->update_hash(s, 0, scan[1]); - hash = s->update_hash(s, hash, scan[2]); + hash = s->update_hash(0, scan[1]); + hash = s->update_hash(hash, scan[2]); for (i = 3; i <= best_len; i++) { - hash = s->update_hash(s, hash, scan[i]); + hash = s->update_hash(hash, scan[i]); /* If we're starting with best_len >= 3, we can use offset search. */ pos = s->head[hash]; @@ -241,9 +236,9 @@ Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) { */ scan_endstr = scan + len - (STD_MIN_MATCH+1); - hash = s->update_hash(s, 0, scan_endstr[0]); - hash = s->update_hash(s, hash, scan_endstr[1]); - hash = s->update_hash(s, hash, scan_endstr[2]); + hash = s->update_hash(0, scan_endstr[0]); + hash = s->update_hash(hash, scan_endstr[1]); + hash = s->update_hash(hash, scan_endstr[2]); pos = s->head[hash]; if (pos < cur_match) { diff --git a/src/native/external/zlib-ng/tools/makecrct.c b/src/native/external/zlib-ng/tools/makecrct.c index 5c3ba58a1a6237..9e65d2495475f3 100644 --- a/src/native/external/zlib-ng/tools/makecrct.c +++ b/src/native/external/zlib-ng/tools/makecrct.c @@ -21,9 +21,6 @@ static uint32_t crc_table[256]; static z_word_t crc_big_table[256]; - -static uint32_t crc_braid_table[W][256]; -static z_word_t crc_braid_big_table[W][256]; static uint32_t x2n_table[32]; #include "crc32_braid_comb_p.h" @@ -80,9 +77,6 @@ static void make_crc_table(void) { x2n_table[0] = p; for (n = 1; n < 32; n++) x2n_table[n] = p = multmodp(p, p); - - /* initialize the braiding tables -- needs x2n_table[] */ - braid(crc_braid_table, crc_braid_big_table, N, W); } /* diff --git a/src/native/external/zlib-ng/trees.c b/src/native/external/zlib-ng/trees.c index 5bb88389baa331..9f2f49137f08a4 100644 --- a/src/native/external/zlib-ng/trees.c +++ b/src/native/external/zlib-ng/trees.c @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2021 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 */ @@ -75,7 +75,6 @@ static int build_bl_tree (deflate_state *s); static void send_all_trees (deflate_state *s, int lcodes, int dcodes, int blcodes); static void compress_block (deflate_state *s, const ct_data *ltree, const ct_data *dtree); static int detect_data_type (deflate_state *s); -static void bi_flush (deflate_state *s); /* =========================================================================== * Initialize the tree data structures for a new zlib stream. @@ -609,13 +608,6 @@ void Z_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored } } -/* =========================================================================== - * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) - */ -void Z_INTERNAL zng_tr_flush_bits(deflate_state *s) { - bi_flush(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. @@ -623,7 +615,7 @@ void Z_INTERNAL zng_tr_flush_bits(deflate_state *s) { void Z_INTERNAL zng_tr_align(deflate_state *s) { zng_tr_emit_tree(s, STATIC_TREES, 0); zng_tr_emit_end_block(s, static_ltree, 0); - bi_flush(s); + zng_tr_flush_bits(s); } /* =========================================================================== @@ -718,21 +710,30 @@ static void compress_block(deflate_state *s, const ct_data *ltree, const ct_data /* dtree: distance tree */ unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ - unsigned sx = 0; /* running index in sym_buf */ + unsigned sx = 0; /* running index in symbol buffers */ 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) { zng_emit_lit(s, ltree, lc); } else { zng_emit_dist(s, ltree, dtree, lc, dist); } /* literal or match pair ? */ - /* Check that the overlay between pending_buf and sym_buf is ok: */ + /* Check for no overlay of pending_buf on needed symbols */ +#ifdef LIT_MEM + Assert(s->pending < 2 * (s->lit_bufsize + sx), "pending_buf overflow"); +#else Assert(s->pending < s->lit_bufsize + sx, "pending_buf overflow"); +#endif } while (sx < s->sym_next); } @@ -781,27 +782,26 @@ static int detect_data_type(deflate_state *s) { /* =========================================================================== * Flush the bit buffer, keeping at most 7 bits in it. */ -static void bi_flush(deflate_state *s) { - if (s->bi_valid == 64) { - put_uint64(s, s->bi_buf); - s->bi_buf = 0; - s->bi_valid = 0; - } else { - if (s->bi_valid >= 32) { - put_uint32(s, (uint32_t)s->bi_buf); - s->bi_buf >>= 32; - s->bi_valid -= 32; - } - if (s->bi_valid >= 16) { - put_short(s, (uint16_t)s->bi_buf); - s->bi_buf >>= 16; - s->bi_valid -= 16; - } - if (s->bi_valid >= 8) { - put_byte(s, s->bi_buf); - s->bi_buf >>= 8; - s->bi_valid -= 8; - } +void Z_INTERNAL zng_tr_flush_bits(deflate_state *s) { + if (s->bi_valid >= 48) { + put_uint32(s, (uint32_t)s->bi_buf); + put_short(s, (uint16_t)(s->bi_buf >> 32)); + s->bi_buf >>= 48; + s->bi_valid -= 48; + } else if (s->bi_valid >= 32) { + put_uint32(s, (uint32_t)s->bi_buf); + s->bi_buf >>= 32; + s->bi_valid -= 32; + } + if (s->bi_valid >= 16) { + put_short(s, (uint16_t)s->bi_buf); + s->bi_buf >>= 16; + s->bi_valid -= 16; + } + if (s->bi_valid >= 8) { + put_byte(s, s->bi_buf); + s->bi_buf >>= 8; + s->bi_valid -= 8; } } diff --git a/src/native/external/zlib-ng/win32/Makefile.a64 b/src/native/external/zlib-ng/win32/Makefile.a64 index 2a0f3cfe4e7b2e..9f8d6fb7facca3 100644 --- a/src/native/external/zlib-ng/win32/Makefile.a64 +++ b/src/native/external/zlib-ng/win32/Makefile.a64 @@ -1,5 +1,5 @@ # Makefile for zlib using Microsoft (Visual) C -# zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler +# zlib is copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler # # Usage: # nmake -f win32/Makefile.a64 (standard build) @@ -23,13 +23,14 @@ LD = link AR = lib RC = rc CP = copy /y -CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) +INCLUDES = -I$(TOP) -I$(TOP)/arch/arm -I$(TOP)/arch/generic +CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) $(INCLUDES) WFLAGS = \ -D_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 \ -D_CRT_SECURE_NO_DEPRECATE \ -D_CRT_NONSTDC_NO_DEPRECATE \ - -DARM_NEON_HASLD4 \ -DARM_FEATURES \ + -DARM_NEON_HASLD4 \ # LDFLAGS = -nologo -debug -incremental:no -opt:ref -manifest ARFLAGS = -nologo @@ -43,20 +44,22 @@ SUFFIX = OBJS = \ adler32.obj \ - adler32_fold.obj \ + adler32_c.obj \ + adler32_fold_c.obj \ arm_features.obj \ - chunkset.obj \ - compare256.obj \ + chunkset_c.obj \ + compare256_c.obj \ compress.obj \ cpu_features.obj \ - crc32_braid.obj \ + crc32.obj \ + crc32_braid_c.obj \ crc32_braid_comb.obj \ - crc32_fold.obj \ + crc32_fold_c.obj \ deflate.obj \ deflate_fast.obj \ deflate_huff.obj \ - deflate_quick.obj \ deflate_medium.obj \ + deflate_quick.obj \ deflate_rle.obj \ deflate_slow.obj \ deflate_stored.obj \ @@ -66,7 +69,7 @@ OBJS = \ inftrees.obj \ insert_string.obj \ insert_string_roll.obj \ - slide_hash.obj \ + slide_hash_c.obj \ trees.obj \ uncompr.obj \ zutil.obj \ @@ -96,7 +99,7 @@ WFLAGS = $(WFLAGS) \ -DARM_NEON \ -DARM_NOCHECK_NEON \ # -OBJS = $(OBJS) crc32_acle.obj insert_string_acle.obj adler32_neon.obj chunkset_neon.obj compare256_neon.obj slide_hash_neon.obj +OBJS = $(OBJS) crc32_acle.obj adler32_neon.obj chunkset_neon.obj compare256_neon.obj slide_hash_neon.obj # targets all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \ @@ -156,57 +159,59 @@ minigzip_d.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) {$(TOP)}.c.obj: $(CC) -c $(WFLAGS) $(CFLAGS) $< -gzlib2.obj: gzlib.c +gzlib2.obj: gzlib.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzlib2.obj gzlib.c -gzread2.obj: gzread.c +gzread2.obj: gzread.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzread2.obj gzread.c -gzwrite2.obj: gzwrite.c +gzwrite2.obj: gzwrite.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzwrite2.obj gzwrite.c {$(TOP)/arch/arm}.c.obj: $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< +{$(TOP)/arch/generic}.c.obj: + $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< + {$(TOP)/test}.c.obj: $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP $< $(TOP)/zconf$(SUFFIX).h: zconf -SRCDIR = $(TOP) -# Keep the dependences in sync with top-level Makefile.in -adler32.obj: $(SRCDIR)/adler32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/functable.h $(SRCDIR)/adler32_p.h -adler32_fold.obj: $(SRCDIR)/adler32_fold.c $(SRCDIR)/zbuild.h $(SRCDIR)/adler32_fold.h $(SRCDIR)/functable.h -chunkset.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -functable.obj: $(SRCDIR)/functable.c $(SRCDIR)/zbuild.h $(SRCDIR)/functable.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/zendian.h $(SRCDIR)/arch/x86/x86_features.h -gzlib.obj: $(SRCDIR)/gzlib.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzread.obj: $(SRCDIR)/gzread.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzwrite.obj: $(SRCDIR)/gzwrite.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -compress.obj: $(SRCDIR)/compress.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -uncompr.obj: $(SRCDIR)/uncompr.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -cpu_features.obj: $(SRCDIR)/cpu_features.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -crc32_braid.obj: $(SRCDIR)/crc32_braid.c $(SRCDIR)/zbuild.h $(SRCDIR)/zendian.h $(SRCDIR)/deflate.h $(SRCDIR)/functable.h $(SRCDIR)/crc32_braid_p.h $(SRCDIR)/crc32_braid_tbl.h -crc32_braid_comb.obj: $(SRCDIR)/crc32_braid_comb.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/crc32_braid_p.h $(SRCDIR)/crc32_braid_tbl.h $(SRCDIR)/crc32_braid_comb_p.h -crc32_fold.obj: $(SRCDIR)/crc32_fold.c $(SRCDIR)/zbuild.h -deflate.obj: $(SRCDIR)/deflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_fast.obj: $(SRCDIR)/deflate_fast.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_huff.obj: $(SRCDIR)/deflate_huff.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_quick.obj: $(SRCDIR)/deflate_quick.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/trees_emit.h -deflate_medium.obj: $(SRCDIR)/deflate_medium.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_rle.obj: $(SRCDIR)/deflate_rle.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_slow.obj: $(SRCDIR)/deflate_slow.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_stored.obj: $(SRCDIR)/deflate_stored.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -infback.obj: $(SRCDIR)/infback.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inflate_p.h $(SRCDIR)/functable.h -inflate.obj: $(SRCDIR)/inflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h -inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h -slide_hash.obj: $(SRCDIR)/slide_hash.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h -slide_hash_neon.obj: $(SRCDIR)/arch/arm/slide_hash_neon.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h -trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h -zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/zutil_p.h - -example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h +adler32.obj: $(TOP)/adler32.c $(TOP)/zbuild.h $(TOP)/functable.h $(TOP)/adler32_p.h +adler32_c.obj: $(TOP)/arch/generic/adler32_c.c $(TOP)/zbuild.h $(TOP)/functable.h $(TOP)/adler32_p.h +adler32_fold_c.obj: $(TOP)/arch/generic/adler32_fold_c.c $(TOP)/zbuild.h $(TOP)/functable.h +chunkset_c.obj: $(TOP)/arch/generic/chunkset_c.c $(TOP)/zbuild.h $(TOP)/chunkset_tpl.h $(TOP)/inffast_tpl.h +compare256_c.obj: $(TOP)/arch/generic/compare256_c.c $(TOP)/zbuild.h $(TOP)/zutil_p.h $(TOP)/deflate.h $(TOP)/fallback_builtins.h $(TOP)/match_tpl.h +compress.obj: $(TOP)/compress.c $(TOP)/zbuild.h $(TOP)/zutil.h +cpu_features.obj: $(TOP)/cpu_features.c $(TOP)/cpu_features.h $(TOP)/zbuild.h +crc32.obj: $(TOP)/crc32.c $(TOP)/zbuild.h $(TOP)/functable.h $(TOP)/crc32_braid_tbl.h +crc32_braid_c.obj: $(TOP)/arch/generic/crc32_braid_c.c $(TOP)/zbuild.h $(TOP)/crc32_braid_p.h $(TOP)/crc32_braid_tbl.h +crc32_braid_comb.obj: $(TOP)/crc32_braid_comb.c $(TOP)/zutil.h $(TOP)/crc32_braid_p.h $(TOP)/crc32_braid_tbl.h $(TOP)/crc32_braid_comb_p.h +crc32_fold_c.obj: $(TOP)/arch/generic/crc32_fold_c.c $(TOP)/zbuild.h $(TOP)/crc32.h $(TOP)/functable.h $(TOP)/zutil.h +deflate.obj: $(TOP)/deflate.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_fast.obj: $(TOP)/deflate_fast.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_huff.obj: $(TOP)/deflate_huff.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_medium.obj: $(TOP)/deflate_medium.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_quick.obj: $(TOP)/deflate_quick.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h $(TOP)/trees_emit.h $(TOP)/zutil_p.h +deflate_rle.obj: $(TOP)/deflate_rle.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h $(TOP)/compare256_rle.h +deflate_slow.obj: $(TOP)/deflate_slow.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_stored.obj: $(TOP)/deflate_stored.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +functable.obj: $(TOP)/functable.c $(TOP)/zbuild.h $(TOP)/functable.h $(TOP)/cpu_features.h $(TOP)/arch/arm/arm_features.h $(TOP)/arch_functions.h +gzlib.obj: $(TOP)/gzlib.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h +gzread.obj: $(TOP)/gzread.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h +gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h +infback.obj: $(TOP)/infback.c $(TOP)/zbuild.h $(TOP)/zutil.h $(TOP)/inftrees.h $(TOP)/inflate.h $(TOP)/inflate_p.h $(TOP)/functable.h +inflate.obj: $(TOP)/inflate.c $(TOP)/zbuild.h $(TOP)/zutil.h $(TOP)/inftrees.h $(TOP)/inflate.h $(TOP)/inflate_p.h $(TOP)/functable.h $(TOP)/inffixed_tbl.h +inftrees.obj: $(TOP)/inftrees.c $(TOP)/zbuild.h $(TOP)/zutil.h $(TOP)/inftrees.h +insert_string.obj: $(TOP)/insert_string.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/insert_string_tpl.h +insert_string_roll.obj: $(TOP)/insert_string_roll.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/insert_string_tpl.h +slide_hash_c.obj: $(TOP)/arch/generic/slide_hash_c.c $(TOP)/zbuild.h $(TOP)/deflate.h +slide_hash_neon.obj: $(TOP)/arch/arm/slide_hash_neon.c $(TOP)/arch/arm/neon_intrins.h $(TOP)/zbuild.h $(TOP)/deflate.h +trees.obj: $(TOP)/trees.c $(TOP)/trees.h $(TOP)/trees_emit.h $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/trees_tbl.h +uncompr.obj: $(TOP)/uncompr.c $(TOP)/zbuild.h $(TOP)/zutil.h +zutil.obj: $(TOP)/zutil.c $(TOP)/zbuild.h $(TOP)/zutil.h $(TOP)/zutil_p.h $(RESFILE): $(TOP)/win32/$(RCFILE) $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/$(RCFILE) @@ -220,6 +225,10 @@ testdll: example_d.exe minigzip_d.exe example_d echo hello world | minigzip_d | minigzip_d -d +example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h $(TOP)/deflate.h $(TOP)/test/test_shared_ng.h + +minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h + # cleanup clean: diff --git a/src/native/external/zlib-ng/win32/Makefile.arm b/src/native/external/zlib-ng/win32/Makefile.arm index 34dfe6bba6e1aa..cab999dfe036d8 100644 --- a/src/native/external/zlib-ng/win32/Makefile.arm +++ b/src/native/external/zlib-ng/win32/Makefile.arm @@ -1,5 +1,5 @@ # Makefile for zlib using Microsoft (Visual) C -# zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler +# zlib is copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler # # Usage: # nmake -f win32/Makefile.arm (standard build) @@ -23,7 +23,8 @@ LD = link AR = lib RC = rc CP = copy /y -CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) +INCLUDES = -I$(TOP) -I$(TOP)/arch/arm -I$(TOP)/arch/generic +CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) $(INCLUDES) WFLAGS = \ -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 \ -D_CRT_SECURE_NO_DEPRECATE \ @@ -48,15 +49,17 @@ SUFFIX = OBJS = \ adler32.obj \ - adler32_fold.obj \ + adler32_c.obj \ + adler32_fold_c.obj \ arm_features.obj \ - chunkset.obj \ - compare256.obj \ + chunkset_c.obj \ + compare256_c.obj \ compress.obj \ cpu_features.obj \ - crc32_braid.obj \ + crc32.obj \ + crc32_braid_c.obj \ crc32_braid_comb.obj \ - crc32_fold.obj \ + crc32_fold_c.obj \ deflate.obj \ deflate_fast.obj \ deflate_huff.obj \ @@ -71,7 +74,7 @@ OBJS = \ inftrees.obj \ insert_string.obj \ insert_string_roll.obj \ - slide_hash.obj \ + slide_hash_c.obj \ trees.obj \ uncompr.obj \ zutil.obj \ @@ -97,7 +100,7 @@ OBJS = $(OBJS) gzlib.obj gzread.obj gzwrite.obj !if "$(WITH_ACLE)" != "" WFLAGS = $(WFLAGS) -DARM_ACLE -OBJS = $(OBJS) crc32_acle.obj insert_string_acle.obj +OBJS = $(OBJS) crc32_acle.obj !endif !if "$(WITH_VFPV3)" != "" NEON_ARCH = /arch:VFPv3 @@ -177,56 +180,58 @@ minigzip_d.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) {$(TOP)}.c.obj: $(CC) -c $(WFLAGS) $(CFLAGS) $< -gzlib2.obj: gzlib.c +gzlib2.obj: gzlib.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzlib2.obj gzlib.c -gzread2.obj: gzread.c +gzread2.obj: gzread.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzread2.obj gzread.c -gzwrite2.obj: gzwrite.c +gzwrite2.obj: gzwrite.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzwrite2.obj gzwrite.c {$(TOP)/arch/arm}.c.obj: $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< +{$(TOP)/arch/generic}.c.obj: + $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< + {$(TOP)/test}.c.obj: $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP $< $(TOP)/zconf$(SUFFIX).h: zconf -SRCDIR = $(TOP) -# Keep the dependences in sync with top-level Makefile.in -adler32.obj: $(SRCDIR)/adler32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/functable.h $(SRCDIR)/adler32_p.h -adler32_fold.obj: $(SRCDIR)/adler32_fold.c $(SRCDIR)/zbuild.h $(SRCDIR)/adler32_fold.h $(SRCDIR)/functable.h -functable.obj: $(SRCDIR)/functable.c $(SRCDIR)/zbuild.h $(SRCDIR)/functable.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/zendian.h $(SRCDIR)/arch/x86/x86_features.h -gzlib.obj: $(SRCDIR)/gzlib.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzread.obj: $(SRCDIR)/gzread.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzwrite.obj: $(SRCDIR)/gzwrite.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -compress.obj: $(SRCDIR)/compress.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -uncompr.obj: $(SRCDIR)/uncompr.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -chunkset.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -cpu_features.obj: $(SRCDIR)/cpu_features.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -crc32_braid.obj: $(SRCDIR)/crc32_braid.c $(SRCDIR)/zbuild.h $(SRCDIR)/zendian.h $(SRCDIR)/deflate.h $(SRCDIR)/functable.h $(SRCDIR)/crc32_braid_p.h $(SRCDIR)/crc32_braid_tbl.h -crc32_braid_comb.obj: $(SRCDIR)/crc32_braid_comb.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/crc32_braid_p.h $(SRCDIR)/crc32_braid_tbl.h $(SRCDIR)/crc32_braid_comb_p.h -crc32_fold.obj: $(SRCDIR)/crc32_fold.c $(SRCDIR)/zbuild.h -deflate.obj: $(SRCDIR)/deflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_fast.obj: $(SRCDIR)/deflate_fast.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_huff.obj: $(SRCDIR)/deflate_huff.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_medium.obj: $(SRCDIR)/deflate_medium.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_quick.obj: $(SRCDIR)/deflate_quick.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/trees_emit.h -deflate_rle.obj: $(SRCDIR)/deflate_rle.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_slow.obj: $(SRCDIR)/deflate_slow.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_stored.obj: $(SRCDIR)/deflate_stored.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -infback.obj: $(SRCDIR)/infback.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inflate_p.h $(SRCDIR)/functable.h -inflate.obj: $(SRCDIR)/inflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h -inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h -slide_hash.obj: $(SRCDIR)/slide_hash.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h -trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h -zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/zutil_p.h - -example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h +adler32.obj: $(TOP)/adler32.c $(TOP)/zbuild.h $(TOP)/functable.h $(TOP)/adler32_p.h +adler32_c.obj: $(TOP)/arch/generic/adler32_c.c $(TOP)/zbuild.h $(TOP)/functable.h $(TOP)/adler32_p.h +adler32_fold_c.obj: $(TOP)/arch/generic/adler32_fold_c.c $(TOP)/zbuild.h $(TOP)/functable.h +chunkset_c.obj: $(TOP)/arch/generic/chunkset_c.c $(TOP)/zbuild.h $(TOP)/chunkset_tpl.h $(TOP)/inffast_tpl.h +compare256_c.obj: $(TOP)/arch/generic/compare256_c.c $(TOP)/zbuild.h $(TOP)/zutil_p.h $(TOP)/deflate.h $(TOP)/fallback_builtins.h $(TOP)/match_tpl.h +compress.obj: $(TOP)/compress.c $(TOP)/zbuild.h $(TOP)/zutil.h +cpu_features.obj: $(TOP)/cpu_features.c $(TOP)/cpu_features.h $(TOP)/zbuild.h +crc32.obj: $(TOP)/crc32.c $(TOP)/zbuild.h $(TOP)/functable.h $(TOP)/crc32_braid_tbl.h +crc32_braid_c.obj: $(TOP)/arch/generic/crc32_braid_c.c $(TOP)/zbuild.h $(TOP)/crc32_braid_p.h $(TOP)/crc32_braid_tbl.h +crc32_braid_comb.obj: $(TOP)/crc32_braid_comb.c $(TOP)/zutil.h $(TOP)/crc32_braid_p.h $(TOP)/crc32_braid_tbl.h $(TOP)/crc32_braid_comb_p.h +crc32_fold_c.obj: $(TOP)/arch/generic/crc32_fold_c.c $(TOP)/zbuild.h $(TOP)/crc32.h $(TOP)/functable.h $(TOP)/zutil.h +deflate.obj: $(TOP)/deflate.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_fast.obj: $(TOP)/deflate_fast.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_huff.obj: $(TOP)/deflate_huff.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_medium.obj: $(TOP)/deflate_medium.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_quick.obj: $(TOP)/deflate_quick.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h $(TOP)/trees_emit.h $(TOP)/zutil_p.h +deflate_rle.obj: $(TOP)/deflate_rle.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h $(TOP)/compare256_rle.h +deflate_slow.obj: $(TOP)/deflate_slow.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_stored.obj: $(TOP)/deflate_stored.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +functable.obj: $(TOP)/functable.c $(TOP)/zbuild.h $(TOP)/functable.h $(TOP)/cpu_features.h $(TOP)/arch/arm/arm_features.h $(TOP)/arch_functions.h +gzlib.obj: $(TOP)/gzlib.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h +gzread.obj: $(TOP)/gzread.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h +gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h +infback.obj: $(TOP)/infback.c $(TOP)/zbuild.h $(TOP)/zutil.h $(TOP)/inftrees.h $(TOP)/inflate.h $(TOP)/inflate_p.h $(TOP)/functable.h +inflate.obj: $(TOP)/inflate.c $(TOP)/zbuild.h $(TOP)/zutil.h $(TOP)/inftrees.h $(TOP)/inflate.h $(TOP)/inflate_p.h $(TOP)/functable.h $(TOP)/inffixed_tbl.h +inftrees.obj: $(TOP)/inftrees.c $(TOP)/zbuild.h $(TOP)/zutil.h $(TOP)/inftrees.h +insert_string.obj: $(TOP)/insert_string.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/insert_string_tpl.h +insert_string_roll.obj: $(TOP)/insert_string_roll.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/insert_string_tpl.h +slide_hash_c.obj: $(TOP)/arch/generic/slide_hash_c.c $(TOP)/zbuild.h $(TOP)/deflate.h +trees.obj: $(TOP)/trees.c $(TOP)/trees.h $(TOP)/trees_emit.h $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/trees_tbl.h +uncompr.obj: $(TOP)/uncompr.c $(TOP)/zbuild.h $(TOP)/zutil.h +zutil.obj: $(TOP)/zutil.c $(TOP)/zbuild.h $(TOP)/zutil.h $(TOP)/zutil_p.h $(RESFILE): $(TOP)/win32/$(RCFILE) $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/$(RCFILE) @@ -240,6 +245,10 @@ testdll: example_d.exe minigzip_d.exe example_d echo hello world | minigzip_d | minigzip_d -d +example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h $(TOP)/deflate.h $(TOP)/test/test_shared_ng.h + +minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h + # cleanup clean: diff --git a/src/native/external/zlib-ng/win32/Makefile.msc b/src/native/external/zlib-ng/win32/Makefile.msc index 3035072bec765f..8392fe46e7e89d 100644 --- a/src/native/external/zlib-ng/win32/Makefile.msc +++ b/src/native/external/zlib-ng/win32/Makefile.msc @@ -1,5 +1,5 @@ # Makefile for zlib using Microsoft (Visual) C -# zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler +# zlib is copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler # # Usage: # nmake -f win32/Makefile.msc (standard build) @@ -19,11 +19,14 @@ IMPLIB = zdll.lib SYMBOL_PREFIX = CC = cl +CXX = cl LD = link AR = lib RC = rc CP = copy /y -CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) +INCLUDES = -I$(TOP) -I$(TOP)/arch/x86 -I$(TOP)/arch/generic +CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) $(INCLUDES) +CXXFLAGS = -nologo -EHsc -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) $(INCLUDES) WFLAGS = \ -D_CRT_SECURE_NO_DEPRECATE \ -D_CRT_NONSTDC_NO_DEPRECATE \ @@ -46,24 +49,26 @@ SUFFIX = OBJS = \ adler32.obj \ + adler32_c.obj \ adler32_avx2.obj \ adler32_avx512.obj \ adler32_avx512_vnni.obj \ adler32_sse42.obj \ adler32_ssse3.obj \ - adler32_fold.obj \ - chunkset.obj \ + adler32_fold_c.obj \ + chunkset_c.obj \ chunkset_avx2.obj \ chunkset_sse2.obj \ chunkset_ssse3.obj \ - compare256.obj \ + compare256_c.obj \ compare256_avx2.obj \ compare256_sse2.obj \ compress.obj \ cpu_features.obj \ - crc32_braid.obj \ + crc32.obj \ + crc32_braid_c.obj \ crc32_braid_comb.obj \ - crc32_fold.obj \ + crc32_fold_c.obj \ crc32_pclmulqdq.obj \ deflate.obj \ deflate_fast.obj \ @@ -79,8 +84,7 @@ OBJS = \ inftrees.obj \ insert_string.obj \ insert_string_roll.obj \ - insert_string_sse42.obj \ - slide_hash.obj \ + slide_hash_c.obj \ slide_hash_avx2.obj \ slide_hash_sse2.obj \ trees.obj \ @@ -142,6 +146,11 @@ $(SHAREDLIB): zconf $(TOP)/win32/$(DEFFILE) $(OBJS) $(RESFILE) if exist $@.manifest \ mt -nologo -manifest $@.manifest -outputresource:$@;2 +depcheck.exe: depcheck.obj + $(LD) $(LDFLAGS) depcheck.obj + if exist $@.manifest \ + mt -nologo -manifest $@.manifest -outputresource:$@;1 + example.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) $(LD) $(LDFLAGS) example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) if exist $@.manifest \ @@ -165,76 +174,88 @@ minigzip_d.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) {$(TOP)}.c.obj: $(CC) -c $(WFLAGS) $(CFLAGS) $< -gzlib2.obj: gzlib.c +gzlib2.obj: gzlib.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzlib2.obj gzlib.c -gzread2.obj: gzread.c +gzread2.obj: gzread.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzread2.obj gzread.c -gzwrite2.obj: gzwrite.c +gzwrite2.obj: gzwrite.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzwrite2.obj gzwrite.c {$(TOP)/arch/x86}.c.obj: $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< +{$(TOP)/arch/generic}.c.obj: + $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< + {$(TOP)/test}.c.obj: $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP $< $(TOP)/zconf$(SUFFIX).h: zconf -SRCDIR = $(TOP) -# Keep the dependences in sync with top-level Makefile.in -adler32.obj: $(SRCDIR)/adler32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/functable.h $(SRCDIR)/adler32_p.h -adler32_avx2.obj: $(SRCDIR)/arch/x86/adler32_avx2.c $(SRCDIR)/zbuild.h $(SRCDIR)/cpu_features.h $(SRCDIR)/adler32_p.h $(SRCDIR)/fallback_builtins.h -adler32_avx512.obj: $(SRCDIR)/arch/x86/adler32_avx512.c $(SRCDIR)/zbuild.h $(SRCDIR)/cpu_features.h $(SRCDIR)/adler32_p.h $(SRCDIR)/arch/x86/adler32_avx512_p.h -adler32_avx512_vnni.obj: $(SRCDIR)/arch/x86/adler32_avx512_vnni.c $(SRCDIR)/zbuild.h $(SRCDIR)/cpu_features.h $(SRCDIR)/adler32_p.h $(SRCDIR)/arch/x86/adler32_avx512_p.h -adler32_sse42.obj: $(SRCDIR)/arch/x86/adler32_sse42.c $(SRCDIR)/zbuild.h $(SRCDIR)/cpu_features.h $(SRCDIR)/adler32_p.h $(SRCDIR)/adler32_fold.h \ - $(SRCDIR)/arch/x86/adler32_ssse3_p.h -adler32_ssse3.obj: $(SRCDIR)/arch/x86/adler32_ssse3.c $(SRCDIR)/zbuild.h $(SRCDIR)/cpu_features.h $(SRCDIR)/adler32_p.h $(SRCDIR)/adler32_fold.h \ - $(SRCDIR)/arch/x86/adler32_ssse3_p.h -adler32_fold.obj: $(SRCDIR)/adler32_fold.c $(SRCDIR)/zbuild.h $(SRCDIR)/adler32_fold.h $(SRCDIR)/functable.h -functable.obj: $(SRCDIR)/functable.c $(SRCDIR)/zbuild.h $(SRCDIR)/functable.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/zendian.h $(SRCDIR)/arch/x86/x86_features.h -gzlib.obj: $(SRCDIR)/gzlib.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzread.obj: $(SRCDIR)/gzread.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzwrite.obj: $(SRCDIR)/gzwrite.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -compress.obj: $(SRCDIR)/compress.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -uncompr.obj: $(SRCDIR)/uncompr.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -chunkset.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -chunkset_avx2.obj: $(SRCDIR)/arch/x86/chunkset_avx2.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -chunkset_sse2.obj: $(SRCDIR)/arch/x86/chunkset_sse2.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -chunkset_ssse3.obj: $(SRCDIR)/arch/x86/chunkset_ssse3.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -cpu_features.obj: $(SRCDIR)/cpu_features.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -crc32_braid.obj: $(SRCDIR)/crc32_braid.c $(SRCDIR)/zbuild.h $(SRCDIR)/zendian.h $(SRCDIR)/deflate.h $(SRCDIR)/functable.h $(SRCDIR)/crc32_braid_p.h $(SRCDIR)/crc32_braid_tbl.h -crc32_braid_comb.obj: $(SRCDIR)/crc32_braid_comb.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/crc32_braid_p.h $(SRCDIR)/crc32_braid_tbl.h $(SRCDIR)/crc32_braid_comb_p.h -crc32_fold.obj: $(SRCDIR)/crc32_fold.c $(SRCDIR)/zbuild.h -crc32_pclmulqdq.obj: $(SRCDIR)/arch/x86/crc32_pclmulqdq.c $(SRCDIR)/arch/x86/crc32_pclmulqdq_tpl.h $(SRCDIR)/arch/x86/crc32_fold_pclmulqdq_tpl.h \ - $(SRCDIR)/crc32_fold.h $(SRCDIR)/zbuild.h -deflate.obj: $(SRCDIR)/deflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_fast.obj: $(SRCDIR)/deflate_fast.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_huff.obj: $(SRCDIR)/deflate_huff.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_medium.obj: $(SRCDIR)/deflate_medium.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_quick.obj: $(SRCDIR)/deflate_quick.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/trees_emit.h -deflate_rle.obj: $(SRCDIR)/deflate_rle.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_slow.obj: $(SRCDIR)/deflate_slow.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_stored.obj: $(SRCDIR)/deflate_stored.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -infback.obj: $(SRCDIR)/infback.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inflate_p.h $(SRCDIR)/functable.h -inflate.obj: $(SRCDIR)/inflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h -inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h -slide_hash.obj: $(SRCDIR)/slide_hash.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h -slide_hash_avx2.obj: $(SRCDIR)/arch/x86/slide_hash_avx2.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h -slide_hash_sse2.obj: $(SRCDIR)/arch/x86/slide_hash_sse2.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h -trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h -zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/zutil_p.h - -example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h +{$(TOP)/win32}.cpp.obj: + $(CXX) -c -I$(TOP) $(WFLAGS) $(CXXFLAGS) $< + +adler32.obj: $(TOP)/adler32.c $(TOP)/zbuild.h $(TOP)/functable.h $(TOP)/adler32_p.h +adler32_c.obj: $(TOP)/arch/generic/adler32_c.c $(TOP)/zbuild.h $(TOP)/functable.h $(TOP)/adler32_p.h +adler32_avx2.obj: $(TOP)/arch/x86/adler32_avx2.c $(TOP)/zbuild.h $(TOP)/adler32_p.h $(TOP)/arch/x86/adler32_avx2_p.h $(TOP)/arch/x86/x86_intrins.h +adler32_avx512.obj: $(TOP)/arch/x86/adler32_avx512.c $(TOP)/zbuild.h $(TOP)/arch_functions.h $(TOP)/adler32_p.h $(TOP)/arch/x86/adler32_avx512_p.h $(TOP)/arch/x86/x86_intrins.h +adler32_avx512_vnni.obj: $(TOP)/arch/x86/adler32_avx512_vnni.c $(TOP)/zbuild.h $(TOP)/arch_functions.h $(TOP)/adler32_p.h $(TOP)/arch/x86/adler32_avx512_p.h \ + $(TOP)/arch/x86/adler32_avx2_p.h $(TOP)/arch/x86/x86_intrins.h +adler32_sse42.obj: $(TOP)/arch/x86/adler32_sse42.c $(TOP)/zbuild.h $(TOP)/adler32_p.h \ + $(TOP)/arch/x86/adler32_ssse3_p.h +adler32_ssse3.obj: $(TOP)/arch/x86/adler32_ssse3.c $(TOP)/zbuild.h $(TOP)/adler32_p.h \ + $(TOP)/arch/x86/adler32_ssse3_p.h +adler32_fold_c.obj: $(TOP)/arch/generic/adler32_fold_c.c $(TOP)/zbuild.h $(TOP)/functable.h +chunkset_c.obj: $(TOP)/arch/generic/chunkset_c.c $(TOP)/zbuild.h $(TOP)/chunkset_tpl.h $(TOP)/inffast_tpl.h +chunkset_avx2.obj: $(TOP)/arch/x86/chunkset_avx2.c $(TOP)/zbuild.h $(TOP)/chunkset_tpl.h $(TOP)/inffast_tpl.h $(TOP)/arch/generic/chunk_permute_table.h +chunkset_sse2.obj: $(TOP)/arch/x86/chunkset_sse2.c $(TOP)/zbuild.h $(TOP)/chunkset_tpl.h $(TOP)/inffast_tpl.h +chunkset_ssse3.obj: $(TOP)/arch/x86/chunkset_ssse3.c $(TOP)/zbuild.h $(TOP)/chunkset_tpl.h $(TOP)/inffast_tpl.h $(TOP)/arch/generic/chunk_permute_table.h +compare256_c.obj: $(TOP)/arch/generic/compare256_c.c $(TOP)/zbuild.h $(TOP)/zutil_p.h $(TOP)/deflate.h $(TOP)/fallback_builtins.h $(TOP)/match_tpl.h +compare256_avx2.obj: $(TOP)/arch/x86/compare256_avx2.c $(TOP)/zbuild.h $(TOP)/zutil_p.h $(TOP)/deflate.h $(TOP)/fallback_builtins.h $(TOP)/match_tpl.h +compare256_sse2.obj: $(TOP)/arch/x86/compare256_sse2.c $(TOP)/zbuild.h $(TOP)/zutil_p.h $(TOP)/deflate.h $(TOP)/fallback_builtins.h $(TOP)/match_tpl.h +compress.obj: $(TOP)/compress.c $(TOP)/zbuild.h $(TOP)/zutil.h +cpu_features.obj: $(TOP)/cpu_features.c $(TOP)/cpu_features.h $(TOP)/zbuild.h +crc32.obj: $(TOP)/crc32.c $(TOP)/zbuild.h $(TOP)/functable.h $(TOP)/crc32_braid_tbl.h +crc32_braid_c.obj: $(TOP)/arch/generic/crc32_braid_c.c $(TOP)/zbuild.h $(TOP)/crc32_braid_p.h $(TOP)/crc32_braid_tbl.h +crc32_braid_comb.obj: $(TOP)/crc32_braid_comb.c $(TOP)/zutil.h $(TOP)/crc32_braid_p.h $(TOP)/crc32_braid_tbl.h $(TOP)/crc32_braid_comb_p.h +crc32_fold_c.obj: $(TOP)/arch/generic/crc32_fold_c.c $(TOP)/zbuild.h $(TOP)/crc32.h $(TOP)/functable.h $(TOP)/zutil.h +crc32_pclmulqdq.obj: $(TOP)/arch/x86/crc32_pclmulqdq.c $(TOP)/arch/x86/crc32_pclmulqdq_tpl.h +deflate.obj: $(TOP)/deflate.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_fast.obj: $(TOP)/deflate_fast.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_huff.obj: $(TOP)/deflate_huff.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_medium.obj: $(TOP)/deflate_medium.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_quick.obj: $(TOP)/deflate_quick.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h $(TOP)/trees_emit.h $(TOP)/zutil_p.h +deflate_rle.obj: $(TOP)/deflate_rle.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h $(TOP)/compare256_rle.h +deflate_slow.obj: $(TOP)/deflate_slow.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +deflate_stored.obj: $(TOP)/deflate_stored.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/deflate_p.h $(TOP)/functable.h +functable.obj: $(TOP)/functable.c $(TOP)/zbuild.h $(TOP)/functable.h $(TOP)/cpu_features.h $(TOP)/arch/x86/x86_features.h $(TOP)/arch_functions.h +gzlib.obj: $(TOP)/gzlib.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h +gzread.obj: $(TOP)/gzread.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h +gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zbuild.h $(TOP)/gzguts.h $(TOP)/zutil_p.h +infback.obj: $(TOP)/infback.c $(TOP)/zbuild.h $(TOP)/zutil.h $(TOP)/inftrees.h $(TOP)/inflate.h $(TOP)/inflate_p.h $(TOP)/functable.h +inflate.obj: $(TOP)/inflate.c $(TOP)/zbuild.h $(TOP)/zutil.h $(TOP)/inftrees.h $(TOP)/inflate.h $(TOP)/inflate_p.h $(TOP)/functable.h $(TOP)/inffixed_tbl.h +inftrees.obj: $(TOP)/inftrees.c $(TOP)/zbuild.h $(TOP)/zutil.h $(TOP)/inftrees.h +insert_string.obj: $(TOP)/insert_string.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/insert_string_tpl.h +insert_string_roll.obj: $(TOP)/insert_string_roll.c $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/insert_string_tpl.h +slide_hash_c.obj: $(TOP)/arch/generic/slide_hash_c.c $(TOP)/zbuild.h $(TOP)/deflate.h +slide_hash_avx2.obj: $(TOP)/arch/x86/slide_hash_avx2.c $(TOP)/zbuild.h $(TOP)/deflate.h +slide_hash_sse2.obj: $(TOP)/arch/x86/slide_hash_sse2.c $(TOP)/zbuild.h $(TOP)/deflate.h +trees.obj: $(TOP)/trees.c $(TOP)/trees.h $(TOP)/trees_emit.h $(TOP)/zbuild.h $(TOP)/deflate.h $(TOP)/trees_tbl.h +uncompr.obj: $(TOP)/uncompr.c $(TOP)/zbuild.h $(TOP)/zutil.h +zutil.obj: $(TOP)/zutil.c $(TOP)/zbuild.h $(TOP)/zutil.h $(TOP)/zutil_p.h $(RESFILE): $(TOP)/win32/$(RCFILE) $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/$(RCFILE) # testing -test: example.exe minigzip.exe +depcheck: depcheck.exe + depcheck win32\Makefile.msc . + depcheck win32\Makefile.arm . + depcheck win32\Makefile.a64 . + +test: example.exe minigzip.exe depcheck example echo hello world | minigzip | minigzip -d @@ -242,6 +263,12 @@ testdll: example_d.exe minigzip_d.exe example_d echo hello world | minigzip_d | minigzip_d -d +depcheck.obj: $(TOP)/win32/depcheck.cpp + +example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h $(TOP)/deflate.h $(TOP)/test/test_shared_ng.h + +minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h + # cleanup clean: diff --git a/src/native/external/zlib-ng/win32/depcheck.cpp b/src/native/external/zlib-ng/win32/depcheck.cpp new file mode 100644 index 00000000000000..f83bdd685291c8 --- /dev/null +++ b/src/native/external/zlib-ng/win32/depcheck.cpp @@ -0,0 +1,321 @@ +/* depcheck.cpp - Dependency checker for NMake Makefiles + * Copyright (c) 2024 Mika T. Lindqvist + */ + +#include +#include +#include +#include +#include + +int main(int argc, char* argv[]) { + if (argc != 3) { + printf("Usage: depcheck Makefile \n"); + return -1; + } + std::filebuf fb; + if (fb.open (argv[1],std::ios::in)) { + std::istream is(&fb); + std::string makefile = argv[1]; + std::string l, tmp, tmp2; + while (is) { + std::getline(is, l); + while (l.back() == '\\') { + std::getline(is, tmp); + l.replace(l.length() - 1, 1, tmp); + } + size_t pos = l.find("obj:"); + if (pos != std::string::npos) { + std::string objfile = l.substr(0, pos+3); + printf("File: %s\n", objfile.c_str()); + std::vector files; + std::stringstream ss(l.substr(pos+4)); + while(getline(ss, tmp, ' ')){ + if (tmp != "" && tmp != "/") { + files.push_back(tmp); + } + } + for (auto it = files.begin(); it != files.end(); ++it) { + printf("Dependency: %s\n", (*it).c_str()); + } + if (!files.empty()) { + std::filebuf fb2; + std::string src = files[0]; + size_t pos2 = src.find("$(TOP)"); + if (pos2 != std::string::npos) { + src.replace(pos2, 6, argv[2]); + } + printf("Source: %s\n", src.c_str()); + if (fb2.open(src.c_str(),std::ios::in)) { + std::istream is2(&fb2); + std::vector includes; + while (is2) { + std::getline(is2, l); + pos = l.find("#"); + if (pos != std::string::npos) { + pos2 = l.find("include"); + size_t pos3 = l.find("\""); + if (pos2 != std::string::npos && pos3 != std::string::npos && pos2 > pos && pos3 > pos2) { + tmp = l.substr(pos3 + 1); + pos2 = tmp.find("\""); + if (pos2 != std::string::npos) { + tmp = tmp.substr(0, pos2); + } + pos2 = tmp.find("../"); + if (pos2 != std::string::npos) { + tmp = tmp.substr(3); + } + printf("Line: %s\n", tmp.c_str()); + int found = 0; + for (size_t i = 1; i < files.size(); i++) { + pos3 = files[i].find("$(SUFFIX)"); + if (pos3 != std::string::npos) { + tmp2 = files[i].substr(0, pos3).append(files[i].substr(pos3 + 9)); + printf("Comparing dependency \"%s\" and \"%s\"\n", tmp2.c_str(), tmp.c_str()); + if (tmp2 == tmp) { + printf("Dependency %s OK\n", tmp.c_str()); + found = 1; + includes.push_back(tmp); + break; + } + printf("Comparing dependency \"%s\" and \"$(TOP)/%s\"\n", tmp2.c_str(), tmp.c_str()); + if (tmp2 == std::string("$(TOP)/").append(tmp)) { + printf("Dependency %s OK\n", tmp.c_str()); + found = 1; + includes.push_back(tmp); + break; + } + + tmp2 = files[i].substr(0, pos3).append("-ng").append(files[i].substr(pos3 + 9)); + printf("Comparing dependency \"%s\" and \"%s\"\n", tmp2.c_str(), tmp.c_str()); + if (tmp2 == tmp) { + printf("Dependency %s OK\n", tmp.c_str()); + found = 1; + includes.push_back(tmp); + break; + } + printf("Comparing dependency \"%s\" and \"$(TOP)/%s\"\n", tmp2.c_str(), tmp.c_str()); + if (tmp2 == std::string("$(TOP)/").append(tmp)) { + printf("Dependency %s OK\n", tmp.c_str()); + found = 1; + includes.push_back(tmp); + break; + } + } else { + printf("Comparing dependency \"%s\" and \"%s\"\n", files[i].c_str(), tmp.c_str()); + if (files[i] == tmp) { + printf("Dependency %s OK\n", tmp.c_str()); + found = 1; + includes.push_back(tmp); + break; + } + printf("Comparing dependency \"%s\" and \"$(TOP)/%s\"\n", files[i].c_str(), tmp.c_str()); + if (files[i] == std::string("$(TOP)/").append(tmp)) { + printf("Dependency %s OK\n", tmp.c_str()); + found = 1; + includes.push_back(tmp); + break; + } + printf("Comparing dependency \"%s\" and \"$(TOP)/arch/%s\"\n", files[i].c_str(), tmp.c_str()); + if (files[i] == std::string("$(TOP)/arch/").append(tmp)) { + printf("Dependency %s OK\n", tmp.c_str()); + found = 1; + includes.push_back(tmp); + break; + } + printf("Comparing dependency \"%s\" and \"$(TOP)/arch/generic/%s\"\n", files[i].c_str(), tmp.c_str()); + if (files[i] == std::string("$(TOP)/arch/generic/").append(tmp)) { + printf("Dependency %s OK\n", tmp.c_str()); + found = 1; + includes.push_back(tmp); + break; + } + printf("Comparing dependency \"%s\" and \"$(TOP)/arch/arm/%s\"\n", files[i].c_str(), tmp.c_str()); + if (files[i] == std::string("$(TOP)/arch/arm/").append(tmp)) { + printf("Dependency %s OK\n", tmp.c_str()); + found = 1; + includes.push_back(tmp); + break; + } + printf("Comparing dependency \"%s\" and \"$(TOP)/arch/x86/%s\"\n", files[i].c_str(), tmp.c_str()); + if (files[i] == std::string("$(TOP)/arch/x86/").append(tmp)) { + printf("Dependency %s OK\n", tmp.c_str()); + found = 1; + includes.push_back(tmp); + break; + } + printf("Comparing dependency \"%s\" and \"$(TOP)/test/%s\"\n", files[i].c_str(), tmp.c_str()); + if (files[i] == std::string("$(TOP)/test/").append(tmp)) { + printf("Dependency %s OK\n", tmp.c_str()); + found = 1; + includes.push_back(tmp); + break; + } + } + } + // Skip irrelevant dependencies + if (tmp.substr(0, 9) == "arch/s390") found = 1; + if (tmp == "zlib-ng.h" && std::find(includes.begin(), includes.end(), "zlib.h") != includes.end()) found = 1; + if (found == 0) { + printf("%s: Dependency %s missing for %s!\n", makefile.c_str(), tmp.c_str(), objfile.c_str()); + return -1; + } + } + } + } + for (size_t i = 1; i < files.size(); i++) { + int found = 0; + tmp = files[i]; + printf("Dependency: %s\n", tmp.c_str()); + pos2 = tmp.find("$(TOP)"); + if (pos2 != std::string::npos) { + tmp = tmp.substr(7); + } + for (size_t j = 0; j < includes.size(); j++) { + pos2 = tmp.find("$(SUFFIX)"); + if (pos2 != std::string::npos) { + std::string tmp1 = tmp.substr(0, pos2).append(tmp.substr(pos2 + 9)); + printf("[%zd/%zd] Comparing dependency \"%s\" and \"%s\"\n", j, includes.size(), tmp1.c_str(), includes[j].c_str()); + if (tmp1 == includes[j]) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"arch/%s\"\n", j, includes.size(), tmp1.c_str(), includes[j].c_str()); + if (tmp1 == std::string("arch/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"arch/generic/%s\"\n", j, includes.size(), tmp1.c_str(), includes[j].c_str()); + if (tmp1 == std::string("arch/generic/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"arch/arm/%s\"\n", j, includes.size(), tmp1.c_str(), includes[j].c_str()); + if (tmp1 == std::string("arch/arm/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"arch/x86/%s\"\n", j, includes.size(), tmp1.c_str(), includes[j].c_str()); + if (tmp1 == std::string("arch/x86/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"test/%s\"\n", j, includes.size(), tmp1.c_str(), includes[j].c_str()); + if (tmp1 == std::string("test/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + tmp1 = tmp.substr(0, pos2).append("-ng").append(tmp.substr(pos2 + 9)); + printf("[%zd/%zd] Comparing dependency \"%s\" and \"%s\"\n", j, includes.size(), tmp1.c_str(), includes[j].c_str()); + if (tmp1 == includes[j]) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"arch/%s\"\n", j, includes.size(), tmp1.c_str(), includes[j].c_str()); + if (tmp1 == std::string("arch/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"arch/generic/%s\"\n", j, includes.size(), tmp1.c_str(), includes[j].c_str()); + if (tmp1 == std::string("arch/generic/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"arch/arm/%s\"\n", j, includes.size(), tmp1.c_str(), includes[j].c_str()); + if (tmp1 == std::string("arch/arm/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"arch/x86/%s\"\n", j, includes.size(), tmp1.c_str(), includes[j].c_str()); + if (tmp1 == std::string("arch/x86/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"test/%s\"\n", j, includes.size(), tmp1.c_str(), includes[j].c_str()); + if (tmp1 == std::string("test/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + } else { + printf("[%zd/%zd] Comparing dependency \"%s\" and \"%s\"\n", j, includes.size(), tmp.c_str(), includes[j].c_str()); + if (tmp == includes[j]) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"arch/%s\"\n", j, includes.size(), tmp.c_str(), includes[j].c_str()); + if (tmp == std::string("arch/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"arch/generic/%s\"\n", j, includes.size(), tmp.c_str(), includes[j].c_str()); + if (tmp == std::string("arch/generic/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"arch/arm/%s\"\n", j, includes.size(), tmp.c_str(), includes[j].c_str()); + if (tmp == std::string("arch/arm/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"arch/x86/%s\"\n", j, includes.size(), tmp.c_str(), includes[j].c_str()); + if (tmp == std::string("arch/x86/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + printf("[%zd/%zd] Comparing dependency \"%s\" and \"test/%s\"\n", j, includes.size(), tmp.c_str(), includes[j].c_str()); + if (tmp == std::string("test/").append(includes[j])) { + printf("Dependency %s OK\n", files[i].c_str()); + found = 1; + break; + } + } + } + // Skip indirect dependencies + if (tmp.find("arm_features.h") != std::string::npos + && std::find(includes.begin(), includes.end(), "cpu_features.h") != includes.end() + && (makefile.find(".arm") != std::string::npos + || makefile.find(".a64") != std::string::npos)) found = 1; + if (tmp.find("x86_features.h") != std::string::npos + && std::find(includes.begin(), includes.end(), "cpu_features.h") != includes.end() + && makefile.find(".msc") != std::string::npos) found = 1; + // + if (tmp.find("generic_functions.h") != std::string::npos + && std::find(includes.begin(), includes.end(), "arch_functions.h") != includes.end()) found = 1; + if (tmp.find("arm_functions.h") != std::string::npos + && std::find(includes.begin(), includes.end(), "arch_functions.h") != includes.end() + && (makefile.find(".arm") != std::string::npos + || makefile.find(".a64") != std::string::npos)) found = 1; + if (tmp.find("x86_functions.h") != std::string::npos + && std::find(includes.begin(), includes.end(), "arch_functions.h") != includes.end() + && makefile.find(".msc") != std::string::npos) found = 1; + if (found == 0) { + printf("%s: Dependency %s not needed for %s\n", makefile.c_str(), files[i].c_str(), objfile.c_str()); + return -1; + } + } + fb2.close(); + } + } + } + } + fb.close(); + } + return 0; +} diff --git a/src/native/external/zlib-ng/win32/zlib-ng1.rc b/src/native/external/zlib-ng/win32/zlib-ng1.rc index 327f17fd8b41a5..f65cfa254e428e 100644 --- a/src/native/external/zlib-ng/win32/zlib-ng1.rc +++ b/src/native/external/zlib-ng/win32/zlib-ng1.rc @@ -22,7 +22,7 @@ BEGIN VALUE "FileDescription", "zlib data compression library\0" VALUE "FileVersion", ZLIBNG_VERSION "\0" VALUE "InternalName", "zlib-ng1.dll\0" - VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" VALUE "OriginalFilename", "zlib-ng1.dll\0" VALUE "ProductName", "zlib\0" VALUE "ProductVersion", ZLIBNG_VERSION "\0" diff --git a/src/native/external/zlib-ng/win32/zlib1.rc b/src/native/external/zlib-ng/win32/zlib1.rc index 73bc4389c02459..9bb9c18654f992 100644 --- a/src/native/external/zlib-ng/win32/zlib1.rc +++ b/src/native/external/zlib-ng/win32/zlib1.rc @@ -22,7 +22,7 @@ BEGIN VALUE "FileDescription", "zlib data compression library\0" VALUE "FileVersion", ZLIB_VERSION "\0" VALUE "InternalName", "zlib1.dll\0" - VALUE "LegalCopyright", "(C) 1995-2022 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" VALUE "OriginalFilename", "zlib1.dll\0" VALUE "ProductName", "zlib\0" VALUE "ProductVersion", ZLIB_VERSION "\0" diff --git a/src/native/external/zlib-ng/zbuild.h b/src/native/external/zlib-ng/zbuild.h index d550b4c582c33e..9157eef9e356ba 100644 --- a/src/native/external/zlib-ng/zbuild.h +++ b/src/native/external/zlib-ng/zbuild.h @@ -202,6 +202,24 @@ # define ALIGNED_(x) __declspec(align(x)) #endif +#ifdef HAVE_BUILTIN_ASSUME_ALIGNED +# define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n)) +#else +# define HINT_ALIGNED(p,n) (p) +#endif +#define HINT_ALIGNED_16(p) HINT_ALIGNED((p),16) +#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64) +#define HINT_ALIGNED_4096(p) HINT_ALIGNED((p),4096) + +/* PADSZ returns needed bytes to pad bpos to pad size + * PAD_NN calculates pad size and adds it to bpos, returning the result. + * All take an integer or a pointer as bpos input. + */ +#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad)) +#define PAD_16(bpos) ((bpos) + PADSZ((bpos),16)) +#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64)) +#define PAD_4096(bpos) ((bpos) + PADSZ((bpos),4096)) + /* Diagnostic functions */ #ifdef ZLIB_DEBUG # include @@ -246,6 +264,31 @@ # endif #endif +#if defined(__has_feature) +# if __has_feature(address_sanitizer) +# define Z_ADDRESS_SANITIZER 1 +# endif +#elif defined(__SANITIZE_ADDRESS__) +# define Z_ADDRESS_SANITIZER 1 +#endif + +/* + * __asan_loadN() and __asan_storeN() calls are inserted by compilers in order to check memory accesses. + * They can be called manually too, with the following caveats: + * gcc says: "warning: implicit declaration of function ‘...’" + * g++ says: "error: new declaration ‘...’ ambiguates built-in declaration ‘...’" + * Accommodate both. + */ +#ifdef Z_ADDRESS_SANITIZER +#ifndef __cplusplus +void __asan_loadN(void *, long); +void __asan_storeN(void *, long); +#endif +#else +# define __asan_loadN(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0) +# define __asan_storeN(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0) +#endif + #if defined(__has_feature) # if __has_feature(memory_sanitizer) # define Z_MEMORY_SANITIZER 1 @@ -254,7 +297,31 @@ #endif #ifndef Z_MEMORY_SANITIZER +# define __msan_check_mem_is_initialized(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0) # define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0) #endif +/* Notify sanitizer runtime about an upcoming read access. */ +#define instrument_read(a, size) do { \ + void *__a = (void *)(a); \ + long __size = size; \ + __asan_loadN(__a, __size); \ + __msan_check_mem_is_initialized(__a, __size); \ +} while (0) + +/* Notify sanitizer runtime about an upcoming write access. */ +#define instrument_write(a, size) do { \ + void *__a = (void *)(a); \ + long __size = size; \ + __asan_storeN(__a, __size); \ +} while (0) + +/* Notify sanitizer runtime about an upcoming read/write access. */ +#define instrument_read_write(a, size) do { \ + void *__a = (void *)(a); \ + long __size = size; \ + __asan_storeN(__a, __size); \ + __msan_check_mem_is_initialized(__a, __size); \ +} while (0) + #endif diff --git a/src/native/external/zlib-ng/zconf-ng.h.in b/src/native/external/zlib-ng/zconf-ng.h.in index 226f06a037792c..a1b5311b85378c 100644 --- a/src/native/external/zlib-ng/zconf-ng.h.in +++ b/src/native/external/zlib-ng/zconf-ng.h.in @@ -1,5 +1,5 @@ /* zconf-ng.h -- configuration of the zlib-ng 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 */ diff --git a/src/native/external/zlib-ng/zconf.h.in b/src/native/external/zlib-ng/zconf.h.in index 7a6e281e849d61..be8221fd861e1e 100644 --- a/src/native/external/zlib-ng/zconf.h.in +++ b/src/native/external/zlib-ng/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 */ diff --git a/src/native/external/zlib-ng/zlib-config.cmake.in b/src/native/external/zlib-ng/zlib-config.cmake.in new file mode 100644 index 00000000000000..2e4ba4f2307379 --- /dev/null +++ b/src/native/external/zlib-ng/zlib-config.cmake.in @@ -0,0 +1,12 @@ +set(ZLIB_VERSION @ZLIB_HEADER_VERSION@) + +@PACKAGE_INIT@ + +set_and_check(ZLIB_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +set(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}") +set_and_check(ZLIB_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") +set(ZLIB_LIBRARIES ZLIB::ZLIB) + +include("${CMAKE_CURRENT_LIST_DIR}/ZLIB.cmake") + +check_required_components(ZLIB) diff --git a/src/native/external/zlib-ng/zlib-ng-config.cmake.in b/src/native/external/zlib-ng/zlib-ng-config.cmake.in new file mode 100644 index 00000000000000..f7564a905f74d5 --- /dev/null +++ b/src/native/external/zlib-ng/zlib-ng-config.cmake.in @@ -0,0 +1,10 @@ +set(zlib-ng_VERSION @ZLIBNG_HEADER_VERSION@) + +@PACKAGE_INIT@ + +set_and_check(zlib-ng_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +set_and_check(zlib-ng_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") + +include("${CMAKE_CURRENT_LIST_DIR}/zlib-ng.cmake") + +check_required_components(zlib-ng) diff --git a/src/native/external/zlib-ng/zlib-ng.h.in b/src/native/external/zlib-ng/zlib-ng.h.in index 342b240afb6534..7f7f03ee1553be 100644 --- a/src/native/external/zlib-ng/zlib-ng.h.in +++ b/src/native/external/zlib-ng/zlib-ng.h.in @@ -2,7 +2,7 @@ #define ZNGLIB_H_ /* zlib-ng.h -- interface of the 'zlib-ng' compression library, forked from zlib. - Copyright (C) 1995-2016 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 @@ -48,11 +48,11 @@ extern "C" { #endif -#define ZLIBNG_VERSION "2.1.6" -#define ZLIBNG_VERNUM 0x020106F0L /* MMNNRRSM: major minor revision status modified */ +#define ZLIBNG_VERSION "2.2.1" +#define ZLIBNG_VERNUM 0x020201F0L /* MMNNRRSM: major minor revision status modified */ #define ZLIBNG_VER_MAJOR 2 -#define ZLIBNG_VER_MINOR 1 -#define ZLIBNG_VER_REVISION 6 +#define ZLIBNG_VER_MINOR 2 +#define ZLIBNG_VER_REVISION 1 #define ZLIBNG_VER_STATUS F /* 0=devel, 1-E=beta, F=Release (DEPRECATED) */ #define ZLIBNG_VER_STATUSH 0xF /* Hex values: 0=devel, 1-E=beta, F=Release */ #define ZLIBNG_VER_MODIFIED 0 /* non-zero if modified externally from zlib-ng */ @@ -1759,7 +1759,7 @@ uint32_t zng_crc32_combine(uint32_t crc1, uint32_t crc2, z_off64_t len2); 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. */ Z_EXTERN Z_EXPORT @@ -1767,7 +1767,7 @@ uint32_t zng_crc32_combine_gen(z_off64_t len2); /* Return the operator corresponding to length len2, to be used with - crc32_combine_op(). + crc32_combine_op(). len2 must be non-negative. */ Z_EXTERN Z_EXPORT diff --git a/src/native/external/zlib-ng/zlib.h.in b/src/native/external/zlib-ng/zlib.h.in index eabb94afe09ccb..3dceaa3344ba8a 100644 --- a/src/native/external/zlib-ng/zlib.h.in +++ b/src/native/external/zlib-ng/zlib.h.in @@ -1,9 +1,9 @@ #ifndef ZLIB_H_ #define ZLIB_H_ /* zlib.h -- interface of the 'zlib-ng' compression library - Forked from and compatible with zlib 1.2.13 + Forked from and compatible with zlib 1.3.1 - Copyright (C) 1995-2022 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 @@ -49,20 +49,20 @@ extern "C" { #endif -#define ZLIBNG_VERSION "2.1.6" -#define ZLIBNG_VERNUM 0x020106F0L /* MMNNRRSM: major minor revision status modified */ +#define ZLIBNG_VERSION "2.2.1" +#define ZLIBNG_VERNUM 0x020201F0L /* MMNNRRSM: major minor revision status modified */ #define ZLIBNG_VER_MAJOR 2 -#define ZLIBNG_VER_MINOR 1 -#define ZLIBNG_VER_REVISION 6 +#define ZLIBNG_VER_MINOR 2 +#define ZLIBNG_VER_REVISION 1 #define ZLIBNG_VER_STATUS F /* 0=devel, 1-E=beta, F=Release (DEPRECATED) */ #define ZLIBNG_VER_STATUSH 0xF /* Hex values: 0=devel, 1-E=beta, F=Release */ #define ZLIBNG_VER_MODIFIED 0 /* non-zero if modified externally from zlib-ng */ -#define ZLIB_VERSION "1.3.0.zlib-ng" -#define ZLIB_VERNUM 0x130f +#define ZLIB_VERSION "1.3.1.zlib-ng" +#define ZLIB_VERNUM 0x131f #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 3 -#define ZLIB_VER_REVISION 0 +#define ZLIB_VER_REVISION 1 #define ZLIB_VER_SUBREVISION 15 /* 15=fork (0xf) */ /* @@ -220,7 +220,7 @@ typedef gz_header *gz_headerp; #define Z_DEFLATED 8 /* The deflate compression method (the only one supported in this version) */ -#define Z_NULL NULL /* for compatibility with zlib, was for initializing zalloc, zfree, opaque */ +#define Z_NULL 0 /* for compatibility with zlib, was for initializing zalloc, zfree, opaque */ #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ @@ -1732,14 +1732,14 @@ Z_EXTERN unsigned long Z_EXPORT crc32_combine(unsigned long crc1, unsigned long 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. */ /* Z_EXTERN unsigned long Z_EXPORT crc32_combine_gen(z_off_t len2); Return the operator corresponding to length len2, to be used with - crc32_combine_op(). + crc32_combine_op(). len2 must be non-negative. */ Z_EXTERN unsigned long Z_EXPORT crc32_combine_op(unsigned long crc1, unsigned long crc2, diff --git a/src/native/external/zlib-ng/zlib.map b/src/native/external/zlib-ng/zlib.map index ebca10d351ed0b..293e803729d817 100644 --- a/src/native/external/zlib-ng/zlib.map +++ b/src/native/external/zlib-ng/zlib.map @@ -13,6 +13,7 @@ ZLIB_1.2.0 { zcfree; z_errmsg; gz_error; + gz_intmax; _*; }; diff --git a/src/native/external/zlib-ng/zutil.c b/src/native/external/zlib-ng/zutil.c index 270a28c7420147..39fbceb4a01592 100644 --- a/src/native/external/zlib-ng/zutil.c +++ b/src/native/external/zlib-ng/zutil.c @@ -21,7 +21,7 @@ z_const char * const PREFIX(z_errmsg)[10] = { }; const char PREFIX3(vstring)[] = - " zlib-ng 2.1.6"; + " zlib-ng 2.2.1"; #ifdef ZLIB_COMPAT const char * Z_EXPORT zlibVersion(void) { @@ -109,51 +109,3 @@ void Z_INTERNAL PREFIX(zcfree)(void *opaque, void *ptr) { Z_UNUSED(opaque); zng_free(ptr); } - -/* Since we support custom memory allocators, some which might not align memory as we expect, - * we have to ask for extra memory and return an aligned pointer. */ -void Z_INTERNAL *PREFIX3(alloc_aligned)(zng_calloc_func zalloc, void *opaque, unsigned items, unsigned size, unsigned align) { - uintptr_t return_ptr, original_ptr; - uint32_t alloc_size, align_diff; - void *ptr; - - /* If no custom calloc function used then call zlib-ng's aligned calloc */ - if (zalloc == PREFIX(zcalloc)) - return PREFIX(zcalloc)(opaque, items, size); - - /* Allocate enough memory for proper alignment and to store the original memory pointer */ - alloc_size = sizeof(void *) + (items * size) + align; - ptr = zalloc(opaque, 1, alloc_size); - if (!ptr) - return NULL; - - /* Calculate return pointer address with space enough to store original pointer */ - align_diff = align - ((uintptr_t)ptr % align); - return_ptr = (uintptr_t)ptr + align_diff; - if (align_diff < sizeof(void *)) - return_ptr += align; - - /* Store the original pointer for free() */ - original_ptr = return_ptr - sizeof(void *); - memcpy((void *)original_ptr, &ptr, sizeof(void *)); - - /* Return properly aligned pointer in allocation */ - return (void *)return_ptr; -} - -void Z_INTERNAL PREFIX3(free_aligned)(zng_cfree_func zfree, void *opaque, void *ptr) { - /* If no custom cfree function used then call zlib-ng's aligned cfree */ - if (zfree == PREFIX(zcfree)) { - PREFIX(zcfree)(opaque, ptr); - return; - } - if (!ptr) - return; - - /* Calculate offset to original memory allocation pointer */ - void *original_ptr = (void *)((uintptr_t)ptr - sizeof(void *)); - void *free_ptr = *(void **)original_ptr; - - /* Free original memory allocation */ - zfree(opaque, free_ptr); -} diff --git a/src/native/external/zlib-ng/zutil.h b/src/native/external/zlib-ng/zutil.h index 663616b44d89eb..a6284502d047e8 100644 --- a/src/native/external/zlib-ng/zutil.h +++ b/src/native/external/zlib-ng/zutil.h @@ -1,7 +1,7 @@ #ifndef ZUTIL_H_ #define ZUTIL_H_ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2022 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 */ @@ -24,7 +24,7 @@ typedef unsigned long ulg; extern z_const char * const PREFIX(z_errmsg)[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ -#define ERR_MSG(err) PREFIX(z_errmsg)[Z_NEED_DICT-(err)] +#define ERR_MSG(err) PREFIX(z_errmsg)[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] #define ERR_RETURN(strm, err) return (strm->msg = ERR_MSG(err), (err)) /* To be used only when the state is known to be valid */ @@ -103,7 +103,7 @@ extern z_const char * const PREFIX(z_errmsg)[10]; /* indexed by 2-zlib_error */ # define OS_CODE 6 #endif -#if defined(MACOS) || defined(TARGET_OS_MAC) +#if defined(MACOS) # define OS_CODE 7 #endif @@ -137,12 +137,4 @@ void Z_INTERNAL PREFIX(zcfree)(void *opaque, void *ptr); typedef void *zng_calloc_func(void *opaque, unsigned items, unsigned size); typedef void zng_cfree_func(void *opaque, void *ptr); -void Z_INTERNAL *PREFIX3(alloc_aligned)(zng_calloc_func zalloc, void *opaque, unsigned items, unsigned size, unsigned align); -void Z_INTERNAL PREFIX3(free_aligned)(zng_cfree_func zfree, void *opaque, void *ptr); - -#define ZALLOC(strm, items, size) PREFIX3(alloc_aligned)((strm)->zalloc, (strm)->opaque, (items), (size), 64) -#define ZFREE(strm, addr) PREFIX3(free_aligned)((strm)->zfree, (strm)->opaque, (void *)(addr)) - -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - #endif /* ZUTIL_H_ */ diff --git a/src/native/external/zlib-ng/zutil_p.h b/src/native/external/zlib-ng/zutil_p.h index caec91d50d364c..97799f0ce31ef2 100644 --- a/src/native/external/zlib-ng/zutil_p.h +++ b/src/native/external/zlib-ng/zutil_p.h @@ -16,15 +16,19 @@ /* Function to allocate 16 or 64-byte aligned memory */ static inline void *zng_alloc(size_t size) { -#ifdef HAVE_POSIX_MEMALIGN +#ifdef HAVE_ALIGNED_ALLOC + /* Size must be a multiple of alignment */ + size = (size + (64 - 1)) & ~(64 - 1); + return (void *)aligned_alloc(64, size); /* Defined in C11 */ +#elif defined(HAVE_POSIX_MEMALIGN) void *ptr; return posix_memalign(&ptr, 64, size) ? NULL : ptr; #elif defined(_WIN32) return (void *)_aligned_malloc(size, 64); #elif defined(__APPLE__) - return (void *)malloc(size); /* MacOS always aligns to 16 bytes */ -#elif defined(HAVE_ALIGNED_ALLOC) - return (void *)aligned_alloc(64, size); + /* Fallback for when posix_memalign and aligned_alloc are not available. + * On macOS, it always aligns to 16 bytes. */ + return (void *)malloc(size); #else return (void *)memalign(64, size); #endif From 5bb88824c06d2642dc3c1fe068c7e07860de7abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?= <1175054+carlossanlop@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:15:59 -0700 Subject: [PATCH 103/748] Apply slide_hash and deflate patch with casts and asserts. --- src/native/external/zlib-ng/arch/arm/slide_hash_armv6.c | 3 ++- src/native/external/zlib-ng/arch/arm/slide_hash_neon.c | 3 ++- src/native/external/zlib-ng/arch/generic/crc32_braid_c.c | 3 ++- src/native/external/zlib-ng/arch/power/slide_ppc_tpl.h | 3 ++- src/native/external/zlib-ng/arch/riscv/slide_hash_rvv.c | 1 + src/native/external/zlib-ng/arch/x86/slide_hash_avx2.c | 1 + src/native/external/zlib-ng/arch/x86/slide_hash_sse2.c | 1 + src/native/external/zlib-ng/deflate.c | 2 +- src/native/external/zlib-ng/deflate_fast.c | 4 +++- src/native/external/zlib-ng/deflate_p.h | 6 ++++-- src/native/external/zlib-ng/deflate_quick.c | 3 ++- src/native/external/zlib-ng/deflate_rle.c | 4 +++- src/native/external/zlib-ng/deflate_slow.c | 3 ++- 13 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/native/external/zlib-ng/arch/arm/slide_hash_armv6.c b/src/native/external/zlib-ng/arch/arm/slide_hash_armv6.c index 07f71b59eb822a..da4f51e0afc824 100644 --- a/src/native/external/zlib-ng/arch/arm/slide_hash_armv6.c +++ b/src/native/external/zlib-ng/arch/arm/slide_hash_armv6.c @@ -39,7 +39,8 @@ static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize } Z_INTERNAL void slide_hash_armv6(deflate_state *s) { - unsigned int wsize = s->w_size; + Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); + uint16_t wsize = (uint16_t)s->w_size; slide_hash_chain(s->head, HASH_SIZE, wsize); slide_hash_chain(s->prev, wsize, wsize); diff --git a/src/native/external/zlib-ng/arch/arm/slide_hash_neon.c b/src/native/external/zlib-ng/arch/arm/slide_hash_neon.c index a601e6099ad7cc..f319f987908a22 100644 --- a/src/native/external/zlib-ng/arch/arm/slide_hash_neon.c +++ b/src/native/external/zlib-ng/arch/arm/slide_hash_neon.c @@ -38,7 +38,8 @@ static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize } Z_INTERNAL void slide_hash_neon(deflate_state *s) { - unsigned int wsize = s->w_size; + Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); + uint16_t wsize = (uint16_t)s->w_size; slide_hash_chain(s->head, HASH_SIZE, wsize); slide_hash_chain(s->prev, wsize, wsize); diff --git a/src/native/external/zlib-ng/arch/generic/crc32_braid_c.c b/src/native/external/zlib-ng/arch/generic/crc32_braid_c.c index 7d8028f6d70555..f80071042d77c6 100644 --- a/src/native/external/zlib-ng/arch/generic/crc32_braid_c.c +++ b/src/native/external/zlib-ng/arch/generic/crc32_braid_c.c @@ -192,7 +192,8 @@ Z_INTERNAL uint32_t PREFIX(crc32_braid)(uint32_t crc, const uint8_t *buf, size_t #endif #endif words += N; - c = ZSWAPWORD(comb); + Assert(comb <= UINT32_MAX, "comb should fit in uint32_t"); + c = (uint32_t)ZSWAPWORD(comb); /* Update the pointer to the remaining bytes to process. */ buf = (const unsigned char *)words; diff --git a/src/native/external/zlib-ng/arch/power/slide_ppc_tpl.h b/src/native/external/zlib-ng/arch/power/slide_ppc_tpl.h index 5c17e38fb31036..680a7f8e2af407 100644 --- a/src/native/external/zlib-ng/arch/power/slide_ppc_tpl.h +++ b/src/native/external/zlib-ng/arch/power/slide_ppc_tpl.h @@ -24,7 +24,8 @@ static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize } void Z_INTERNAL SLIDE_PPC(deflate_state *s) { - uint16_t wsize = s->w_size; + Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); + uint16_t wsize = (uint16_t)s->w_size; slide_hash_chain(s->head, HASH_SIZE, wsize); slide_hash_chain(s->prev, wsize, wsize); diff --git a/src/native/external/zlib-ng/arch/riscv/slide_hash_rvv.c b/src/native/external/zlib-ng/arch/riscv/slide_hash_rvv.c index ac28bbd9f26e5e..6f53d7a13ad81b 100644 --- a/src/native/external/zlib-ng/arch/riscv/slide_hash_rvv.c +++ b/src/native/external/zlib-ng/arch/riscv/slide_hash_rvv.c @@ -23,6 +23,7 @@ static inline void slide_hash_chain(Pos *table, uint32_t entries, uint16_t wsize } Z_INTERNAL void slide_hash_rvv(deflate_state *s) { + Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); uint16_t wsize = (uint16_t)s->w_size; slide_hash_chain(s->head, HASH_SIZE, wsize); diff --git a/src/native/external/zlib-ng/arch/x86/slide_hash_avx2.c b/src/native/external/zlib-ng/arch/x86/slide_hash_avx2.c index f49ad3331b8151..853347323436eb 100644 --- a/src/native/external/zlib-ng/arch/x86/slide_hash_avx2.c +++ b/src/native/external/zlib-ng/arch/x86/slide_hash_avx2.c @@ -31,6 +31,7 @@ static inline void slide_hash_chain(Pos *table, uint32_t entries, const __m256i } Z_INTERNAL void slide_hash_avx2(deflate_state *s) { + Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); uint16_t wsize = (uint16_t)s->w_size; const __m256i ymm_wsize = _mm256_set1_epi16((short)wsize); diff --git a/src/native/external/zlib-ng/arch/x86/slide_hash_sse2.c b/src/native/external/zlib-ng/arch/x86/slide_hash_sse2.c index cfdf7bee49852b..6900a59d15dfac 100644 --- a/src/native/external/zlib-ng/arch/x86/slide_hash_sse2.c +++ b/src/native/external/zlib-ng/arch/x86/slide_hash_sse2.c @@ -52,6 +52,7 @@ static inline void slide_hash_chain(Pos *table0, Pos *table1, uint32_t entries0, } Z_INTERNAL void slide_hash_sse2(deflate_state *s) { + Assert(s->w_size <= UINT16_MAX, "w_size should fit in uint16_t"); uint16_t wsize = (uint16_t)s->w_size; const __m128i xmm_wsize = _mm_set1_epi16((short)wsize); diff --git a/src/native/external/zlib-ng/deflate.c b/src/native/external/zlib-ng/deflate.c index 66b5506a521e5c..eb5ae0aabd5973 100644 --- a/src/native/external/zlib-ng/deflate.c +++ b/src/native/external/zlib-ng/deflate.c @@ -204,7 +204,7 @@ Z_INTERNAL deflate_allocs* alloc_deflate(PREFIX3(stream) *strm, int windowBits, /* Define sizes */ int window_size = DEFLATE_ADJUST_WINDOW_SIZE((1 << windowBits) * 2); - int prev_size = (1 << windowBits) * sizeof(Pos); + int prev_size = (1 << windowBits) * (int)sizeof(Pos); int head_size = HASH_SIZE * sizeof(Pos); int pending_size = lit_bufsize * LIT_BUFS; int state_size = sizeof(deflate_state); diff --git a/src/native/external/zlib-ng/deflate_fast.c b/src/native/external/zlib-ng/deflate_fast.c index 2d0444cd73bbfb..e682697d5cc518 100644 --- a/src/native/external/zlib-ng/deflate_fast.c +++ b/src/native/external/zlib-ng/deflate_fast.c @@ -58,7 +58,9 @@ Z_INTERNAL block_state deflate_fast(deflate_state *s, int flush) { } if (match_len >= WANT_MIN_MATCH) { - check_match(s, s->strstart, s->match_start, match_len); + Assert(s->strstart <= UINT16_MAX, "strstart should fit in uint16_t"); + Assert(s->match_start <= UINT16_MAX, "match_start should fit in uint16_t"); + check_match(s, (Pos)s->strstart, (Pos)s->match_start, match_len); bflush = zng_tr_tally_dist(s, s->strstart - s->match_start, match_len - STD_MIN_MATCH); diff --git a/src/native/external/zlib-ng/deflate_p.h b/src/native/external/zlib-ng/deflate_p.h index 7c74ebf5ad771a..abcc8b1c7c1255 100644 --- a/src/native/external/zlib-ng/deflate_p.h +++ b/src/native/external/zlib-ng/deflate_p.h @@ -78,8 +78,10 @@ static inline int zng_tr_tally_dist(deflate_state* s, uint32_t dist, uint32_t le /* dist: distance of matched string */ /* len: match length-STD_MIN_MATCH */ #ifdef LIT_MEM - s->d_buf[s->sym_next] = dist; - s->l_buf[s->sym_next++] = len; + Assert(dist <= UINT16_MAX, "dist should fit in uint16_t"); + Assert(len <= UINT8_MAX, "len should fit in uint8_t"); + s->d_buf[s->sym_next] = (uint16_t)dist; + s->l_buf[s->sym_next++] = (uint8_t)len; #else s->sym_buf[s->sym_next++] = (uint8_t)(dist); s->sym_buf[s->sym_next++] = (uint8_t)(dist >> 8); diff --git a/src/native/external/zlib-ng/deflate_quick.c b/src/native/external/zlib-ng/deflate_quick.c index 5a1937b6799028..91c96ac52ed32d 100644 --- a/src/native/external/zlib-ng/deflate_quick.c +++ b/src/native/external/zlib-ng/deflate_quick.c @@ -102,7 +102,8 @@ Z_INTERNAL block_state deflate_quick(deflate_state *s, int flush) { if (UNLIKELY(match_len > STD_MAX_MATCH)) match_len = STD_MAX_MATCH; - check_match(s, s->strstart, hash_head, match_len); + Assert(s->strstart <= UINT16_MAX, "strstart should fit in uint16_t"); + check_match(s, (Pos)s->strstart, hash_head, match_len); zng_tr_emit_dist(s, static_ltree, static_dtree, match_len - STD_MIN_MATCH, (uint32_t)dist); s->lookahead -= match_len; diff --git a/src/native/external/zlib-ng/deflate_rle.c b/src/native/external/zlib-ng/deflate_rle.c index ee442141bea0d3..fb17a63c5eb262 100644 --- a/src/native/external/zlib-ng/deflate_rle.c +++ b/src/native/external/zlib-ng/deflate_rle.c @@ -58,7 +58,9 @@ Z_INTERNAL block_state deflate_rle(deflate_state *s, int flush) { /* Emit match if have run of STD_MIN_MATCH or longer, else emit literal */ if (match_len >= STD_MIN_MATCH) { - check_match(s, s->strstart, s->strstart - 1, match_len); + Assert(s->strstart <= UINT16_MAX, "strstart should fit in uint16_t"); + Assert(s->match_start <= UINT16_MAX, "match_start should fit in uint16_t"); + check_match(s, (Pos)s->strstart, (Pos)(s->strstart - 1), match_len); bflush = zng_tr_tally_dist(s, 1, match_len - STD_MIN_MATCH); diff --git a/src/native/external/zlib-ng/deflate_slow.c b/src/native/external/zlib-ng/deflate_slow.c index de70cc1bba0bb4..b5bea7ab903c98 100644 --- a/src/native/external/zlib-ng/deflate_slow.c +++ b/src/native/external/zlib-ng/deflate_slow.c @@ -78,7 +78,8 @@ Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) { unsigned int max_insert = s->strstart + s->lookahead - STD_MIN_MATCH; /* Do not insert strings in hash table beyond this. */ - check_match(s, s->strstart-1, s->prev_match, s->prev_length); + Assert((s->strstart-1) <= UINT16_MAX, "strstart-1 should fit in uint16_t"); + check_match(s, (Pos)(s->strstart-1), s->prev_match, s->prev_length); bflush = zng_tr_tally_dist(s, s->strstart -1 - s->prev_match, s->prev_length - STD_MIN_MATCH); From af2b2f599c9cda5eb9858f05a5106123e26e24c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?= <1175054+carlossanlop@users.noreply.github.com> Date: Wed, 4 Sep 2024 17:45:00 -0700 Subject: [PATCH 104/748] Remove custom allocator. --- .../CMakeLists.txt | 6 - .../System.IO.Compression.Native/pal_zlib.c | 4 - .../zlib_allocator.h | 8 - .../zlib_allocator_unix.c | 156 --------------- .../zlib_allocator_win.c | 180 ------------------ 5 files changed, 354 deletions(-) delete mode 100644 src/native/libs/System.IO.Compression.Native/zlib_allocator.h delete mode 100644 src/native/libs/System.IO.Compression.Native/zlib_allocator_unix.c delete mode 100644 src/native/libs/System.IO.Compression.Native/zlib_allocator_win.c diff --git a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt index 69d333ae53f9c5..f852547678326b 100644 --- a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt +++ b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt @@ -14,12 +14,6 @@ set(NATIVECOMPRESSION_SOURCES pal_zlib.c ) -if (HOST_WIN32 OR CLR_CMAKE_TARGET_WIN32) - list(APPEND NATIVECOMPRESSION_SOURCES "zlib_allocator_win.c") -else() - list(APPEND NATIVECOMPRESSION_SOURCES "zlib_allocator_unix.c") -endif() - if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) if (CLR_CMAKE_USE_SYSTEM_BROTLI) diff --git a/src/native/libs/System.IO.Compression.Native/pal_zlib.c b/src/native/libs/System.IO.Compression.Native/pal_zlib.c index 87b7043ea20ffd..a04f60aa876a88 100644 --- a/src/native/libs/System.IO.Compression.Native/pal_zlib.c +++ b/src/native/libs/System.IO.Compression.Native/pal_zlib.c @@ -11,7 +11,6 @@ #else #include "pal_utilities.h" #endif -#include #include c_static_assert(PAL_Z_NOFLUSH == Z_NO_FLUSH); @@ -40,9 +39,6 @@ static int32_t Init(PAL_ZStream* stream) { z_stream* zStream = (z_stream*)calloc(1, sizeof(z_stream)); - zStream->zalloc = z_custom_calloc; - zStream->zfree = z_custom_cfree; - stream->internalState = zStream; if (zStream != NULL) diff --git a/src/native/libs/System.IO.Compression.Native/zlib_allocator.h b/src/native/libs/System.IO.Compression.Native/zlib_allocator.h deleted file mode 100644 index cadd00bb5879c5..00000000000000 --- a/src/native/libs/System.IO.Compression.Native/zlib_allocator.h +++ /dev/null @@ -1,8 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#include // voidpf - -voidpf z_custom_calloc(voidpf opaque, unsigned items, unsigned size); - -void z_custom_cfree(voidpf opaque, voidpf ptr); diff --git a/src/native/libs/System.IO.Compression.Native/zlib_allocator_unix.c b/src/native/libs/System.IO.Compression.Native/zlib_allocator_unix.c deleted file mode 100644 index b2c898f70a4e36..00000000000000 --- a/src/native/libs/System.IO.Compression.Native/zlib_allocator_unix.c +++ /dev/null @@ -1,156 +0,0 @@ -// 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 -#include - -/* 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. - */ - -#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 z_custom_calloc(opaque, items, size) - voidpf opaque; - unsigned items; - unsigned size; -{ - (void)opaque; // unreferenced formal parameter - - // 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 z_custom_cfree(opaque, ptr) - voidpf opaque; - voidpf ptr; -{ - (void)opaque; // unreferenced formal parameter - - 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/native/libs/System.IO.Compression.Native/zlib_allocator_win.c b/src/native/libs/System.IO.Compression.Native/zlib_allocator_win.c deleted file mode 100644 index fefba550c16ed5..00000000000000 --- a/src/native/libs/System.IO.Compression.Native/zlib_allocator_win.c +++ /dev/null @@ -1,180 +0,0 @@ -// 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 */ - -#include -#include -#include -#include - -/* 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. - */ - -// 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 z_custom_calloc(opaque, items, size) - voidpf opaque; - unsigned items; - unsigned size; -{ - (void)opaque; // suppress C4100 - unreferenced formal parameter - - // 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 z_custom_cfree(opaque, ptr) - voidpf opaque; - voidpf ptr; -{ - (void)opaque; // suppress C4100 - unreferenced formal parameter - - 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(); -} From 15c5c2c7acf67d2c5a32e10645b4f58fd29f8a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20S=C3=A1nchez=20L=C3=B3pez?= <1175054+carlossanlop@users.noreply.github.com> Date: Wed, 4 Sep 2024 17:45:37 -0700 Subject: [PATCH 105/748] Update Compression unit tests. --- .../ZLibNative.CompressionLevel.cs | 49 +++++++++++++++++++ .../src/System/IO/Compression/ZLibNative.cs | 42 ---------------- .../CompressionStreamUnitTestBase.cs | 46 ++++++++--------- .../System.IO.Compression.Brotli.Tests.csproj | 2 + .../src/System.IO.Compression.csproj | 2 + .../CompressionStreamUnitTests.Deflate.cs | 7 --- .../tests/CompressionStreamUnitTests.Gzip.cs | 7 --- .../tests/CompressionStreamUnitTests.ZLib.cs | 7 --- .../tests/System.IO.Compression.Tests.csproj | 2 + .../src/System.Net.WebSockets.csproj | 2 + 10 files changed, 81 insertions(+), 85 deletions(-) create mode 100644 src/libraries/Common/src/System/IO/Compression/ZLibNative.CompressionLevel.cs diff --git a/src/libraries/Common/src/System/IO/Compression/ZLibNative.CompressionLevel.cs b/src/libraries/Common/src/System/IO/Compression/ZLibNative.CompressionLevel.cs new file mode 100644 index 00000000000000..4d55f6373ef6f9 --- /dev/null +++ b/src/libraries/Common/src/System/IO/Compression/ZLibNative.CompressionLevel.cs @@ -0,0 +1,49 @@ +// 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.Compression; + +internal static partial class ZLibNative +{ + /// + ///

ZLib can accept any integer value between 0 and 9 (inclusive) as a valid compression level parameter: + /// 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). + /// CompressionLevel.DefaultCompression = -1 requests a default compromise between speed and compression + /// (currently equivalent to level 6).

+ /// + ///

How to choose a compression level:

+ /// + ///

The names NoCompression, BestSpeed, DefaultCompression, BestCompression are taken over from + /// the corresponding ZLib definitions, which map to our public NoCompression, Fastest, Optimal, and SmallestSize respectively.

+ ///

Optimal Compression:

+ ///

ZLibNative.CompressionLevel compressionLevel = ZLibNative.CompressionLevel.DefaultCompression;
+ /// int windowBits = 15; // or -15 if no headers required
+ /// int memLevel = 8;
+ /// ZLibNative.CompressionStrategy strategy = ZLibNative.CompressionStrategy.DefaultStrategy;

+ /// + ///

Fastest compression:

+ ///

ZLibNative.CompressionLevel compressionLevel = ZLibNative.CompressionLevel.BestSpeed;
+ /// int windowBits = 15; // or -15 if no headers required
+ /// int memLevel = 8;
+ /// ZLibNative.CompressionStrategy strategy = ZLibNative.CompressionStrategy.DefaultStrategy;

+ /// + ///

No compression (even faster, useful for data that cannot be compressed such some image formats):

+ ///

ZLibNative.CompressionLevel compressionLevel = ZLibNative.CompressionLevel.NoCompression;
+ /// int windowBits = 15; // or -15 if no headers required
+ /// int memLevel = 7;
+ /// ZLibNative.CompressionStrategy strategy = ZLibNative.CompressionStrategy.DefaultStrategy;

+ /// + ///

Smallest Size Compression:

+ ///

ZLibNative.CompressionLevel compressionLevel = ZLibNative.CompressionLevel.BestCompression;
+ /// int windowBits = 15; // or -15 if no headers required
+ /// int memLevel = 8;
+ /// ZLibNative.CompressionStrategy strategy = ZLibNative.CompressionStrategy.DefaultStrategy;

+ ///
+ public enum CompressionLevel : int + { + NoCompression = 0, + BestSpeed = 1, + DefaultCompression = -1, + BestCompression = 9 + } +} diff --git a/src/libraries/Common/src/System/IO/Compression/ZLibNative.cs b/src/libraries/Common/src/System/IO/Compression/ZLibNative.cs index 0113334b964e16..f5c7cf8077380d 100644 --- a/src/libraries/Common/src/System/IO/Compression/ZLibNative.cs +++ b/src/libraries/Common/src/System/IO/Compression/ZLibNative.cs @@ -37,48 +37,6 @@ public enum ErrorCode : int VersionError = -6 } - /// - ///

ZLib can accept any integer value between 0 and 9 (inclusive) as a valid compression level parameter: - /// 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). - /// CompressionLevel.DefaultCompression = -1 requests a default compromise between speed and compression - /// (currently equivalent to level 6).

- /// - ///

How to choose a compression level:

- /// - ///

The names NoCompression, BestSpeed, DefaultCompression, BestCompression are taken over from - /// the corresponding ZLib definitions, which map to our public NoCompression, Fastest, Optimal, and SmallestSize respectively.

- ///

Optimal Compression:

- ///

ZLibNative.CompressionLevel compressionLevel = ZLibNative.CompressionLevel.DefaultCompression;
- /// int windowBits = 15; // or -15 if no headers required
- /// int memLevel = 8;
- /// ZLibNative.CompressionStrategy strategy = ZLibNative.CompressionStrategy.DefaultStrategy;

- /// - ///

Fastest compression:

- ///

ZLibNative.CompressionLevel compressionLevel = ZLibNative.CompressionLevel.BestSpeed;
- /// int windowBits = 15; // or -15 if no headers required
- /// int memLevel = 8;
- /// ZLibNative.CompressionStrategy strategy = ZLibNative.CompressionStrategy.DefaultStrategy;

- /// - ///

No compression (even faster, useful for data that cannot be compressed such some image formats):

- ///

ZLibNative.CompressionLevel compressionLevel = ZLibNative.CompressionLevel.NoCompression;
- /// int windowBits = 15; // or -15 if no headers required
- /// int memLevel = 7;
- /// ZLibNative.CompressionStrategy strategy = ZLibNative.CompressionStrategy.DefaultStrategy;

- /// - ///

Smallest Size Compression:

- ///

ZLibNative.CompressionLevel compressionLevel = ZLibNative.CompressionLevel.BestCompression;
- /// int windowBits = 15; // or -15 if no headers required
- /// int memLevel = 8;
- /// ZLibNative.CompressionStrategy strategy = ZLibNative.CompressionStrategy.DefaultStrategy;

- ///
- public enum CompressionLevel : int - { - NoCompression = 0, - BestSpeed = 1, - DefaultCompression = -1, - BestCompression = 9 - } - ///
///

From the ZLib manual:

///

CompressionStrategy is used to tune the compression algorithm.
diff --git a/src/libraries/Common/tests/System/IO/Compression/CompressionStreamUnitTestBase.cs b/src/libraries/Common/tests/System/IO/Compression/CompressionStreamUnitTestBase.cs index ed6f78c56d2cd6..a6635777f85832 100644 --- a/src/libraries/Common/tests/System/IO/Compression/CompressionStreamUnitTestBase.cs +++ b/src/libraries/Common/tests/System/IO/Compression/CompressionStreamUnitTestBase.cs @@ -497,6 +497,30 @@ async Task GetLengthAsync(CompressionLevel compressionLevel) Assert.True(optimalLength >= smallestLength); } + [Theory] + [MemberData(nameof(UncompressedTestFilesZLib))] + public async Task ZLibCompressionOptions_SizeInOrder(string testFile) + { + using var uncompressedStream = await LocalMemoryStream.readAppFileAsync(testFile); + + async Task GetLengthAsync(int compressionLevel) + { + uncompressedStream.Position = 0; + using var mms = new MemoryStream(); + using var compressor = CreateStream(mms, new ZLibCompressionOptions() { CompressionLevel = compressionLevel, CompressionStrategy = ZLibCompressionStrategy.Default }, leaveOpen: false); + await uncompressedStream.CopyToAsync(compressor); + await compressor.FlushAsync(); + return mms.Length; + } + + long fastestLength = await GetLengthAsync(1); + long optimalLength = await GetLengthAsync(5); + long smallestLength = await GetLengthAsync(9); + + Assert.True(fastestLength >= optimalLength); + Assert.True(optimalLength >= smallestLength); + } + [Theory] [MemberData(nameof(ZLibOptionsRoundTripTestData))] public async Task RoundTripWithZLibCompressionOptions(string testFile, ZLibCompressionOptions options) @@ -537,28 +561,6 @@ private async Task CompressTestFile(LocalMemoryStream testStream, return compressorOutput; } - protected async Task CompressionLevel_SizeInOrderBase(string testFile) - { - using var uncompressedStream = await LocalMemoryStream.readAppFileAsync(testFile); - - async Task GetLengthAsync(int compressionLevel) - { - uncompressedStream.Position = 0; - using var mms = new MemoryStream(); - using var compressor = CreateStream(mms, new ZLibCompressionOptions() { CompressionLevel = compressionLevel, CompressionStrategy = ZLibCompressionStrategy.Default }, leaveOpen: false); - await uncompressedStream.CopyToAsync(compressor); - await compressor.FlushAsync(); - return mms.Length; - } - - long prev = await GetLengthAsync(0); - for (int i = 1; i < 10; i++) - { - long cur = await GetLengthAsync(i); - Assert.True(cur <= prev, $"Expected {cur} <= {prev} for quality {i}"); - prev = cur; - } - } } public enum TestScenario diff --git a/src/libraries/System.IO.Compression.Brotli/tests/System.IO.Compression.Brotli.Tests.csproj b/src/libraries/System.IO.Compression.Brotli/tests/System.IO.Compression.Brotli.Tests.csproj index 167caaaa6bc847..936e3768a0e4eb 100644 --- a/src/libraries/System.IO.Compression.Brotli/tests/System.IO.Compression.Brotli.Tests.csproj +++ b/src/libraries/System.IO.Compression.Brotli/tests/System.IO.Compression.Brotli.Tests.csproj @@ -27,6 +27,8 @@ + diff --git a/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj b/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj index 208844b5d67aae..9292ec1f46d838 100644 --- a/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj +++ b/src/libraries/System.IO.Compression/src/System.IO.Compression.csproj @@ -35,6 +35,8 @@ + diff --git a/src/libraries/System.IO.Compression/tests/CompressionStreamUnitTests.Deflate.cs b/src/libraries/System.IO.Compression/tests/CompressionStreamUnitTests.Deflate.cs index 9c25d5e5483fbd..d91a243b907cc1 100644 --- a/src/libraries/System.IO.Compression/tests/CompressionStreamUnitTests.Deflate.cs +++ b/src/libraries/System.IO.Compression/tests/CompressionStreamUnitTests.Deflate.cs @@ -219,12 +219,5 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati return base.WriteAsync(buffer, offset, count, cancellationToken); } } - - [Theory] - [MemberData(nameof(UncompressedTestFilesZLib))] - public async Task ZLibCompressionLevel_SizeInOrder(string testFile) - { - await CompressionLevel_SizeInOrderBase(testFile); - } } } diff --git a/src/libraries/System.IO.Compression/tests/CompressionStreamUnitTests.Gzip.cs b/src/libraries/System.IO.Compression/tests/CompressionStreamUnitTests.Gzip.cs index 9fabd3dc31a266..9919b2c819ae30 100644 --- a/src/libraries/System.IO.Compression/tests/CompressionStreamUnitTests.Gzip.cs +++ b/src/libraries/System.IO.Compression/tests/CompressionStreamUnitTests.Gzip.cs @@ -441,12 +441,5 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati return base.WriteAsync(buffer, offset, count, cancellationToken); } } - - [Theory] - [MemberData(nameof(UncompressedTestFilesZLib))] - public async Task ZLibCompressionLevel_SizeInOrder(string testFile) - { - await CompressionLevel_SizeInOrderBase(testFile); - } } } diff --git a/src/libraries/System.IO.Compression/tests/CompressionStreamUnitTests.ZLib.cs b/src/libraries/System.IO.Compression/tests/CompressionStreamUnitTests.ZLib.cs index ea868cdcf1f448..bed459833e182a 100644 --- a/src/libraries/System.IO.Compression/tests/CompressionStreamUnitTests.ZLib.cs +++ b/src/libraries/System.IO.Compression/tests/CompressionStreamUnitTests.ZLib.cs @@ -150,12 +150,5 @@ public void StreamTruncation_IsDetected(TestScenario testScenario) } }, testScenario.ToString()).Dispose(); } - - [Theory] - [MemberData(nameof(UncompressedTestFilesZLib))] - public async Task ZLibCompressionLevel_SizeInOrder(string testFile) - { - await CompressionLevel_SizeInOrderBase(testFile); - } } } diff --git a/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj b/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj index be6e981939a7fc..286ffea2850253 100644 --- a/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj +++ b/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj @@ -35,6 +35,8 @@ + diff --git a/src/libraries/System.Net.WebSockets/src/System.Net.WebSockets.csproj b/src/libraries/System.Net.WebSockets/src/System.Net.WebSockets.csproj index 177e95dacee0a7..b60a0bf8cc463f 100644 --- a/src/libraries/System.Net.WebSockets/src/System.Net.WebSockets.csproj +++ b/src/libraries/System.Net.WebSockets/src/System.Net.WebSockets.csproj @@ -37,6 +37,8 @@ Link="Common\System\Net\WebSockets\WebSocketValidate.cs" /> + Date: Wed, 4 Sep 2024 18:01:24 -0700 Subject: [PATCH 106/748] cgmanifest.json, zlib-ng-version.txt, THIRD-PARTY-NOTICES.TXT updates. --- THIRD-PARTY-NOTICES.TXT | 20 ++++++++++++++------ src/native/external/cgmanifest.json | 2 +- src/native/external/zlib-ng-version.txt | 10 +++++----- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/THIRD-PARTY-NOTICES.TXT b/THIRD-PARTY-NOTICES.TXT index 18e149ccfd170d..3dc0d7aa859799 100644 --- a/THIRD-PARTY-NOTICES.TXT +++ b/THIRD-PARTY-NOTICES.TXT @@ -69,19 +69,27 @@ written authorization of the copyright holder. License notice for zlib-ng ----------------------- -https://github.com/zlib-ng/zlib-ng/blob/develop/LICENSE.md +https://github.com/zlib-ng/zlib-ng/blob/d54e3769be0c522015b784eca2af258b1c026107/LICENSE.md (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 arising from the use of this software. +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: +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: -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. +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. -Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. -This notice may not be removed or altered from any source distribution. +3. This notice may not be removed or altered from any source distribution. License notice for LinuxTracepoints ----------------------------------- diff --git a/src/native/external/cgmanifest.json b/src/native/external/cgmanifest.json index 242a6d7d4d054b..8c94e1129a1538 100644 --- a/src/native/external/cgmanifest.json +++ b/src/native/external/cgmanifest.json @@ -46,7 +46,7 @@ "Type": "git", "Git": { "RepositoryUrl": "https://github.com/zlib-ng/zlib-ng", - "CommitHash": "74253725f884e2424a0dd8ae3f69896d5377f325" + "CommitHash": "d54e3769be0c522015b784eca2af258b1c026107" } }, "DevelopmentDependency": false diff --git a/src/native/external/zlib-ng-version.txt b/src/native/external/zlib-ng-version.txt index 4292d95a0fca5d..70d6d1f88b75ea 100644 --- a/src/native/external/zlib-ng-version.txt +++ b/src/native/external/zlib-ng-version.txt @@ -1,12 +1,12 @@ -v2.1.6 -74253725f884e2424a0dd8ae3f69896d5377f325 +v2.2.1 +d54e3769be0c522015b784eca2af258b1c026107 -https://github.com/zlib-ng/zlib-ng/releases/tag/2.1.6 +https://github.com/zlib-ng/zlib-ng/releases/tag/2.2.1 We have removed the following folders from our local copy as these files are not needed for our compilation: -- zlib-ng/docs/ +- zlib-ng/doc/ - zlib-ng/test/ - zlib-ng/arch/s390/self-hosted-builder/ -Apply https://github.com/dotnet/runtime/pull/105433.patch \ No newline at end of file +Also, if the next version does not yet contain the fixes included in 12bc7edc73308f017ec40c6b2db694a6e3490ac2, cherry-pick it as a patch. From 1e9ce3a2b2844239b87c93d4a8547245b00656c6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:05:40 -0600 Subject: [PATCH 107/748] Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20240904.1 (#107383) Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers From Version 3.11.0-beta1.24425.2 -> To Version 3.11.0-beta1.24454.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2ba82b7c640940..11623d24ada34b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -368,13 +368,13 @@ https://github.com/dotnet/roslyn d30a570bb6c9b2f204db9e6ee65fc5316449fd4e - + https://github.com/dotnet/roslyn-analyzers - 930872ad8817ff59fbb4454e79edf738904d173a + a7c74cf887abe4a38240bc4ead0b221d9d42434f - + https://github.com/dotnet/roslyn-analyzers - 930872ad8817ff59fbb4454e79edf738904d173a + a7c74cf887abe4a38240bc4ead0b221d9d42434f diff --git a/eng/Versions.props b/eng/Versions.props index 70f19636470d6f..cf5cedd742654b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -34,8 +34,8 @@ - 3.11.0-beta1.24425.2 - 9.0.0-preview.24425.2 + 3.11.0-beta1.24454.1 + 9.0.0-preview.24454.1 - + https://github.com/dotnet/emsdk - c136d56093029c7dc696fd9cc15a4381077390f4 + c8026c0932574ddad057e54d983ab8c2ba082b93 diff --git a/eng/Versions.props b/eng/Versions.props index cf5cedd742654b..ecbabc5f52f7f8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -239,7 +239,7 @@ Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-9_0_100_Transport --> - 9.0.0-rc.2.24453.3 + 9.0.0-rc.2.24454.2 $(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion) 1.1.87-gba258badda From ee46f01b971bb05afec067f2aaa25daa015bec86 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Thu, 5 Sep 2024 14:29:40 -0700 Subject: [PATCH 109/748] Upgrade vendored Brotli dependency to v1.1.0 (#106994) (#107102) --- src/native/external/brotli-version.txt | 8 +- src/native/external/brotli.cmake | 2 + src/native/external/brotli/common/constants.c | 2 +- src/native/external/brotli/common/constants.h | 3 +- src/native/external/brotli/common/context.c | 2 +- .../external/brotli/common/dictionary.bin | 432 ------- .../external/brotli/common/dictionary.bin.br | Bin 51687 -> 0 bytes .../external/brotli/common/dictionary.c | 8 +- src/native/external/brotli/common/platform.c | 3 +- src/native/external/brotli/common/platform.h | 173 +-- .../brotli/common/shared_dictionary.c | 521 ++++++++ .../common/shared_dictionary_internal.h | 75 ++ src/native/external/brotli/common/transform.c | 2 +- src/native/external/brotli/common/version.h | 37 +- src/native/external/brotli/dec/bit_reader.c | 18 +- src/native/external/brotli/dec/bit_reader.h | 272 ++-- src/native/external/brotli/dec/decode.c | 671 +++++++--- src/native/external/brotli/dec/huffman.c | 11 +- src/native/external/brotli/dec/huffman.h | 3 +- src/native/external/brotli/dec/prefix.h | 3 +- src/native/external/brotli/dec/state.c | 42 +- src/native/external/brotli/dec/state.h | 105 +- .../external/brotli/enc/backward_references.c | 100 +- .../external/brotli/enc/backward_references.h | 9 +- .../brotli/enc/backward_references_hq.c | 200 ++- .../brotli/enc/backward_references_hq.h | 11 +- .../brotli/enc/backward_references_inc.h | 36 +- src/native/external/brotli/enc/bit_cost.c | 15 +- src/native/external/brotli/enc/bit_cost.h | 9 +- .../external/brotli/enc/block_splitter.c | 51 +- .../external/brotli/enc/block_splitter.h | 9 +- .../external/brotli/enc/block_splitter_inc.h | 131 +- .../external/brotli/enc/brotli_bit_stream.c | 242 ++-- .../external/brotli/enc/brotli_bit_stream.h | 17 +- src/native/external/brotli/enc/cluster.c | 19 +- src/native/external/brotli/enc/cluster.h | 13 +- src/native/external/brotli/enc/cluster_inc.h | 45 +- src/native/external/brotli/enc/command.c | 2 +- src/native/external/brotli/enc/command.h | 9 +- .../external/brotli/enc/compound_dictionary.c | 207 +++ .../external/brotli/enc/compound_dictionary.h | 74 ++ .../external/brotli/enc/compress_fragment.c | 176 +-- .../external/brotli/enc/compress_fragment.h | 39 +- .../brotli/enc/compress_fragment_two_pass.c | 186 +-- .../brotli/enc/compress_fragment_two_pass.h | 24 +- .../external/brotli/enc/dictionary_hash.c | 4 +- src/native/external/brotli/enc/encode.c | 877 +++++++------ src/native/external/brotli/enc/encoder_dict.c | 615 ++++++++- src/native/external/brotli/enc/encoder_dict.h | 120 +- .../external/brotli/enc/entropy_encode.c | 5 +- .../external/brotli/enc/entropy_encode.h | 3 +- .../brotli/enc/entropy_encode_static.h | 7 +- src/native/external/brotli/enc/fast_log.c | 2 +- src/native/external/brotli/enc/fast_log.h | 3 +- .../external/brotli/enc/find_match_length.h | 37 +- src/native/external/brotli/enc/hash.h | 330 ++++- .../external/brotli/enc/hash_composite_inc.h | 37 +- .../brotli/enc/hash_forgetful_chain_inc.h | 38 +- .../brotli/enc/hash_longest_match64_inc.h | 73 +- .../brotli/enc/hash_longest_match_inc.h | 16 +- .../enc/hash_longest_match_quickly_inc.h | 8 +- .../external/brotli/enc/hash_rolling_inc.h | 8 +- .../brotli/enc/hash_to_binary_tree_inc.h | 11 +- src/native/external/brotli/enc/histogram.c | 8 +- src/native/external/brotli/enc/histogram.h | 13 +- src/native/external/brotli/enc/literal_cost.c | 35 +- src/native/external/brotli/enc/literal_cost.h | 6 +- src/native/external/brotli/enc/memory.c | 34 +- src/native/external/brotli/enc/memory.h | 21 +- src/native/external/brotli/enc/metablock.c | 130 +- src/native/external/brotli/enc/metablock.h | 17 +- .../external/brotli/enc/metablock_inc.h | 14 +- src/native/external/brotli/enc/params.h | 7 +- src/native/external/brotli/enc/prefix.h | 5 +- src/native/external/brotli/enc/quality.h | 43 +- src/native/external/brotli/enc/ringbuffer.h | 7 +- src/native/external/brotli/enc/state.h | 104 ++ src/native/external/brotli/enc/static_dict.c | 64 +- src/native/external/brotli/enc/static_dict.h | 5 +- .../external/brotli/enc/static_dict_lut.h | 2 + src/native/external/brotli/enc/utf8_util.c | 2 +- src/native/external/brotli/enc/utf8_util.h | 3 +- src/native/external/brotli/enc/write_bits.h | 3 +- .../external/brotli/fuzz/decode_fuzzer.c | 58 - .../external/brotli/fuzz/run_decode_fuzzer.c | 44 - .../external/brotli/fuzz/test_fuzzer.sh | 33 - .../external/brotli/include/brotli/decode.h | 69 +- .../external/brotli/include/brotli/encode.h | 57 +- .../external/brotli/include/brotli/port.h | 39 +- .../brotli/include/brotli/shared_dictionary.h | 100 ++ src/native/external/brotli/tools/brotli.c | 1116 ----------------- src/native/external/brotli/tools/brotli.md | 107 -- src/native/external/cgmanifest.json | 2 +- .../CMakeLists.txt | 6 - 94 files changed, 4866 insertions(+), 3499 deletions(-) delete mode 100644 src/native/external/brotli/common/dictionary.bin delete mode 100644 src/native/external/brotli/common/dictionary.bin.br create mode 100644 src/native/external/brotli/common/shared_dictionary.c create mode 100644 src/native/external/brotli/common/shared_dictionary_internal.h create mode 100644 src/native/external/brotli/enc/compound_dictionary.c create mode 100644 src/native/external/brotli/enc/compound_dictionary.h create mode 100644 src/native/external/brotli/enc/state.h delete mode 100644 src/native/external/brotli/fuzz/decode_fuzzer.c delete mode 100644 src/native/external/brotli/fuzz/run_decode_fuzzer.c delete mode 100755 src/native/external/brotli/fuzz/test_fuzzer.sh create mode 100644 src/native/external/brotli/include/brotli/shared_dictionary.h delete mode 100644 src/native/external/brotli/tools/brotli.c delete mode 100644 src/native/external/brotli/tools/brotli.md diff --git a/src/native/external/brotli-version.txt b/src/native/external/brotli-version.txt index ea196f8138c24f..6842f9f3c8b3e2 100644 --- a/src/native/external/brotli-version.txt +++ b/src/native/external/brotli-version.txt @@ -1,2 +1,6 @@ -1.0.9 -https://github.com/google/brotli/releases/tag/v1.0.9 +1.1.0 +https://github.com/google/brotli/releases/tag/v1.1.0 + +Copy the c/dec, c/enc, c/common, and c/include folders into the root and remove all other files. + +Apply https://github.com/google/brotli/commit/85d88cbfc2b742e0742286ec277b73bdbf7be433.patch \ No newline at end of file diff --git a/src/native/external/brotli.cmake b/src/native/external/brotli.cmake index bf72e767cc659b..c8f1b153af3465 100644 --- a/src/native/external/brotli.cmake +++ b/src/native/external/brotli.cmake @@ -7,6 +7,7 @@ set (BROTLI_SOURCES_BASE common/context.c common/dictionary.c common/platform.c + common/shared_dictionary.c common/transform.c dec/bit_reader.c dec/decode.c @@ -19,6 +20,7 @@ set (BROTLI_SOURCES_BASE enc/brotli_bit_stream.c enc/cluster.c enc/command.c + enc/compound_dictionary.c enc/compress_fragment.c enc/compress_fragment_two_pass.c enc/dictionary_hash.c diff --git a/src/native/external/brotli/common/constants.c b/src/native/external/brotli/common/constants.c index 6bad9f613ca5d4..89866b150503c6 100644 --- a/src/native/external/brotli/common/constants.c +++ b/src/native/external/brotli/common/constants.c @@ -4,7 +4,7 @@ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ -#include "./constants.h" +#include "constants.h" const BrotliPrefixCodeRange _kBrotliPrefixCodeRanges[BROTLI_NUM_BLOCK_LEN_SYMBOLS] = { diff --git a/src/native/external/brotli/common/constants.h b/src/native/external/brotli/common/constants.h index e848195a0dc20f..31e5bd376e90fc 100644 --- a/src/native/external/brotli/common/constants.h +++ b/src/native/external/brotli/common/constants.h @@ -12,10 +12,11 @@ #ifndef BROTLI_COMMON_CONSTANTS_H_ #define BROTLI_COMMON_CONSTANTS_H_ -#include "./platform.h" #include #include +#include "platform.h" + /* Specification: 7.3. Encoding of the context map */ #define BROTLI_CONTEXT_MAP_MAX_RLE 16 diff --git a/src/native/external/brotli/common/context.c b/src/native/external/brotli/common/context.c index 2c2dceba9b6229..7f9c95869917b3 100644 --- a/src/native/external/brotli/common/context.c +++ b/src/native/external/brotli/common/context.c @@ -1,4 +1,4 @@ -#include "./context.h" +#include "context.h" #include diff --git a/src/native/external/brotli/common/dictionary.bin b/src/native/external/brotli/common/dictionary.bin deleted file mode 100644 index a585c0e292eba1..00000000000000 --- a/src/native/external/brotli/common/dictionary.bin +++ /dev/null @@ -1,432 +0,0 @@ -timedownlifeleftbackcodedatashowonlysitecityopenjustlikefreeworktextyearoverbodyloveformbookplaylivelinehelphomesidemorewordlongthemviewfindpagedaysfullheadtermeachareafromtruemarkableuponhighdatelandnewsevennextcasebothpostusedmadehandherewhatnameLinkblogsizebaseheldmakemainuser') +holdendswithNewsreadweresigntakehavegameseencallpathwellplusmenufilmpartjointhislistgoodneedwayswestjobsmindalsologorichuseslastteamarmyfoodkingwilleastwardbestfirePageknowaway.pngmovethanloadgiveselfnotemuchfeedmanyrockicononcelookhidediedHomerulehostajaxinfoclublawslesshalfsomesuchzone100%onescareTimeracebluefourweekfacehopegavehardlostwhenparkkeptpassshiproomHTMLplanTypedonesavekeepflaglinksoldfivetookratetownjumpthusdarkcardfilefearstaykillthatfallautoever.comtalkshopvotedeepmoderestturnbornbandfellroseurl(skinrolecomeactsagesmeetgold.jpgitemvaryfeltthensenddropViewcopy1.0"
stopelseliestourpack.gifpastcss?graymean>rideshotlatesaidroadvar feeljohnrickportfast'UA-dead
poorbilltypeU.S.woodmust2px;Inforankwidewantwalllead[0];paulwavesure$('#waitmassarmsgoesgainlangpaid!-- lockunitrootwalkfirmwifexml"songtest20pxkindrowstoolfontmailsafestarmapscorerainflowbabyspansays4px;6px;artsfootrealwikiheatsteptriporg/lakeweaktoldFormcastfansbankveryrunsjulytask1px;goalgrewslowedgeid="sets5px;.js?40pxif (soonseatnonetubezerosentreedfactintogiftharm18pxcamehillboldzoomvoideasyringfillpeakinitcost3px;jacktagsbitsrolleditknewnearironfreddiskwentsoilputs/js/holyT22:ISBNT20:adamsees

json', 'contT21: RSSloopasiamoon

soulLINEfortcartT14:

80px!--<9px;T04:mike:46ZniceinchYorkricezh:ä'));puremageparatonebond:37Z_of_']);000,zh:çtankyardbowlbush:56ZJava30px -|} -%C3%:34ZjeffEXPIcashvisagolfsnowzh:équer.csssickmeatmin.binddellhirepicsrent:36ZHTTP-201fotowolfEND xbox:54ZBODYdick; -} -exit:35Zvarsbeat'});diet999;anne}}sonyguysfuckpipe|- -!002)ndow[1];[]; -Log salt - bangtrimbath){ -00px -});ko:ìfeesad> s:// [];tollplug(){ -{ - .js'200pdualboat.JPG); -}quot); - -'); - -} 201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037201320122011201020092008200720062005200420032002200120001999199819971996199519941993199219911990198919881987198619851984198319821981198019791978197719761975197419731972197119701969196819671966196519641963196219611960195919581957195619551954195319521951195010001024139400009999comomásesteestaperotodohacecadaañobiendíaasívidacasootroforosolootracualdijosidograntipotemadebealgoquéestonadatrespococasabajotodasinoaguapuesunosantediceluisellamayozonaamorpisoobraclicellodioshoracasiзанаомрарутанепоотизнодотожеонихÐаеебымыВыÑовывоÐообПолиниРФÐеМытыОнимдаЗаДаÐуОбтеИзейнуммТыужÙيأنمامعكلأوردياÙىهولملكاولهبسالإنهيأيقدهلثمبهلوليبلايبكشيامأمنتبيلنحبهممشوشfirstvideolightworldmediawhitecloseblackrightsmallbooksplacemusicfieldorderpointvalueleveltableboardhousegroupworksyearsstatetodaywaterstartstyledeathpowerphonenighterrorinputabouttermstitletoolseventlocaltimeslargewordsgamesshortspacefocusclearmodelblockguideradiosharewomenagainmoneyimagenamesyounglineslatercolorgreenfront&watchforcepricerulesbeginaftervisitissueareasbelowindextotalhourslabelprintpressbuiltlinksspeedstudytradefoundsenseundershownformsrangeaddedstillmovedtakenaboveflashfixedoftenotherviewschecklegalriveritemsquickshapehumanexistgoingmoviethirdbasicpeacestagewidthloginideaswrotepagesusersdrivestorebreaksouthvoicesitesmonthwherebuildwhichearthforumthreesportpartyClicklowerlivesclasslayerentrystoryusagesoundcourtyour birthpopuptypesapplyImagebeinguppernoteseveryshowsmeansextramatchtrackknownearlybegansuperpapernorthlearngivennamedendedTermspartsGroupbrandusingwomanfalsereadyaudiotakeswhile.com/livedcasesdailychildgreatjudgethoseunitsneverbroadcoastcoverapplefilescyclesceneplansclickwritequeenpieceemailframeolderphotolimitcachecivilscaleenterthemetheretouchboundroyalaskedwholesincestock namefaithheartemptyofferscopeownedmightalbumthinkbloodarraymajortrustcanonunioncountvalidstoneStyleLoginhappyoccurleft:freshquitefilmsgradeneedsurbanfightbasishoverauto;route.htmlmixedfinalYour slidetopicbrownalonedrawnsplitreachRightdatesmarchquotegoodsLinksdoubtasyncthumballowchiefyouthnovel10px;serveuntilhandsCheckSpacequeryjamesequaltwice0,000Startpanelsongsroundeightshiftworthpostsleadsweeksavoidthesemilesplanesmartalphaplantmarksratesplaysclaimsalestextsstarswrong

thing.org/multiheardPowerstandtokensolid(thisbringshipsstafftriedcallsfullyfactsagentThis //-->adminegyptEvent15px;Emailtrue"crossspentblogsbox">notedleavechinasizesguestrobotheavytrue,sevengrandcrimesignsawaredancephase> - - -name=diegopage swiss--> - -#fff;">Log.com"treatsheet) && 14px;sleepntentfiledja:ãƒid="cName"worseshots-box-delta -<bears:48Z spendbakershops= "";php">ction13px;brianhellosize=o=%2F joinmaybe, fjsimg" ")[0]MTopBType"newlyDanskczechtrailknowsfaq">zh-cn10); --1");type=bluestrulydavis.js';> - -form jesus100% menu. - -walesrisksumentddingb-likteachgif" vegasdanskeestishqipsuomisobredesdeentretodospuedeañosestátienehastaotrospartedondenuevohacerformamismomejormundoaquídíassóloayudafechatodastantomenosdatosotrassitiomuchoahoralugarmayorestoshorastenerantesfotosestaspaísnuevasaludforosmedioquienmesespoderchileserávecesdecirjoséestarventagrupohechoellostengoamigocosasnivelgentemismaairesjuliotemashaciafavorjuniolibrepuntobuenoautorabrilbuenatextomarzosaberlistaluegocómoenerojuegoperúhaberestoynuncamujervalorfueralibrogustaigualvotoscasosguíapuedosomosavisousteddebennochebuscafaltaeurosseriedichocursoclavecasasleónplazolargoobrasvistaapoyojuntotratavistocrearcampohemoscincocargopisosordenhacenáreadiscopedrocercapuedapapelmenorútilclarojorgecalleponertardenadiemarcasigueellassiglocochemotosmadreclaserestoniñoquedapasarbancohijosviajepabloéstevienereinodejarfondocanalnorteletracausatomarmanoslunesautosvillavendopesartipostengamarcollevapadreunidovamoszonasambosbandamariaabusomuchasubirriojavivirgradochicaallíjovendichaestantalessalirsuelopesosfinesllamabuscoéstalleganegroplazahumorpagarjuntadobleislasbolsabañohablaluchaÃreadicenjugarnotasvalleallácargadolorabajoestégustomentemariofirmacostofichaplatahogarartesleyesaquelmuseobasespocosmitadcielochicomiedoganarsantoetapadebesplayaredessietecortecoreadudasdeseoviejodeseaaguas"domaincommonstatuseventsmastersystemactionbannerremovescrollupdateglobalmediumfilternumberchangeresultpublicscreenchoosenormaltravelissuessourcetargetspringmodulemobileswitchphotosborderregionitselfsocialactivecolumnrecordfollowtitle>eitherlengthfamilyfriendlayoutauthorcreatereviewsummerserverplayedplayerexpandpolicyformatdoublepointsseriespersonlivingdesignmonthsforcesuniqueweightpeopleenergynaturesearchfigurehavingcustomoffsetletterwindowsubmitrendergroupsuploadhealthmethodvideosschoolfutureshadowdebatevaluesObjectothersrightsleaguechromesimplenoticesharedendingseasonreportonlinesquarebuttonimagesenablemovinglatestwinterFranceperiodstrongrepeatLondondetailformeddemandsecurepassedtoggleplacesdevicestaticcitiesstreamyellowattackstreetflighthiddeninfo">openedusefulvalleycausesleadersecretseconddamagesportsexceptratingsignedthingseffectfieldsstatesofficevisualeditorvolumeReportmuseummoviesparentaccessmostlymother" id="marketgroundchancesurveybeforesymbolmomentspeechmotioninsidematterCenterobjectexistsmiddleEuropegrowthlegacymannerenoughcareeransweroriginportalclientselectrandomclosedtopicscomingfatheroptionsimplyraisedescapechosenchurchdefinereasoncorneroutputmemoryiframepolicemodelsNumberduringoffersstyleskilledlistedcalledsilvermargindeletebetterbrowselimitsGlobalsinglewidgetcenterbudgetnowrapcreditclaimsenginesafetychoicespirit-stylespreadmakingneededrussiapleaseextentScriptbrokenallowschargedividefactormember-basedtheoryconfigaroundworkedhelpedChurchimpactshouldalwayslogo" bottomlist">){var prefixorangeHeader.push(couplegardenbridgelaunchReviewtakingvisionlittledatingButtonbeautythemesforgotSearchanchoralmostloadedChangereturnstringreloadMobileincomesupplySourceordersviewed courseAbout islandPhilipawardshandleimportOfficeregardskillsnationSportsdegreeweekly (e.g.behinddoctorloggedunitedbeyond-scaleacceptservedmarineFootercamera -_form"leavesstress" /> -.gif" onloadloaderOxfordsistersurvivlistenfemaleDesignsize="appealtext">levelsthankshigherforcedanimalanyoneAfricaagreedrecentPeople
wonderpricesturned|| {};main">inlinesundaywrap">failedcensusminutebeaconquotes150px|estateremoteemail"linkedright;signalformal1.htmlsignupprincefloat:.png" forum.AccesspaperssoundsextendHeightsliderUTF-8"& Before. WithstudioownersmanageprofitjQueryannualparamsboughtfamousgooglelongeri++) {israelsayingdecidehome">headerensurebranchpiecesblock;statedtop">boston.test(avatartested_countforumsschemaindex,filledsharesreaderalert(appearSubmitline">body"> -* TheThoughseeingjerseyNews -System DavidcancertablesprovedApril reallydriveritem">more">boardscolorscampusfirst || [];media.guitarfinishwidth:showedOther .php" assumelayerswilsonstoresreliefswedenCustomeasily your String - -Whiltaylorclear:resortfrenchthough") + "buyingbrandsMembername">oppingsector5px;">vspacepostermajor coffeemartinmaturehappenkansaslink">Images=falsewhile hspace0& - -In powerPolski-colorjordanBottomStart -count2.htmlnews">01.jpgOnline-rightmillerseniorISBN 00,000 guidesvalue)ectionrepair.xml" rights.html-blockregExp:hoverwithinvirginphones using - var >'); - - -bahasabrasilgalegomagyarpolskisrpskiردو中文简体ç¹é«”ä¿¡æ¯ä¸­å›½æˆ‘们一个公å¸ç®¡ç†è®ºå›å¯ä»¥æœåŠ¡æ—¶é—´ä¸ªäººäº§å“自己ä¼ä¸šæŸ¥çœ‹å·¥ä½œè”系没有网站所有评论中心文章用户首页作者技术问题相关下载æœç´¢ä½¿ç”¨è½¯ä»¶åœ¨çº¿ä¸»é¢˜èµ„æ–™è§†é¢‘å›žå¤æ³¨å†Œç½‘络收è—内容推è市场消æ¯ç©ºé—´å‘布什么好å‹ç”Ÿæ´»å›¾ç‰‡å‘展如果手机新闻最新方å¼åŒ—京æä¾›å…³äºŽæ›´å¤šè¿™ä¸ªç³»ç»ŸçŸ¥é“游æˆå¹¿å‘Šå…¶ä»–å‘表安全第一会员进行点击版æƒç”µå­ä¸–界设计å…费教育加入活动他们商å“åšå®¢çŽ°åœ¨ä¸Šæµ·å¦‚ä½•å·²ç»ç•™è¨€è¯¦ç»†ç¤¾åŒºç™»å½•本站需è¦ä»·æ ¼æ”¯æŒå›½é™…链接国家建设朋å‹é˜…读法律ä½ç½®ç»æµŽé€‰æ‹©è¿™æ ·å½“å‰åˆ†ç±»æŽ’行因为交易最åŽéŸ³ä¹ä¸èƒ½é€šè¿‡è¡Œä¸šç§‘技å¯èƒ½è®¾å¤‡åˆä½œå¤§å®¶ç¤¾ä¼šç ”究专业全部项目这里还是开始情况电脑文件å“牌帮助文化资æºå¤§å­¦å­¦ä¹ åœ°å€æµè§ˆæŠ•èµ„å·¥ç¨‹è¦æ±‚怎么时候功能主è¦ç›®å‰èµ„讯城市方法电影招è˜å£°æ˜Žä»»ä½•å¥åº·æ•°æ®ç¾Žå›½æ±½è½¦ä»‹ç»ä½†æ˜¯äº¤æµç”Ÿäº§æ‰€ä»¥ç”µè¯æ˜¾ç¤ºä¸€äº›å•ä½äººå‘˜åˆ†æžåœ°å›¾æ—…游工具学生系列网å‹å¸–å­å¯†ç é¢‘é“æŽ§åˆ¶åœ°åŒºåŸºæœ¬å…¨å›½ç½‘ä¸Šé‡è¦ç¬¬äºŒå–œæ¬¢è¿›å…¥å‹æƒ…这些考试å‘现培训以上政府æˆä¸ºçŽ¯å¢ƒé¦™æ¸¯åŒæ—¶å¨±ä¹å‘é€ä¸€å®šå¼€å‘ä½œå“æ ‡å‡†æ¬¢è¿Žè§£å†³åœ°æ–¹ä¸€ä¸‹ä»¥åŠè´£ä»»æˆ–者客户代表积分女人数ç é”€å”®å‡ºçŽ°ç¦»çº¿åº”ç”¨åˆ—è¡¨ä¸åŒç¼–辑统计查询ä¸è¦æœ‰å…³æœºæž„å¾ˆå¤šæ’­æ”¾ç»„ç»‡æ”¿ç­–ç›´æŽ¥èƒ½åŠ›æ¥æºæ™‚間看到热门关键专区éžå¸¸è‹±è¯­ç™¾åº¦å¸Œæœ›ç¾Žå¥³æ¯”较知识规定建议部门æ„è§ç²¾å½©æ—¥æœ¬æé«˜å‘言方é¢åŸºé‡‘å¤„ç†æƒé™å½±ç‰‡é“¶è¡Œè¿˜æœ‰åˆ†äº«ç‰©å“ç»è¥æ·»åŠ ä¸“å®¶è¿™ç§è¯é¢˜èµ·æ¥ä¸šåŠ¡å…¬å‘Šè®°å½•ç®€ä»‹è´¨é‡ç”·äººå½±å“引用报告部分快速咨询时尚注æ„申请学校应该历å²åªæ˜¯è¿”回购买å称为了æˆåŠŸè¯´æ˜Žä¾›åº”å­©å­ä¸“题程åºä¸€èˆ¬æœƒå“¡åªæœ‰å…¶å®ƒä¿æŠ¤è€Œä¸”今天窗å£åЍæ€çжæ€ç‰¹åˆ«è®¤ä¸ºå¿…须更新å°è¯´æˆ‘å€‘ä½œä¸ºåª’ä½“åŒ…æ‹¬é‚£ä¹ˆä¸€æ ·å›½å†…æ˜¯å¦æ ¹æ®ç”µè§†å­¦é™¢å…·æœ‰è¿‡ç¨‹ç”±äºŽäººæ‰å‡ºæ¥ä¸è¿‡æ­£åœ¨æ˜Žæ˜Ÿæ•…事关系标题商务输入一直基础教学了解建筑结果全çƒé€šçŸ¥è®¡åˆ’对于艺术相册å‘生真的建立等级类型ç»éªŒå®žçŽ°åˆ¶ä½œæ¥è‡ªæ ‡ç­¾ä»¥ä¸‹åŽŸåˆ›æ— æ³•å…¶ä¸­å€‹äººä¸€åˆ‡æŒ‡å—关闭集团第三关注因此照片深圳商业广州日期高级最近综åˆè¡¨ç¤ºä¸“辑行为交通评价觉得精åŽå®¶åº­å®Œæˆæ„Ÿè§‰å®‰è£…得到邮件制度食å“虽然转载报价记者方案行政人民用å“东西æå‡ºé…’店然åŽä»˜æ¬¾çƒ­ç‚¹ä»¥å‰å®Œå…¨å‘帖设置领导工业医院看看ç»å…¸åŽŸå› å¹³å°å„ç§å¢žåŠ ææ–™æ–°å¢žä¹‹åŽèŒä¸šæ•ˆæžœä»Šå¹´è®ºæ–‡æˆ‘国告诉版主修改å‚与打å°å¿«ä¹æœºæ¢°è§‚点存在精神获得利用继续你们这么模å¼è¯­è¨€èƒ½å¤Ÿé›…虎æ“作风格一起科学体育短信æ¡ä»¶æ²»ç–—è¿åŠ¨äº§ä¸šä¼šè®®å¯¼èˆªå…ˆç”Ÿè”ç›Ÿå¯æ˜¯å•題结构作用调查資料自动负责农业访问实施接å—讨论那个å馈加强女性范围æœå‹™ä¼‘闲今日客æœè§€çœ‹å‚加的è¯ä¸€ç‚¹ä¿è¯å›¾ä¹¦æœ‰æ•ˆæµ‹è¯•移动æ‰èƒ½å†³å®šè‚¡ç¥¨ä¸æ–­éœ€æ±‚ä¸å¾—办法之间采用è¥é”€æŠ•诉目标爱情摄影有些複製文学机会数字装修购物农æ‘å…¨é¢ç²¾å“其实事情水平æç¤ºä¸Šå¸‚谢谢普通教师上传类别歌曲拥有创新é…ä»¶åªè¦æ—¶ä»£è³‡è¨Šè¾¾åˆ°äººç”Ÿè®¢é˜…è€å¸ˆå±•示心ç†è´´å­ç¶²ç«™ä¸»é¡Œè‡ªç„¶çº§åˆ«ç®€å•改é©é‚£äº›æ¥è¯´æ‰“开代ç åˆ é™¤è¯åˆ¸èŠ‚ç›®é‡ç‚¹æ¬¡æ•¸å¤šå°‘规划资金找到以åŽå¤§å…¨ä¸»é¡µæœ€ä½³å›žç­”天下ä¿éšœçŽ°ä»£æ£€æŸ¥æŠ•ç¥¨å°æ—¶æ²’有正常甚至代ç†ç›®å½•公开å¤åˆ¶é‡‘èžå¹¸ç¦ç‰ˆæœ¬å½¢æˆå‡†å¤‡è¡Œæƒ…å›žåˆ°æ€æƒ³æ€Žæ ·åè®®è®¤è¯æœ€å¥½äº§ç”ŸæŒ‰ç…§æœè£…å¹¿ä¸œåŠ¨æ¼«é‡‡è´­æ–°æ‰‹ç»„å›¾é¢æ¿å‚考政治容易天地努力人们å‡çº§é€Ÿåº¦äººç‰©è°ƒæ•´æµè¡Œé€ æˆæ–‡å­—éŸ©å›½è´¸æ˜“å¼€å±•ç›¸é—œè¡¨çŽ°å½±è§†å¦‚æ­¤ç¾Žå®¹å¤§å°æŠ¥é“æ¡æ¬¾å¿ƒæƒ…许多法规家居书店连接立å³ä¸¾æŠ¥æŠ€å·§å¥¥è¿ç™»å…¥ä»¥æ¥ç†è®ºäº‹ä»¶è‡ªç”±ä¸­åŽåŠžå…¬å¦ˆå¦ˆçœŸæ­£ä¸é”™å…¨æ–‡åˆåŒä»·å€¼åˆ«äººç›‘ç£å…·ä½“ä¸–çºªå›¢é˜Ÿåˆ›ä¸šæ‰¿æ‹…å¢žé•¿æœ‰äººä¿æŒå•†å®¶ç»´ä¿®å°æ¹¾å·¦å³è‚¡ä»½ç­”案实际电信ç»ç†ç”Ÿå‘½å®£ä¼ ä»»åŠ¡æ­£å¼ç‰¹è‰²ä¸‹æ¥å会åªèƒ½å½“ç„¶é‡æ–°å…§å®¹æŒ‡å¯¼è¿è¡Œæ—¥å¿—賣家超过土地浙江支付推出站长æ­å·žæ‰§è¡Œåˆ¶é€ ä¹‹ä¸€æŽ¨å¹¿çŽ°åœºæè¿°å˜åŒ–传统歌手ä¿é™©è¯¾ç¨‹åŒ»ç–—ç»è¿‡è¿‡å޻之剿”¶å…¥å¹´åº¦æ‚志美丽最高登陆未æ¥åŠ å·¥å…责教程版å—身体é‡åº†å‡ºå”®æˆæœ¬å½¢å¼åœŸè±†å‡ºåƒ¹ä¸œæ–¹é‚®ç®±å—京求èŒå–å¾—èŒä½ç›¸ä¿¡é¡µé¢åˆ†é’Ÿç½‘页确定图例网å€ç§¯æžé”™è¯¯ç›®çš„å®è´æœºå…³é£Žé™©æŽˆæƒç—…æ¯’å® ç‰©é™¤äº†è©•è«–ç–¾ç—…åŠæ—¶æ±‚购站点儿童æ¯å¤©ä¸­å¤®è®¤è¯†æ¯ä¸ªå¤©æ´¥å­—体å°ç£ç»´æŠ¤æœ¬é¡µä¸ªæ€§å®˜æ–¹å¸¸è§ç›¸æœºæˆ˜ç•¥åº”当律师方便校园股市房屋æ ç›®å‘˜å·¥å¯¼è‡´çªç„¶é“å…·æœ¬ç½‘ç»“åˆæ¡£æ¡ˆåŠ³åŠ¨å¦å¤–美元引起改å˜ç¬¬å››ä¼šè®¡èªªæ˜Žéšç§å®å®è§„范消费共åŒå¿˜è®°ä½“系带æ¥å字發表开放加盟å—åˆ°äºŒæ‰‹å¤§é‡æˆäººæ•°é‡å…±äº«åŒºåŸŸå¥³å­©åŽŸåˆ™æ‰€åœ¨ç»“æŸé€šä¿¡è¶…级é…ç½®å½“æ—¶ä¼˜ç§€æ€§æ„Ÿæˆ¿äº§éŠæˆ²å‡ºå£æäº¤å°±ä¸šä¿å¥ç¨‹åº¦å‚数事业整个山东情感特殊分類æœå°‹å±žäºŽé—¨æˆ·è´¢åŠ¡å£°éŸ³åŠå…¶è´¢ç»åšæŒå¹²éƒ¨æˆç«‹åˆ©ç›Šè€ƒè™‘æˆéƒ½åŒ…装用戶比赛文明招商完整真是眼ç›ä¼™ä¼´å¨æœ›é¢†åŸŸå«ç”Ÿä¼˜æƒ è«–壇公共良好充分符åˆé™„件特点ä¸å¯è‹±æ–‡èµ„äº§æ ¹æœ¬æ˜Žæ˜¾å¯†ç¢¼å…¬ä¼—æ°‘æ—æ›´åŠ äº«å—åŒå­¦å¯åЍ适åˆåŽŸæ¥é—®ç­”本文美食绿色稳定终于生物供求æœç‹åŠ›é‡ä¸¥é‡æ°¸è¿œå†™çœŸæœ‰é™ç«žäº‰å¯¹è±¡è´¹ç”¨ä¸å¥½ç»å¯¹å分促进点评影音优势ä¸å°‘欣èµå¹¶ä¸”有点方å‘全新信用设施形象资格çªç ´éšç€é‡å¤§äºŽæ˜¯æ¯•ä¸šæ™ºèƒ½åŒ–å·¥å®Œç¾Žå•†åŸŽç»Ÿä¸€å‡ºç‰ˆæ‰“é€ ç”¢å“æ¦‚况用于ä¿ç•™å› ç´ ä¸­åœ‹å­˜å‚¨è´´å›¾æœ€æ„›é•¿æœŸå£ä»·ç†è´¢åŸºåœ°å®‰æŽ’武汉里é¢åˆ›å»ºå¤©ç©ºé¦–先完善驱动下é¢ä¸å†è¯šä¿¡æ„义阳光英国漂亮军事玩家群众农民å³å¯å稱家具动画想到注明å°å­¦æ€§èƒ½è€ƒç ”硬件观看清楚æžç¬‘首é é»„金适用江è‹çœŸå®žä¸»ç®¡é˜¶æ®µè¨»å†Šç¿»è¯‘æƒåˆ©åšå¥½ä¼¼ä¹Žé€šè®¯æ–½å·¥ç‹€æ…‹ä¹Ÿè®¸çޝä¿åŸ¹å…»æ¦‚念大型机票ç†è§£åŒ¿åcuandoenviarmadridbuscariniciotiempoporquecuentaestadopuedenjuegoscontraestánnombretienenperfilmaneraamigosciudadcentroaunquepuedesdentroprimerpreciosegúnbuenosvolverpuntossemanahabíaagostonuevosunidoscarlosequiponiñosmuchosalgunacorreoimagenpartirarribamaríahombreempleoverdadcambiomuchasfueronpasadolíneaparecenuevascursosestabaquierolibroscuantoaccesomiguelvarioscuatrotienesgruposseráneuropamediosfrenteacercademásofertacochesmodeloitalialetrasalgúncompracualesexistecuerposiendoprensallegarviajesdineromurciapodrápuestodiariopuebloquieremanuelpropiocrisisciertoseguromuertefuentecerrargrandeefectopartesmedidapropiaofrecetierrae-mailvariasformasfuturoobjetoseguirriesgonormasmismosúnicocaminositiosrazóndebidopruebatoledoteníajesúsesperococinaorigentiendacientocádizhablarseríalatinafuerzaestiloguerraentraréxitolópezagendavídeoevitarpaginametrosjavierpadresfácilcabezaáreassalidaenvíojapónabusosbienestextosllevarpuedanfuertecomúnclaseshumanotenidobilbaounidadestáseditarcreadoдлÑчтокакилиÑтовÑеегопритакещеужеКакбезбылониВÑеподЭтотомчемнетлетразонагдемнеДлÑПринаÑнихтемктогодвоттамСШÐмаÑЧтоваÑвамемуТакдванамÑтиÑтуВамтехпротутнадднÑВоттринейВаÑнимÑамтотрубОнимирнееОООлицÑтаОнанемдоммойдвеоноÑудकेहैकीसेकाकोऔरपरनेà¤à¤•किभीइसकरतोहोआपहीयहयातकथाjagranआजजोअबदोगईजागà¤à¤¹à¤®à¤‡à¤¨à¤µà¤¹à¤¯à¥‡à¤¥à¥‡à¤¥à¥€à¤˜à¤°à¤œà¤¬à¤¦à¥€à¤•ईजीवेनईनà¤à¤¹à¤°à¤‰à¤¸à¤®à¥‡à¤•मवोलेसबमईदेओरआमबसभरबनचलमनआगसीलीعلىإلىهذاآخرعددالىهذهصورغيركانولابينعرضذلكهنايومقالعليانالكنحتىقبلوحةاخرÙقطعبدركنإذاكمااحدإلاÙÙŠÙ‡Ø¨Ø¹Ø¶ÙƒÙŠÙØ¨Ø­Ø«ÙˆÙ…نوهوأناجدالهاسلمعندليسعبرصلىمنذبهاأنهمثلكنتالاحيثمصرشرححولوÙÙŠØ§Ø°Ø§Ù„ÙƒÙ„Ù…Ø±Ø©Ø§Ù†ØªØ§Ù„ÙØ£Ø¨ÙˆØ®Ø§ØµØ£Ù†ØªØ§Ù†Ù‡Ø§Ù„ÙŠØ¹Ø¶ÙˆÙˆÙ‚Ø¯Ø§Ø¨Ù†Ø®ÙŠØ±Ø¨Ù†ØªÙ„ÙƒÙ…Ø´Ø§Ø¡ÙˆÙ‡ÙŠØ§Ø¨ÙˆÙ‚ØµØµÙˆÙ…Ø§Ø±Ù‚Ù…Ø£Ø­Ø¯Ù†Ø­Ù†Ø¹Ø¯Ù…Ø±Ø£ÙŠØ§Ø­Ø©ÙƒØªØ¨Ø¯ÙˆÙ†ÙŠØ¬Ø¨Ù…Ù†Ù‡ØªØ­ØªØ¬Ù‡Ø©Ø³Ù†Ø©ÙŠØªÙ…ÙƒØ±Ø©ØºØ²Ø©Ù†ÙØ³Ø¨ÙŠØªÙ„لهلناتلكقلبلماعنهأولشيءنورأماÙيكبكلذاترتببأنهمسانكبيعÙقدحسنلهمشعرأهلشهرقطرطلبprofileservicedefaulthimselfdetailscontentsupportstartedmessagesuccessfashioncountryaccountcreatedstoriesresultsrunningprocesswritingobjectsvisiblewelcomearticleunknownnetworkcompanydynamicbrowserprivacyproblemServicerespectdisplayrequestreservewebsitehistoryfriendsoptionsworkingversionmillionchannelwindow.addressvisitedweathercorrectproductedirectforwardyou canremovedsubjectcontrolarchivecurrentreadinglibrarylimitedmanagerfurthersummarymachineminutesprivatecontextprogramsocietynumberswrittenenabledtriggersourcesloadingelementpartnerfinallyperfectmeaningsystemskeepingculture",journalprojectsurfaces"expiresreviewsbalanceEnglishContentthroughPlease opinioncontactaverageprimaryvillageSpanishgallerydeclinemeetingmissionpopularqualitymeasuregeneralspeciessessionsectionwriterscounterinitialreportsfiguresmembersholdingdisputeearlierexpressdigitalpictureAnothermarriedtrafficleadingchangedcentralvictoryimages/reasonsstudiesfeaturelistingmust beschoolsVersionusuallyepisodeplayinggrowingobviousoverlaypresentactions</ul> -wrapperalreadycertainrealitystorageanotherdesktopofferedpatternunusualDigitalcapitalWebsitefailureconnectreducedAndroiddecadesregular & animalsreleaseAutomatgettingmethodsnothingPopularcaptionletterscapturesciencelicensechangesEngland=1&History = new CentralupdatedSpecialNetworkrequirecommentwarningCollegetoolbarremainsbecauseelectedDeutschfinanceworkersquicklybetweenexactlysettingdiseaseSocietyweaponsexhibit<!--Controlclassescoveredoutlineattacksdevices(windowpurposetitle="Mobile killingshowingItaliandroppedheavilyeffects-1']); -confirmCurrentadvancesharingopeningdrawingbillionorderedGermanyrelated</form>includewhetherdefinedSciencecatalogArticlebuttonslargestuniformjourneysidebarChicagoholidayGeneralpassage,"animatefeelingarrivedpassingnaturalroughly. - -The but notdensityBritainChineselack oftributeIreland" data-factorsreceivethat isLibraryhusbandin factaffairsCharlesradicalbroughtfindinglanding:lang="return leadersplannedpremiumpackageAmericaEdition]"Messageneed tovalue="complexlookingstationbelievesmaller-mobilerecordswant tokind ofFirefoxyou aresimilarstudiedmaximumheadingrapidlyclimatekingdomemergedamountsfoundedpioneerformuladynastyhow to SupportrevenueeconomyResultsbrothersoldierlargelycalling."AccountEdward segmentRobert effortsPacificlearnedup withheight:we haveAngelesnations_searchappliedacquiremassivegranted: falsetreatedbiggestbenefitdrivingStudiesminimumperhapsmorningsellingis usedreversevariant role="missingachievepromotestudentsomeoneextremerestorebottom:evolvedall thesitemapenglishway to AugustsymbolsCompanymattersmusicalagainstserving})(); -paymenttroubleconceptcompareparentsplayersregionsmonitor ''The winningexploreadaptedGalleryproduceabilityenhancecareers). The collectSearch ancientexistedfooter handlerprintedconsoleEasternexportswindowsChannelillegalneutralsuggest_headersigning.html">settledwesterncausing-webkitclaimedJusticechaptervictimsThomas mozillapromisepartieseditionoutside:false,hundredOlympic_buttonauthorsreachedchronicdemandssecondsprotectadoptedprepareneithergreatlygreateroverallimprovecommandspecialsearch.worshipfundingthoughthighestinsteadutilityquarterCulturetestingclearlyexposedBrowserliberal} catchProjectexamplehide();FloridaanswersallowedEmperordefenseseriousfreedomSeveral-buttonFurtherout of != nulltrainedDenmarkvoid(0)/all.jspreventRequestStephen - -When observe</h2> -Modern provide" alt="borders. - -For - -Many artistspoweredperformfictiontype ofmedicalticketsopposedCouncilwitnessjusticeGeorge Belgium...</a>twitternotablywaitingwarfare Other rankingphrasesmentionsurvivescholar</p> - Countryignoredloss ofjust asGeorgiastrange<head><stopped1']); -islandsnotableborder:list ofcarried100,000</h3> - severalbecomesselect wedding00.htmlmonarchoff theteacherhighly biologylife ofor evenrise of»plusonehunting(thoughDouglasjoiningcirclesFor theAncientVietnamvehiclesuch ascrystalvalue =Windowsenjoyeda smallassumed<a id="foreign All rihow theDisplayretiredhoweverhidden;battlesseekingcabinetwas notlook atconductget theJanuaryhappensturninga:hoverOnline French lackingtypicalextractenemieseven ifgeneratdecidedare not/searchbeliefs-image:locatedstatic.login">convertviolententeredfirst">circuitFinlandchemistshe was10px;">as suchdivided</span>will beline ofa greatmystery/index.fallingdue to railwaycollegemonsterdescentit withnuclearJewish protestBritishflowerspredictreformsbutton who waslectureinstantsuicidegenericperiodsmarketsSocial fishingcombinegraphicwinners<br /><by the NaturalPrivacycookiesoutcomeresolveSwedishbrieflyPersianso muchCenturydepictscolumnshousingscriptsnext tobearingmappingrevisedjQuery(-width:title">tooltipSectiondesignsTurkishyounger.match(})(); - -burningoperatedegreessource=Richardcloselyplasticentries</tr> -color:#ul id="possessrollingphysicsfailingexecutecontestlink toDefault<br /> -: true,chartertourismclassicproceedexplain</h1> -online.?xml vehelpingdiamonduse theairlineend -->).attr(readershosting#ffffffrealizeVincentsignals src="/ProductdespitediversetellingPublic held inJoseph theatreaffects<style>a largedoesn'tlater, ElementfaviconcreatorHungaryAirportsee theso thatMichaelSystemsPrograms, and width=e"tradingleft"> -personsGolden Affairsgrammarformingdestroyidea ofcase ofoldest this is.src = cartoonregistrCommonsMuslimsWhat isin manymarkingrevealsIndeed,equally/show_aoutdoorescape(Austriageneticsystem,In the sittingHe alsoIslandsAcademy - <!--Daniel bindingblock">imposedutilizeAbraham(except{width:putting).html(|| []; -DATA[ *kitchenmountedactual dialectmainly _blank'installexpertsif(typeIt also© ">Termsborn inOptionseasterntalkingconcerngained ongoingjustifycriticsfactoryits ownassaultinvitedlastinghis ownhref="/" rel="developconcertdiagramdollarsclusterphp?id=alcohol);})();using a><span>vesselsrevivalAddressamateurandroidallegedillnesswalkingcentersqualifymatchesunifiedextinctDefensedied in - <!-- customslinkingLittle Book ofeveningmin.js?are thekontakttoday's.html" target=wearingAll Rig; -})();raising Also, crucialabout">declare--> -<scfirefoxas muchappliesindex, s, but type = - -<!--towardsRecordsPrivateForeignPremierchoicesVirtualreturnsCommentPoweredinline;povertychamberLiving volumesAnthonylogin" RelatedEconomyreachescuttinggravitylife inChapter-shadowNotable</td> - returnstadiumwidgetsvaryingtravelsheld bywho arework infacultyangularwho hadairporttown of - -Some 'click'chargeskeywordit willcity of(this);Andrew unique checkedor more300px; return;rsion="pluginswithin herselfStationFederalventurepublishsent totensionactresscome tofingersDuke ofpeople,exploitwhat isharmonya major":"httpin his menu"> -monthlyofficercouncilgainingeven inSummarydate ofloyaltyfitnessand wasemperorsupremeSecond hearingRussianlongestAlbertalateralset of small">.appenddo withfederalbank ofbeneathDespiteCapitalgrounds), and percentit fromclosingcontainInsteadfifteenas well.yahoo.respondfighterobscurereflectorganic= Math.editingonline paddinga wholeonerroryear ofend of barrierwhen itheader home ofresumedrenamedstrong>heatingretainscloudfrway of March 1knowingin partBetweenlessonsclosestvirtuallinks">crossedEND -->famous awardedLicenseHealth fairly wealthyminimalAfricancompetelabel">singingfarmersBrasil)discussreplaceGregoryfont copursuedappearsmake uproundedboth ofblockedsaw theofficescoloursif(docuwhen heenforcepush(fuAugust UTF-8">Fantasyin mostinjuredUsuallyfarmingclosureobject defenceuse of Medical<body> -evidentbe usedkeyCodesixteenIslamic#000000entire widely active (typeofone cancolor =speakerextendsPhysicsterrain<tbody>funeralviewingmiddle cricketprophetshifteddoctorsRussell targetcompactalgebrasocial-bulk ofman and</td> - he left).val()false);logicalbankinghome tonaming Arizonacredits); -}); -founderin turnCollinsbefore But thechargedTitle">CaptainspelledgoddessTag -->Adding:but wasRecent patientback in=false&Lincolnwe knowCounterJudaismscript altered']); - has theunclearEvent',both innot all - -<!-- placinghard to centersort ofclientsstreetsBernardassertstend tofantasydown inharbourFreedomjewelry/about..searchlegendsis mademodern only ononly toimage" linear painterand notrarely acronymdelivershorter00&as manywidth="/* <![Ctitle =of the lowest picked escapeduses ofpeoples PublicMatthewtacticsdamagedway forlaws ofeasy to windowstrong simple}catch(seventhinfoboxwent topaintedcitizenI don'tretreat. Some ww."); -bombingmailto:made in. Many carries||{};wiwork ofsynonymdefeatsfavoredopticalpageTraunless sendingleft"><comScorAll thejQuery.touristClassicfalse" Wilhelmsuburbsgenuinebishops.split(global followsbody ofnominalContactsecularleft tochiefly-hidden-banner</li> - -. When in bothdismissExplorealways via thespañolwelfareruling arrangecaptainhis sonrule ofhe tookitself,=0&(calledsamplesto makecom/pagMartin Kennedyacceptsfull ofhandledBesides//--></able totargetsessencehim to its by common.mineralto takeways tos.org/ladvisedpenaltysimple:if theyLettersa shortHerbertstrikes groups.lengthflightsoverlapslowly lesser social </p> - it intoranked rate oful> - attemptpair ofmake itKontaktAntoniohaving ratings activestreamstrapped").css(hostilelead tolittle groups,Picture--> - - rows=" objectinverse<footerCustomV><\/scrsolvingChamberslaverywoundedwhereas!= 'undfor allpartly -right:Arabianbacked centuryunit ofmobile-Europe,is homerisk ofdesiredClintoncost ofage of become none ofp"Middle ead')[0Criticsstudios>©group">assemblmaking pressedwidget.ps:" ? rebuiltby someFormer editorsdelayedCanonichad thepushingclass="but arepartialBabylonbottom carrierCommandits useAs withcoursesa thirddenotesalso inHouston20px;">accuseddouble goal ofFamous ).bind(priests Onlinein Julyst + "gconsultdecimalhelpfulrevivedis veryr'+'iptlosing femalesis alsostringsdays ofarrivalfuture <objectforcingString(" /> - here isencoded. The balloondone by/commonbgcolorlaw of Indianaavoidedbut the2px 3pxjquery.after apolicy.men andfooter-= true;for usescreen.Indian image =family,http://  driverseternalsame asnoticedviewers})(); - is moreseasonsformer the newis justconsent Searchwas thewhy theshippedbr><br>width: height=made ofcuisineis thata very Admiral fixed;normal MissionPress, ontariocharsettry to invaded="true"spacingis mosta more totallyfall of}); - immensetime inset outsatisfyto finddown tolot of Playersin Junequantumnot thetime todistantFinnishsrc = (single help ofGerman law andlabeledforestscookingspace">header-well asStanleybridges/globalCroatia About [0]; - it, andgroupedbeing a){throwhe madelighterethicalFFFFFF"bottom"like a employslive inas seenprintermost ofub-linkrejectsand useimage">succeedfeedingNuclearinformato helpWomen'sNeitherMexicanprotein<table by manyhealthylawsuitdevised.push({sellerssimply Through.cookie Image(older">us.js"> Since universlarger open to!-- endlies in']); - marketwho is ("DOMComanagedone fortypeof Kingdomprofitsproposeto showcenter;made itdressedwere inmixtureprecisearisingsrc = 'make a securedBaptistvoting - var March 2grew upClimate.removeskilledway the</head>face ofacting right">to workreduceshas haderectedshow();action=book ofan area== "htt<header -<html>conformfacing cookie.rely onhosted .customhe wentbut forspread Family a meansout theforums.footage">MobilClements" id="as highintense--><!--female is seenimpliedset thea stateand hisfastestbesidesbutton_bounded"><img Infoboxevents,a youngand areNative cheaperTimeoutand hasengineswon the(mostlyright: find a -bottomPrince area ofmore ofsearch_nature,legallyperiod,land ofor withinducedprovingmissilelocallyAgainstthe wayk"px;"> -pushed abandonnumeralCertainIn thismore inor somename isand, incrownedISBN 0-createsOctobermay notcenter late inDefenceenactedwish tobroadlycoolingonload=it. TherecoverMembersheight assumes<html> -people.in one =windowfooter_a good reklamaothers,to this_cookiepanel">London,definescrushedbaptismcoastalstatus title" move tolost inbetter impliesrivalryservers SystemPerhapses and contendflowinglasted rise inGenesisview ofrising seem tobut in backinghe willgiven agiving cities.flow of Later all butHighwayonly bysign ofhe doesdiffersbattery&lasinglesthreatsintegertake onrefusedcalled =US&See thenativesby thissystem.head of:hover,lesbiansurnameand allcommon/header__paramsHarvard/pixel.removalso longrole ofjointlyskyscraUnicodebr /> -AtlantanucleusCounty,purely count">easily build aonclicka givenpointerh"events else { -ditionsnow the, with man whoorg/Webone andcavalryHe diedseattle00,000 {windowhave toif(windand itssolely m"renewedDetroitamongsteither them inSenatorUs</a><King ofFrancis-produche usedart andhim andused byscoringat hometo haverelatesibilityfactionBuffalolink"><what hefree toCity ofcome insectorscountedone daynervoussquare };if(goin whatimg" alis onlysearch/tuesdaylooselySolomonsexual - <a hrmedium"DO NOT France,with a war andsecond take a > - - -market.highwaydone inctivity"last">obligedrise to"undefimade to Early praisedin its for hisathleteJupiterYahoo! termed so manyreally s. The a woman?value=direct right" bicycleacing="day andstatingRather,higher Office are nowtimes, when a pay foron this-link">;borderaround annual the Newput the.com" takin toa brief(in thegroups.; widthenzymessimple in late{returntherapya pointbanninginks"> -();" rea place\u003Caabout atr> - ccount gives a<SCRIPTRailwaythemes/toolboxById("xhumans,watchesin some if (wicoming formats Under but hashanded made bythan infear ofdenoted/iframeleft involtagein eacha"base ofIn manyundergoregimesaction </p> -<ustomVa;></importsor thatmostly &re size="</a></ha classpassiveHost = WhetherfertileVarious=[];(fucameras/></td>acts asIn some> - -<!organis <br />Beijingcatalàdeutscheuropeueuskaragaeilgesvenskaespañamensajeusuariotrabajoméxicopáginasiempresistemaoctubreduranteañadirempresamomentonuestroprimeratravésgraciasnuestraprocesoestadoscalidadpersonanúmeroacuerdomúsicamiembroofertasalgunospaísesejemploderechoademásprivadoagregarenlacesposiblehotelessevillaprimeroúltimoeventosarchivoculturamujeresentradaanuncioembargomercadograndesestudiomejoresfebrerodiseñoturismocódigoportadaespaciofamiliaantoniopermiteguardaralgunaspreciosalguiensentidovisitastítuloconocersegundoconsejofranciaminutossegundatenemosefectosmálagasesiónrevistagranadacompraringresogarcíaacciónecuadorquienesinclusodeberámateriahombresmuestrapodríamañanaúltimaestamosoficialtambienningúnsaludospodemosmejorarpositionbusinesshomepagesecuritylanguagestandardcampaignfeaturescategoryexternalchildrenreservedresearchexchangefavoritetemplatemilitaryindustryservicesmaterialproductsz-index:commentssoftwarecompletecalendarplatformarticlesrequiredmovementquestionbuildingpoliticspossiblereligionphysicalfeedbackregisterpicturesdisabledprotocolaudiencesettingsactivityelementslearninganythingabstractprogressoverviewmagazineeconomictrainingpressurevarious <strong>propertyshoppingtogetheradvancedbehaviordownloadfeaturedfootballselectedLanguagedistanceremembertrackingpasswordmodifiedstudentsdirectlyfightingnortherndatabasefestivalbreakinglocationinternetdropdownpracticeevidencefunctionmarriageresponseproblemsnegativeprogramsanalysisreleasedbanner">purchasepoliciesregionalcreativeargumentbookmarkreferrerchemicaldivisioncallbackseparateprojectsconflicthardwareinterestdeliverymountainobtained= false;for(var acceptedcapacitycomputeridentityaircraftemployedproposeddomesticincludesprovidedhospitalverticalcollapseapproachpartnerslogo"><adaughterauthor" culturalfamilies/images/assemblypowerfulteachingfinisheddistrictcriticalcgi-bin/purposesrequireselectionbecomingprovidesacademicexerciseactuallymedicineconstantaccidentMagazinedocumentstartingbottom">observed: "extendedpreviousSoftwarecustomerdecisionstrengthdetailedslightlyplanningtextareacurrencyeveryonestraighttransferpositiveproducedheritageshippingabsolutereceivedrelevantbutton" violenceanywherebenefitslaunchedrecentlyalliancefollowedmultiplebulletinincludedoccurredinternal$(this).republic><tr><tdcongressrecordedultimatesolution<ul id="discoverHome</a>websitesnetworksalthoughentirelymemorialmessagescontinueactive">somewhatvictoriaWestern title="LocationcontractvisitorsDownloadwithout right"> -measureswidth = variableinvolvedvirginianormallyhappenedaccountsstandingnationalRegisterpreparedcontrolsaccuratebirthdaystrategyofficialgraphicscriminalpossiblyconsumerPersonalspeakingvalidateachieved.jpg" />machines</h2> - keywordsfriendlybrotherscombinedoriginalcomposedexpectedadequatepakistanfollow" valuable</label>relativebringingincreasegovernorplugins/List of Header">" name=" ("graduate</head> -commercemalaysiadirectormaintain;height:schedulechangingback to catholicpatternscolor: #greatestsuppliesreliable</ul> - <select citizensclothingwatching<li id="specificcarryingsentence<center>contrastthinkingcatch(e)southernMichael merchantcarouselpadding:interior.split("lizationOctober ){returnimproved--> - -coveragechairman.png" />subjectsRichard whateverprobablyrecoverybaseballjudgmentconnect..css" /> websitereporteddefault"/></a> -electricscotlandcreationquantity. ISBN 0did not instance-search-" lang="speakersComputercontainsarchivesministerreactiondiscountItalianocriteriastrongly: 'http:'script'coveringofferingappearedBritish identifyFacebooknumerousvehiclesconcernsAmericanhandlingdiv id="William provider_contentaccuracysection andersonflexibleCategorylawrence<script>layout="approved maximumheader"></table>Serviceshamiltoncurrent canadianchannels/themes//articleoptionalportugalvalue=""intervalwirelessentitledagenciesSearch" measuredthousandspending…new Date" size="pageNamemiddle" " /></a>hidden">sequencepersonaloverflowopinionsillinoislinks"> - <title>versionssaturdayterminalitempropengineersectionsdesignerproposal="false"Españolreleasessubmit" er"additionsymptomsorientedresourceright"><pleasurestationshistory.leaving border=contentscenter">. - -Some directedsuitablebulgaria.show();designedGeneral conceptsExampleswilliamsOriginal"><span>search">operatorrequestsa "allowingDocumentrevision. - -The yourselfContact michiganEnglish columbiapriorityprintingdrinkingfacilityreturnedContent officersRussian generate-8859-1"indicatefamiliar qualitymargin:0 contentviewportcontacts-title">portable.length eligibleinvolvesatlanticonload="default.suppliedpaymentsglossary - -After guidance</td><tdencodingmiddle">came to displaysscottishjonathanmajoritywidgets.clinicalthailandteachers<head> - affectedsupportspointer;toString</small>oklahomawill be investor0" alt="holidaysResourcelicensed (which . After considervisitingexplorerprimary search" android"quickly meetingsestimate;return ;color:# height=approval, " checked.min.js"magnetic></a></hforecast. While thursdaydvertiseéhasClassevaluateorderingexistingpatients Online coloradoOptions"campbell<!-- end</span><<br /> -_popups|sciences," quality Windows assignedheight: <b classle" value=" Companyexamples<iframe believespresentsmarshallpart of properly). - -The taxonomymuch of </span> -" data-srtuguêsscrollTo project<head> -attorneyemphasissponsorsfancyboxworld's wildlifechecked=sessionsprogrammpx;font- Projectjournalsbelievedvacationthompsonlightingand the special border=0checking</tbody><button Completeclearfix -<head> -article <sectionfindingsrole in popular Octoberwebsite exposureused to changesoperatedclickingenteringcommandsinformed numbers </div>creatingonSubmitmarylandcollegesanalyticlistingscontact.loggedInadvisorysiblingscontent"s")s. This packagescheckboxsuggestspregnanttomorrowspacing=icon.pngjapanesecodebasebutton">gamblingsuch as , while </span> missourisportingtop:1px .</span>tensionswidth="2lazyloadnovemberused in height="cript"> - </<tr><td height:2/productcountry include footer" <!-- title"></jquery.</form> -(简体)(ç¹é«”)hrvatskiitalianoromânătürkçeاردوtambiénnoticiasmensajespersonasderechosnacionalserviciocontactousuariosprogramagobiernoempresasanunciosvalenciacolombiadespuésdeportesproyectoproductopúbliconosotroshistoriapresentemillonesmediantepreguntaanteriorrecursosproblemasantiagonuestrosopiniónimprimirmientrasaméricavendedorsociedadrespectorealizarregistropalabrasinterésentoncesespecialmiembrosrealidadcórdobazaragozapáginassocialesbloqueargestiónalquilersistemascienciascompletoversióncompletaestudiospúblicaobjetivoalicantebuscadorcantidadentradasaccionesarchivossuperiormayoríaalemaniafunciónúltimoshaciendoaquellosediciónfernandoambientefacebooknuestrasclientesprocesosbastantepresentareportarcongresopublicarcomerciocontratojóvenesdistritotécnicaconjuntoenergíatrabajarasturiasrecienteutilizarboletínsalvadorcorrectatrabajosprimerosnegocioslibertaddetallespantallapróximoalmeríaanimalesquiénescorazónsecciónbuscandoopcionesexteriorconceptotodavíagaleríaescribirmedicinalicenciaconsultaaspectoscríticadólaresjusticiadeberánperíodonecesitamantenerpequeñorecibidatribunaltenerifecancióncanariasdescargadiversosmallorcarequieretécnicodeberíaviviendafinanzasadelantefuncionaconsejosdifícilciudadesantiguasavanzadatérminounidadessánchezcampañasoftonicrevistascontienesectoresmomentosfacultadcréditodiversassupuestofactoressegundospequeñaгодаеÑлиеÑтьбылобытьÑтомЕÑлитогоменÑвÑехÑтойдажебылигодуденьÑтотбылаÑебÑодинÑебенадоÑайтфотонегоÑвоиÑвойигрытожевÑемÑвоюлишьÑтихпокаднейдомамиралиботемухотÑдвухÑетилюдиделомиретебÑÑвоевидечегоÑтимÑчеттемыценыÑталведьтемеводытебевышенамитипатомуправлицаоднагодызнаюмогудругвÑейидеткиноодноделаделеÑрокиюнÑвеÑьЕÑÑ‚ÑŒÑ€Ð°Ð·Ð°Ð½Ð°ÑˆÐ¸Ø§Ù„Ù„Ù‡Ø§Ù„ØªÙŠØ¬Ù…ÙŠØ¹Ø®Ø§ØµØ©Ø§Ù„Ø°ÙŠØ¹Ù„ÙŠÙ‡Ø¬Ø¯ÙŠØ¯Ø§Ù„Ø¢Ù†Ø§Ù„Ø±Ø¯ØªØ­ÙƒÙ…ØµÙØ­Ø©ÙƒØ§Ù†ØªØ§Ù„لييكونشبكةÙيهابناتحواءأكثرخلالالحبدليلدروساضغطتكونهناكساحةناديالطبعليكشكرايمكنمنهاشركةرئيسنشيطماذاالÙÙ†Ø´Ø¨Ø§Ø¨ØªØ¹Ø¨Ø±Ø±Ø­Ù…Ø©ÙƒØ§ÙØ©ÙŠÙ‚ÙˆÙ„Ù…Ø±ÙƒØ²ÙƒÙ„Ù…Ø©Ø£Ø­Ù…Ø¯Ù‚Ù„Ø¨ÙŠÙŠØ¹Ù†ÙŠØµÙˆØ±Ø©Ø·Ø±ÙŠÙ‚Ø´Ø§Ø±ÙƒØ¬ÙˆØ§Ù„Ø£Ø®Ø±Ù‰Ù…Ø¹Ù†Ø§Ø§Ø¨Ø­Ø«Ø¹Ø±ÙˆØ¶Ø¨Ø´ÙƒÙ„Ù…Ø³Ø¬Ù„Ø¨Ù†Ø§Ù†Ø®Ø§Ù„Ø¯ÙƒØªØ§Ø¨ÙƒÙ„ÙŠØ©Ø¨Ø¯ÙˆÙ†Ø£ÙŠØ¶Ø§ÙŠÙˆØ¬Ø¯ÙØ±ÙŠÙ‚ÙƒØªØ¨ØªØ£ÙØ¶Ù„Ù…Ø·Ø¨Ø®Ø§ÙƒØ«Ø±Ø¨Ø§Ø±ÙƒØ§ÙØ¶Ù„Ø§Ø­Ù„Ù‰Ù†ÙØ³Ù‡Ø£ÙŠØ§Ù…ردودأنهاديناالانمعرضتعلمداخلممكن���������������������� -  - ÿÿÿÿ��������ÿÿÿÿ������������������ÿÿ������ÿÿ����������������resourcescountriesquestionsequipmentcommunityavailablehighlightDTD/xhtmlmarketingknowledgesomethingcontainerdirectionsubscribeadvertisecharacter" value="</select>Australia" class="situationauthorityfollowingprimarilyoperationchallengedevelopedanonymousfunction functionscompaniesstructureagreement" title="potentialeducationargumentssecondarycopyrightlanguagesexclusivecondition</form> -statementattentionBiography} else { -solutionswhen the Analyticstemplatesdangeroussatellitedocumentspublisherimportantprototypeinfluence»</effectivegenerallytransformbeautifultransportorganizedpublishedprominentuntil thethumbnailNational .focus();over the migrationannouncedfooter"> -exceptionless thanexpensiveformationframeworkterritoryndicationcurrentlyclassNamecriticismtraditionelsewhereAlexanderappointedmaterialsbroadcastmentionedaffiliate</option>treatmentdifferent/default.Presidentonclick="biographyotherwisepermanentFrançaisHollywoodexpansionstandards</style> -reductionDecember preferredCambridgeopponentsBusiness confusion> -<title>presentedexplaineddoes not worldwideinterfacepositionsnewspaper</table> -mountainslike the essentialfinancialselectionaction="/abandonedEducationparseInt(stabilityunable to -relationsNote thatefficientperformedtwo yearsSince thethereforewrapper">alternateincreasedBattle ofperceivedtrying tonecessaryportrayedelectionsElizabethdiscoveryinsurances.length;legendaryGeographycandidatecorporatesometimesservices.inheritedCommunityreligiouslocationsCommitteebuildingsthe worldno longerbeginningreferencecannot befrequencytypicallyinto the relative;recordingpresidentinitiallytechniquethe otherit can beexistenceunderlinethis timetelephoneitemscopepracticesadvantage);return For otherprovidingdemocracyboth the extensivesufferingsupportedcomputers functionpracticalsaid thatit may beEnglish -suspectedmargin: 0spiritual - -microsoftgraduallydiscussedhe becameexecutivejquery.jshouseholdconfirmedpurchasedliterallydestroyedup to thevariationremainingit is notcenturiesJapanese among thecompletedalgorithminterestsrebellionundefinedencourageresizableinvolvingsensitiveuniversalprovision(althoughfeaturingconducted), which continued-header">February numerous overflow:componentfragmentsexcellentcolspan="technicalnear the Advanced source ofexpressedHong Kong Facebookmultiple mechanismelevationoffensive - sponsoreddocument.or "there arethose whomovementsprocessesdifficultsubmittedrecommendconvincedpromoting" width=".replace(classicalcoalitionhis firstdecisionsassistantindicatedevolution-wrapper"enough toalong thedelivered--> - - -
Archbishop class="nobeing usedapproachesprivilegesnoscript> -results inmay be theEaster eggmechanismsreasonablePopulationCollectionselected">noscript> /index.phparrival of-jssdk'));managed toincompletecasualtiescompletionChristiansSeptember arithmeticproceduresmight haveProductionit appearsPhilosophyfriendshipleading togiving thetoward theguaranteeddocumentedcolor:#000video gamecommissionreflectingchange theassociatedsans-serifonkeypress; padding:He was theunderlyingtypically , and the srcElementsuccessivesince the should be networkingaccountinguse of thelower thanshows that - complaintscontinuousquantitiesastronomerhe did notdue to itsapplied toan averageefforts tothe futureattempt toTherefore,capabilityRepublicanwas formedElectronickilometerschallengespublishingthe formerindigenousdirectionssubsidiaryconspiracydetails ofand in theaffordablesubstancesreason forconventionitemtype="absolutelysupposedlyremained aattractivetravellingseparatelyfocuses onelementaryapplicablefound thatstylesheetmanuscriptstands for no-repeat(sometimesCommercialin Americaundertakenquarter ofan examplepersonallyindex.php? -percentagebest-knowncreating a" dir="ltrLieutenant -
is said tostructuralreferendummost oftena separate-> -
implementedcan be seenthere was ademonstratecontainer">connectionsthe Britishwas written!important;px; margin-followed byability to complicatedduring the immigrationalso called

as follows:merged withthrough thecommercial pointed outopportunityview of therequirementdivision ofprogramminghe receivedsetInterval">maintainingChristopherMuch of thewritings of" height="2size of theversion of mixture of between theExamples ofeducationalcompetitive onsubmit="director ofdistinctive/DTD XHTML relating totendency toprovince ofwhich woulddespite thescientific legislature.innerHTML allegationsAgriculturewas used inapproach tointelligentyears later,sans-serifdeterminingPerformanceappearances, which is foundationsabbreviatedhigher thans from the individual composed ofsupposed toclaims thatattributionfont-size:1elements ofHistorical his brotherat the timeanniversarygoverned byrelated to ultimately innovationsit is stillcan only bedefinitionstoGMTStringA number ofimg class="Eventually,was changedoccurred inneighboringdistinguishwhen he wasintroducingterrestrialMany of theargues thatan Americanconquest ofwidespread were killedscreen and In order toexpected todescendantsare locatedlegislativegenerations backgroundmost peopleyears afterthere is nothe highestfrequently they do notargued thatshowed thatpredominanttheologicalby the timeconsideringshort-livedcan be usedvery littleone of the had alreadyinterpretedcommunicatefeatures ofgovernment,entered the" height="3Independentpopulationslarge-scale. Although used in thedestructionpossibilitystarting intwo or moreexpressionssubordinatelarger thanhistory and -Continentaleliminatingwill not bepractice ofin front ofsite of theensure thatto create amississippipotentiallyoutstandingbetter thanwhat is nowsituated inmeta name="TraditionalsuggestionsTranslationthe form ofatmosphericideologicalenterprisescalculatingeast of theremnants ofpluginspage/index.php?remained intransformedHe was alsowas alreadystatisticalin favor ofMinistry ofmovement offormulationis required -question ofwas electedto become abecause of some peopleinspired bysuccessful a time whenmore commonamongst thean officialwidth:100%;technology,was adoptedto keep thesettlementslive birthsindex.html"Connecticutassigned to&times;account foralign=rightthe companyalways beenreturned toinvolvementBecause thethis period" name="q" confined toa result ofvalue="" />is actuallyEnvironment - -Conversely,> -
this is notthe presentif they areand finallya matter of -
- -faster thanmajority ofafter whichcomparativeto maintainimprove theawarded theer" class="frameborderrestorationin the sameanalysis oftheir firstDuring the continentalsequence offunction(){font-size: work on the -adopted theproperty ofdirected byeffectivelywas broughtchildren ofProgramminglonger thanmanuscriptswar againstby means ofand most ofsimilar to proprietaryoriginatingprestigiousgrammaticalexperience.to make theIt was alsois found incompetitorsin the U.S.replace thebrought thecalculationfall of thethe generalpracticallyin honor ofreleased inresidentialand some ofking of thereaction to1st Earl ofculture andprincipally - they can beback to thesome of hisexposure toare similarform of theaddFavoritecitizenshippart in thepeople within practiceto continue&minus;approved by the first allowed theand for thefunctioningplaying thesolution toheight="0" in his bookmore than afollows thecreated thepresence in nationalistthe idea ofa characterwere forced class="btndays of thefeatured inshowing theinterest inin place ofturn of thethe head ofLord of thepoliticallyhas its ownEducationalapproval ofsome of theeach other,behavior ofand becauseand anotherappeared onrecorded inblack"may includethe world'scan lead torefers to aborder="0" government winning theresulted in while the Washington,the subjectcity in the>

- reflect theto completebecame moreradioactiverejected bywithout anyhis father,which couldcopy of theto indicatea politicalaccounts ofconstitutesworked witherof his lifeaccompaniedclientWidthprevent theLegislativedifferentlytogether inhas severalfor anothertext of thefounded thee with the is used forchanged theusually theplace wherewhereas the> The currentthe site ofsubstantialexperience,in the Westthey shouldslovenÄinacomentariosuniversidadcondicionesactividadesexperienciatecnologíaproducciónpuntuaciónaplicacióncontraseñacategoríasregistrarseprofesionaltratamientoregístratesecretaríaprincipalesprotecciónimportantesimportanciaposibilidadinteresantecrecimientonecesidadessuscribirseasociacióndisponiblesevaluaciónestudiantesresponsableresoluciónguadalajararegistradosoportunidadcomercialesfotografíaautoridadesingenieríatelevisióncompetenciaoperacionesestablecidosimplementeactualmentenavegaciónconformidadline-height:font-family:" : "http://applicationslink" href="specifically// -/index.html"window.open( !important;application/independence//www.googleorganizationautocompleterequirementsconservative
most notably/>
notification'undefined')Furthermore,believe thatinnerHTML = prior to thedramaticallyreferring tonegotiationsheadquartersSouth AfricaunsuccessfulPennsylvaniaAs a result, -
English (US)appendChild(transmissions. However, intelligence" tabindex="float:right;Commonwealthranging fromin which theat least onereproductionencyclopedia;font-size:1jurisdictionat that time">compensationchampionshipmedia="all" violation ofreference toreturn true;Strict//EN" transactionsinterventionverificationInformation difficultiesChampionshipcapabilities} - -Christianityfor example,Professionalrestrictionssuggest thatwas released(such as theremoveClass(unemploymentthe Americanstructure of/index.html published inspan class=""> - -f (document.border: 1px {font-size:1treatment of0" height="1modificationIndependencedivided intogreater thanachievementsestablishingJavaScript" neverthelesssignificanceBroadcasting> container"> -such as the influence ofa particularsrc='http://navigation" half of the substantial  advantage ofdiscovery offundamental metropolitanthe opposite" xml:lang="deliberatelyalign=centerevolution ofpreservationimprovementsbeginning inJesus ChristPublicationsdisagreementtext-align:r, function()similaritiesbody>is currentlyalphabeticalis sometimestype="image/many of the flow:hidden;available indescribe theexistence ofall over thethe Internet