diff --git a/Documentation/prerequisites-for-building.md b/Documentation/prerequisites-for-building.md index 7f6970ce83f..b76100fe2ca 100644 --- a/Documentation/prerequisites-for-building.md +++ b/Documentation/prerequisites-for-building.md @@ -28,3 +28,4 @@ sudo apt-get install cmake clang-3.9 libicu52 libunwind8 1. Install [Command Line Tools for XCode 8](https://developer.apple.com/xcode/download/) or higher. 2. Install [CMake](https://cmake.org/download/). Launch `/Applications/CMake.app/Contents/MacOS/CMake` GUI. Goto "OSX App Menu -> Tools -> Install For Command Line Use" and follow the steps. CMake < 3.6 has [a bug](https://cmake.org/Bug/view.php?id=16064) that can make `--install` fail. Do `sudo mkdir /usr/local/bin` to work around. 3. Install OpenSSL. Build tools have a dependency on OpenSSL. You can use [Homebrew](http://brew.sh/) to install it: with Homebrew installed, run `brew install openssl` followed by `ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/`, followed by `ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/`. +4. Install ICU (International Components for Unicode). It can be obtained via [Homebrew](http://brew.sh/): run `brew install icu4c` followed by `brew link --force icu4c` diff --git a/src/BuildIntegration/Microsoft.NETCore.Native.Unix.props b/src/BuildIntegration/Microsoft.NETCore.Native.Unix.props index b82b5f8e9dd..a8d414e6697 100644 --- a/src/BuildIntegration/Microsoft.NETCore.Native.Unix.props +++ b/src/BuildIntegration/Microsoft.NETCore.Native.Unix.props @@ -40,6 +40,7 @@ See the LICENSE file in the project root for more information. + @@ -51,5 +52,6 @@ See the LICENSE file in the project root for more information. + diff --git a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj index f9122722a14..acab578e6b8 100644 --- a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -498,11 +498,14 @@ + + + @@ -932,20 +935,33 @@ Interop\Windows\mincore\Interop.QueryUnbiasedInterruptTime.cs - - - - + + + + + + + + + + + + + - --> + + + + @@ -1048,18 +1064,33 @@ Interop\Unix\System.Native\Interop.Write.cs - - - - - - - - - - - - + + Interop\Unix\System.Globalization.Native\Interop.Calendar.cs + + + Interop\Unix\System.Globalization.Native\Interop.Casing.cs + + + Interop\Unix\System.Globalization.Native\Interop.Collation.cs + + + Interop\Unix\System.Globalization.Native\Interop.Idna.cs + + + Interop\Unix\System.Globalization.Native\Interop.Locale.cs + + + Interop\Unix\System.Globalization.Native\Interop.Normalization.cs + + + Interop\Unix\System.Globalization.Native\Interop.ResultCode.cs + + + Interop\Unix\System.Globalization.Native\Interop.TimeZoneInfo.cs + + + Interop\Unix\System.Globalization.Native\Interop.Utils.cs + diff --git a/src/System.Private.CoreLib/src/System/Globalization/CompareInfo.Unix.cs b/src/System.Private.CoreLib/src/System/Globalization/CompareInfo.Unix.cs index 21c3c9f7e4d..1500149dc26 100644 --- a/src/System.Private.CoreLib/src/System/Globalization/CompareInfo.Unix.cs +++ b/src/System.Private.CoreLib/src/System/Globalization/CompareInfo.Unix.cs @@ -174,12 +174,12 @@ private unsafe int IndexOfCore(string source, string target, int startIndex, int { return IndexOfOrdinal(source, target, startIndex, count, ignoreCase: false); } - +#if CORECLR if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options) && source.IsFastSort() && target.IsFastSort()) { return IndexOf(source, target, startIndex, count, GetOrdinalCompareOptions(options)); } - +#endif fixed (char* pSource = source) { int index = Interop.GlobalizationInterop.IndexOf(_sortHandle, target, target.Length, pSource + startIndex, count, options); @@ -204,10 +204,12 @@ private unsafe int LastIndexOfCore(string source, string target, int startIndex, return LastIndexOfOrdinal(source, target, startIndex, count, ignoreCase: false); } +#if CORECLR if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options) && source.IsFastSort() && target.IsFastSort()) { return LastIndexOf(source, target, startIndex, count, GetOrdinalCompareOptions(options)); } +#endif // startIndex is the index into source where we start search backwards from. leftStartIndex is the index into source // of the start of the string that is count characters away from startIndex. @@ -227,10 +229,12 @@ private bool StartsWith(string source, string prefix, CompareOptions options) Debug.Assert(!string.IsNullOrEmpty(prefix)); Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0); +#if CORECLR if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options) && source.IsFastSort() && prefix.IsFastSort()) { return IsPrefix(source, prefix, GetOrdinalCompareOptions(options)); } +#endif return Interop.GlobalizationInterop.StartsWith(_sortHandle, prefix, prefix.Length, source, source.Length, options); } @@ -241,10 +245,12 @@ private bool EndsWith(string source, string suffix, CompareOptions options) Debug.Assert(!string.IsNullOrEmpty(suffix)); Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0); +#if CORECLR if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options) && source.IsFastSort() && suffix.IsFastSort()) { return IsSuffix(source, suffix, GetOrdinalCompareOptions(options)); } +#endif return Interop.GlobalizationInterop.EndsWith(_sortHandle, suffix, suffix.Length, source, source.Length, options); } @@ -256,13 +262,13 @@ private unsafe SortKey CreateSortKey(String source, CompareOptions options) if ((options & ValidSortkeyCtorMaskOffFlags) != 0) { - throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag"), nameof(options)); + throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options)); } byte [] keyData; if (source.Length == 0) { - keyData = EmptyArray.Value; + keyData = Array.Empty(); } else { @@ -348,9 +354,35 @@ internal unsafe int GetHashCodeOfStringCore(string source, CompareOptions option } } - [DllImport(JitHelpers.QCall)] - [SuppressUnmanagedCodeSecurity] - private static unsafe extern int InternalHashSortKey(byte* sortKey, int sortKeyLength, [MarshalAs(UnmanagedType.Bool)] bool forceRandomizedHashing, long additionalEntropy); + private static unsafe int InternalHashSortKey(byte* sortKey, int sortKeyLength, bool forceRandomizedHashing, long additionalEntropy) + { + if (forceRandomizedHashing || additionalEntropy != 0) + { + // TODO: Random hashing is yet to be done + // Active Issue: https://github.com/dotnet/corert/issues/2588 + throw new NotImplementedException(); + } + else + { + int hash1 = 5381; + int hash2 = hash1; + if (sortKeyLength == 0) + { + return 0; + } + if (sortKeyLength == 1) + { + return (((hash1 << 5) + hash1) ^ sortKey[0]) + (hash2 * 1566083941); + } + + for (int i = 0; i < (sortKeyLength & ~1); i += 2) + { + hash1 = ((hash1 << 5) + hash1) ^ sortKey[i]; + hash2 = ((hash2 << 5) + hash2) ^ sortKey[i+1]; + } + return hash1 + (hash2 * 1566083941); + } + } private static CompareOptions GetOrdinalCompareOptions(CompareOptions options) { diff --git a/src/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs b/src/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs index 16ebfbbafc7..deee5944244 100644 --- a/src/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs +++ b/src/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs @@ -60,8 +60,8 @@ public partial class CompareInfo // The interesting part is that since haw-US doesn't have its own sort, it has to point at another // locale, which is what SCOMPAREINFO does. - private readonly String _name; // The name used to construct this CompareInfo - private readonly String _sortName; // The name that defines our behavior + private String _name; // The name used to construct this CompareInfo + private String _sortName; // The name that defines our behavior private SortVersion _sortVersion; diff --git a/src/System.Private.CoreLib/src/System/Globalization/CultureInfo.Unix.cs b/src/System.Private.CoreLib/src/System/Globalization/CultureInfo.Unix.cs index 6911688b088..e9fe86acee9 100644 --- a/src/System.Private.CoreLib/src/System/Globalization/CultureInfo.Unix.cs +++ b/src/System.Private.CoreLib/src/System/Globalization/CultureInfo.Unix.cs @@ -18,7 +18,7 @@ internal static CultureInfo GetUserDefaultCulture() if (CultureData.GetDefaultLocaleName(out localeName)) { cultureInfo = GetCultureByName(localeName, true); - cultureInfo.m_isReadOnly = true; + cultureInfo._isReadOnly = true; } else { diff --git a/src/System.Private.CoreLib/src/System/Globalization/TextInfo.Unix.cs b/src/System.Private.CoreLib/src/System/Globalization/TextInfo.Unix.cs index 3d9b777f64a..a75b2a92794 100644 --- a/src/System.Private.CoreLib/src/System/Globalization/TextInfo.Unix.cs +++ b/src/System.Private.CoreLib/src/System/Globalization/TextInfo.Unix.cs @@ -49,6 +49,7 @@ private unsafe string ChangeCase(string s, bool toUpper) { fixed (char* pResult = result) { +#if CORECLR if (IsAsciiCasingSameAsInvariant && s.IsAscii()) { int length = s.Length; @@ -69,6 +70,7 @@ private unsafe string ChangeCase(string s, bool toUpper) } } else +#endif { ChangeCase(pSource, s.Length, pResult, result.Length, toUpper); } diff --git a/src/System.Private.Interop/src/System/Runtime/InteropServices/MarshalAsAttribute.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/MarshalAsAttribute.cs similarity index 100% rename from src/System.Private.Interop/src/System/Runtime/InteropServices/MarshalAsAttribute.cs rename to src/System.Private.CoreLib/src/System/Runtime/InteropServices/MarshalAsAttribute.cs diff --git a/src/System.Private.Interop/src/System/Runtime/InteropServices/UnmanagedType.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/UnmanagedType.cs similarity index 100% rename from src/System.Private.Interop/src/System/Runtime/InteropServices/UnmanagedType.cs rename to src/System.Private.CoreLib/src/System/Runtime/InteropServices/UnmanagedType.cs diff --git a/src/System.Private.Interop/src/System/Runtime/InteropServices/VarEnum.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/VarEnum.cs similarity index 100% rename from src/System.Private.Interop/src/System/Runtime/InteropServices/VarEnum.cs rename to src/System.Private.CoreLib/src/System/Runtime/InteropServices/VarEnum.cs diff --git a/src/System.Private.Interop/src/System.Private.Interop.csproj b/src/System.Private.Interop/src/System.Private.Interop.csproj index a9c433f0d50..4d299e4cd9c 100644 --- a/src/System.Private.Interop/src/System.Private.Interop.csproj +++ b/src/System.Private.Interop/src/System.Private.Interop.csproj @@ -144,7 +144,6 @@ - @@ -153,9 +152,7 @@ - - diff --git a/src/System.Private.Interop/src/TypeForwarders.cs b/src/System.Private.Interop/src/TypeForwarders.cs index a62e87b36af..0c636f7b4b2 100644 --- a/src/System.Private.Interop/src/TypeForwarders.cs +++ b/src/System.Private.Interop/src/TypeForwarders.cs @@ -3,3 +3,6 @@ // See the LICENSE file in the project root for more information. [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.SafeBuffer))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.MarshalAsAttribute))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.UnmanagedType))] +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.VarEnum))] diff --git a/src/packaging/netcoreapp/project.json b/src/packaging/netcoreapp/project.json index 5d366a435d4..a3e9f826be2 100644 --- a/src/packaging/netcoreapp/project.json +++ b/src/packaging/netcoreapp/project.json @@ -8,7 +8,8 @@ "System.Linq": "4.4.0-beta-24913-02", "System.Runtime.CompilerServices.Unsafe": "4.4.0-beta-24913-02", - "runtime.native.System": "4.4.0-beta-24913-02" + "runtime.native.System": "4.4.0-beta-24913-02", + "Microsoft.NETCore.Native": "1.2.0-beta-24911-02" } } }, diff --git a/src/packaging/packages.targets b/src/packaging/packages.targets index 9fa9668715e..8b3605941fe 100644 --- a/src/packaging/packages.targets +++ b/src/packaging/packages.targets @@ -27,6 +27,8 @@ 1.2.0-beta-24911-02 + 1.2.0-beta-24911-02 + 1.0.13-prerelease-00001 ubuntu.14.04-x64 $(NuPkgRid) @@ -172,6 +174,7 @@ + ]]>