Globalization merge#9835
Conversation
| <MscorlibSources Include="$(BclSourcesRoot)\System\Globalization\JapaneseLunisolarCalendar.cs" /> | ||
| <MscorlibSources Include="$(BclSourcesRoot)\System\Globalization\JulianCalendar.cs" /> | ||
| <MscorlibSources Include="$(BclSourcesRoot)\System\Globalization\KoreanCalendar.cs" /> | ||
| <MscorlibSources Include="$(BclSourcesRoot)\System\Globalization\KoreanLunisolarCalendar.cs" /> |
There was a problem hiding this comment.
Shouldn't we be rather keeping the version of System\Globalization* files from under corefx? The copy under corefx is better formatted and factored.
There was a problem hiding this comment.
that is what I have done. I copied the files from corefx to BclSourceRoot\S\G and deleted all files in corefx\S\G folder. but the code we have now is what we had in corefx folder.
I am just thinking later we should get rid of the whole corefx folder
There was a problem hiding this comment.
I see a bunch of diffs between current corefx\System\Globalization and what's in Globalization with your changes. There are cosmetic changes, some things got converted back to having m_ prefixes, ... .
There was a problem hiding this comment.
this may be because we had the formatting changes and I had to merge with it. I'll check renamed m_*
| using System.Collections.Generic; | ||
|
|
||
| #if INSIDE_CLR | ||
| using Kernel32 = Interop.Kernel32; |
There was a problem hiding this comment.
You do not need these. The CoreRT copy should be switched to kernel32.dll, etc. as well. dotnet/corert#2241
There was a problem hiding this comment.
ok I'll clean these then
| { | ||
| EnumCalendarsData data = new EnumCalendarsData(); | ||
| data.userOverride = 0; | ||
| #if INSIDE_CLR |
There was a problem hiding this comment.
We should just use #if CORECLR for these. INSIDE_CLR is hard to decipher.
There was a problem hiding this comment.
I didn't introduce INSIDE_CLR, it was there and I just used it. I can use CORECLR but we need to check if this not compiled for corert/PN
There was a problem hiding this comment.
I know you have not introduced INSIDE_CLR. We have several different ifdefs that are used for this purpose because of they were introduced by different people at different times. I am suggesting that #if CORECLR is the one we should standardize on because of it is the most logical one.
There was a problem hiding this comment.
There was a problem hiding this comment.
I checked corert and not using CORECLR as expected. so I'll change my ifdef's to CORECLR.
|
@mellinoe did you see such failure in Windows_NT x86 Checked Build and Test (Jit - CoreFx) before? https://ci.dot.net/job/dotnet_coreclr/job/master/job/jitstress/job/x86_checked_windows_nt_corefx_baseline_prtest/18/ looks unrelated to my changes. |
|
/cc @krwq you won't have time to review this but as a Glob co owner you should be aware of it .. |
This change is merging the globalization code used for Linux and Windows. here Is come notes about this merge: - Mainly picked most of the code from the corefx folder as it is well formatted and cleaned up before and then tweaked the implementation to work on Windows - Tries to reduce the dependencies from Globalization code on the VM. this will give flexibility to work on the code without worrying the VM - Provided the missing implementation as I removed many internal calls to the VM. This also help in having .Net Native have complete implementation for .net standard 2.0 - We may need to have some small tweaks when merging this globalization code to corert - We'll need to do some clean up for the code which not used anymore in the VM
3faedba to
8f7ef77
Compare
|
@dotnet-bot test this please |
|
@mmitche do you know why the CI is not running on this PR? |
|
@tarekgh GitHub is having issues with their webhooks. Please see the DDIT outage mail just sent a few minutes ago (and let me know if you didn't get it). They do appear to be coming back online and undelivered hooks are being delivered in some cases. |
|
@jkotas I have fixed all issues according to your comments. please let me know if you have any more comments. thanks. |
| { | ||
| EnumCalendarsData data = new EnumCalendarsData(); | ||
| data.userOverride = 0; | ||
| #if CORECLR |
There was a problem hiding this comment.
Other places are using using under #if CORECLR at the top of the file to reduce number of ifdefs. Do the same here?
There was a problem hiding this comment.
(And other places with the same pattern.)
| using System.Diagnostics.Contracts; | ||
| using System.Runtime.Serialization; | ||
| using System.Threading; | ||
| #if FEATURE_APPX && !FEATURE_COREFX_GLOBALIZATION |
There was a problem hiding this comment.
What does FEATURE_COREFX_GLOBALIZATION mean now that you have gotten rid of it? Should this ifdef be deleted?
There was a problem hiding this comment.
FEATURE_COREFX_GLOBALIZATION is mainly reflecting Linux. this is how is defined awhile ago. I agree it is not needed here. I'll remove it
| using System.Diagnostics.Contracts; | ||
| using System.Runtime.Serialization; | ||
| using System.Threading; | ||
| #if FEATURE_APPX && !FEATURE_COREFX_GLOBALIZATION |
There was a problem hiding this comment.
The WinRT specific stuff (FEATURE_APPX) should be in CultureInfo.Windows.cs
There was a problem hiding this comment.
Multiple places - there should be no FEATURE_APPX ifdef in this file
| @@ -61,11 +61,11 @@ sealed public partial class NumberFormatInfo : ICloneable, IFormatProvider | |||
| internal String numberGroupSeparator = ","; | |||
| internal String currencyGroupSeparator = ","; | |||
| internal String currencyDecimalSeparator = "."; | |||
| #if FEATURE_COREFX_GLOBALIZATION | |||
| internal String currencySymbol = "$"; // TODO: CoreFX #846 Restore to the original value "\x00a4"; // U+00a4 is the symbol for International Monetary Fund. | |||
There was a problem hiding this comment.
This looks like a hack that we forgot to cleanup. Shouldn't we rather get rid of it than keep replicating it?
| byte [] keyData = null; | ||
| if (source.Length == 0) | ||
| { | ||
| keyData = EmptyArray<Byte>.Value; |
There was a problem hiding this comment.
EmptyArray<byte>.Value is not going to compile in CoreRT. Could you please use Array.Empty<byte>() instead?
| @@ -82,7 +82,7 @@ private unsafe int GetHashCodeOfStringCore(string source, CompareOptions options | |||
|
|
|||
| fixed (char* pSource = source) | |||
There was a problem hiding this comment.
Does this have the hashcode randomization like the existing CoreCLR Windows version?
There was a problem hiding this comment.
CoreCLR doesn't do randomization on the hash when requesting the linguistic hash code. look at the original
it is passing false for the randomization.
randomized hash done on the string but not on CompareInfo.
There was a problem hiding this comment.
The randomized string hashing should be unconditionally enabled in .NET Core. It should not matter what you pass in here, it will be overridden by s_NlsHashProvider.GetUseRandomHashing() in the QCall.
There was a problem hiding this comment.
You can remove the bool flag for randomized string hashing while you are on it because of it is unused.
|
Thanks @jkotas. I think I have addressed all your comments. |
|
@mellinoe: that failure is not something I've seen before. I'll look into it. |
|
@dotnet-bot test Windows_NT x86 corefx_baseline |
* Merging the Globalization code in coreclr This change is merging the globalization code used for Linux and Windows. here Is come notes about this merge: - Mainly picked most of the code from the corefx folder as it is well formatted and cleaned up before and then tweaked the implementation to work on Windows - Tries to reduce the dependencies from Globalization code on the VM. this will give flexibility to work on the code without worrying the VM - Provided the missing implementation as I removed many internal calls to the VM. This also help in having .Net Native have complete implementation for .net standard 2.0 - We may need to have some small tweaks when merging this globalization code to corert - We'll need to do some clean up for the code which not used anymore in the VM * Fix ifdef's * Fix field name in linux build * Fix field name in linux compilation * Misc cleanup & return randomized hashing * Fix missing method for Linux * one more minor fix * Fix Linux build
|
@tarekgh it seems like not all changes from this PR are synced into corert. E.g. CultureInfo._name in coreclr is CultureInfo.m_name in corert. |
|
@ViktorHofer this PR was merging the globalization implementation between Linux and Windows. it was not touching corert. during that time the serialization was not a concern. |
* Merging the Globalization code in coreclr This change is merging the globalization code used for Linux and Windows. here Is come notes about this merge: - Mainly picked most of the code from the corefx folder as it is well formatted and cleaned up before and then tweaked the implementation to work on Windows - Tries to reduce the dependencies from Globalization code on the VM. this will give flexibility to work on the code without worrying the VM - Provided the missing implementation as I removed many internal calls to the VM. This also help in having .Net Native have complete implementation for .net standard 2.0 - We may need to have some small tweaks when merging this globalization code to corert - We'll need to do some clean up for the code which not used anymore in the VM * Fix ifdef's * Fix field name in linux build * Fix field name in linux compilation * Misc cleanup & return randomized hashing * Fix missing method for Linux * one more minor fix * Fix Linux build Commit migrated from dotnet/coreclr@a2c684d
This change is merging the globalization code used for Linux and Windows. here Is come notes about this merge: