Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert System.Globalization unix calls to QCalls into coreclr #32132

Merged
merged 16 commits into from
Feb 19, 2020

Conversation

safern
Copy link
Member

@safern safern commented Feb 11, 2020

Relates to: #826
Since we now need to include the headers as part of mscorlib in order to define the QCall entry points, I had to use uint16_t instead of UChar. Per ICU's documentation UChar is an unsigned int of 16bits -- since we don't want to include headers from external libraries into coreclr build.

Note: marked as no-merge as since this is touching perf sensitive code paths, to measure perf.

cc: @ericstj

@safern safern added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Feb 11, 2020
@jkotas
Copy link
Member

jkotas commented Feb 11, 2020

I think it would be better to compile this separately from vm, without including PAL headers, to avoid collisions with PAL headers. Dealing with the PAL and system headers collisions is a losing battle.

@safern
Copy link
Member Author

safern commented Feb 11, 2020

I think it would be better to compile this separately from vm, without including PAL headers, to avoid collisions with PAL headers. Dealing with the PAL and system headers collisions is a losing battle.

Do you mean defining new headers for the functions that are going to be qcalls directly in the vm? Or could you provide an example?

@safern
Copy link
Member Author

safern commented Feb 11, 2020

Do you mean defining new headers for the functions that are going to be qcalls directly in the vm? Or could you provide an example?

I see, so you actually mean compiling in another partition of the runtime, which one would you suggest?

@jkotas
Copy link
Member

jkotas commented Feb 12, 2020

you actually mean compiling in another partition of the runtime, which one would you suggest?

Yep. It can be the src\coreclr\src\libraries-native that you have added in last PR.

I think you should be able to keep the shim implementation intact, and just add src\coreclr\src\libraries-native\entrypoints.c file that looks like this:

#include "pal_calendarData.h"
#include "pal_casing.h"
...

#define FCFuncStart(name) extern const void* name[]; const void* name[] = {
#define FCFuncEnd() 0x01 /* FCFuncFlag_EndOfArray */ };

#define QCFuncElement(name,impl) \
    (BYTE*)0x8 /* FCFuncFlag_QCall */, (LPVOID)(impl), (LPVOID)name,

FCFuncStart(gPalGlobalizationNative)
    QCFuncElement("ChangeCase", GlobalizationNative_ChangeCase)
    QCFuncElement("ChangeCaseInvariant", GlobalizationNative_ChangeCaseInvariant)
...
FCFuncEnd()

And then have a registration in ecalllist.h like:

extern "C" const void* gPalGlobalizationNative[];
...
FCClassElement("Globalization", "", gPalGlobalizationNative)
...

@safern
Copy link
Member Author

safern commented Feb 12, 2020

Thanks, I will try that!

@safern safern removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Feb 12, 2020
@safern
Copy link
Member Author

safern commented Feb 13, 2020

Thanks for the reviews 😄 -- I've addressed all feedback.

@jkotas
Copy link
Member

jkotas commented Feb 15, 2020

The test failures seems to be related to this change. Do not merge before fixing them.

@safern
Copy link
Member Author

safern commented Feb 15, 2020

Yes I saw that, will investigate later. It seems to be related to getting the version. Thanks for all your reviews @jkotas!

@safern safern merged commit 4365af1 into dotnet:master Feb 19, 2020
@safern safern deleted the GlobalizationQcall branch February 19, 2020 01:06
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants