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

Build CoreLib as AnyCPU #101084

Merged
merged 1 commit into from
Apr 16, 2024
Merged

Build CoreLib as AnyCPU #101084

merged 1 commit into from
Apr 16, 2024

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Apr 15, 2024

Reduce amount of architecture specific code. Minor cleanup motivated by #101038.

Reduce amount of architecture specific code. Minor cleanup motivated by dotnet#101038.
Copy link
Contributor

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

@jkotas jkotas requested a review from sbomer April 15, 2024 21:40
@tannergooding
Copy link
Member

👍 for the change in general. Couple questions...

Are there plans on changing things like in System.IntPtr to use if (Environment.Is64BitProcess) instead of #if TARGET_64BIT?

Are there any places that still use #ifdef with fields to define different layouts based on architecture or OS? If so, are there any plans for linker, trimmer, or VM features to allow this to avoid #ifdef in the future? -- I know there's been requests in the past for "layout specialization" so that one can define a type that works correctly for interop or which can optimize code based on certain constraints in the past (F# has a ValueOption<T> for example, which today must carry a bool field even for a reference type T where null is otherwise invalid, for example); so I figured this might be an interesting motivator towards those scenarios.

@jkotas
Copy link
Member Author

jkotas commented Apr 15, 2024

Are there plans on changing things like in System.IntPtr to use if (Environment.Is64BitProcess) instead of #if TARGET_64BIT

We have briefly looked into building one architecture neutral CoreLib in the past and it did not look feasible. It would require new language and runtime features to pull it off to solve the kind of problems you are talking about and/or we would have to leave perf on the table. Unless we have a plan to get rid of all ifdefs in CoreLib, a few more or less ifdefs in CoreLib are fine.

@am11
Copy link
Member

am11 commented Apr 16, 2024

Removed last usage of PlatformTarget={non-AnyCpu} in #101089

matouskozak pushed a commit to matouskozak/runtime that referenced this pull request Apr 30, 2024
Reduce amount of architecture specific code. Minor cleanup motivated by dotnet#101038.
@github-actions github-actions bot locked and limited conversation to collaborators May 16, 2024
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.

4 participants