Skip to content

[tools] Remove the IntPtr.Size inline optimization.#24597

Merged
rolfbjarne merged 1 commit intomainfrom
dev/rolf/opt-remove-intptr-size-inlining
Feb 2, 2026
Merged

[tools] Remove the IntPtr.Size inline optimization.#24597
rolfbjarne merged 1 commit intomainfrom
dev/rolf/opt-remove-intptr-size-inlining

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

We don't have any code paths conditions on IntPtr.Size anymore (because we
only support 64-bit architectures now), so the size benefits for the
optimizations are slim to non-existent (it's used in a few mathematical
expressions, pointer arithmetic, etc., nothing that affects final app size if
IntPtr.Size gets inlined or not).

We don't have any code paths conditions on IntPtr.Size anymore (because we
only support 64-bit architectures now), so the size benefits for the
optimizations are slim to non-existent (it's used in a few mathematical
expressions, pointer arithmetic, etc., nothing that affects final app size if
IntPtr.Size gets inlined or not).
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the IntPtr.Size inline optimization from the .NET for iOS/macOS/tvOS build tools. Since the platform now only supports 64-bit architectures, the optimization that inlined IntPtr.Size to a constant value no longer provides meaningful app size benefits.

Changes:

  • Removed the code implementing the IntPtr.Size optimization from the linker
  • Disabled the optimization while preserving backward compatibility for existing build configurations
  • Removed documentation for the optimization and updated code examples

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/linker/CoreOptimizeGeneratedCode.cs Removed ProcessIntPtrSize method, GetInlineIntPtrSize method, _inlineIntPtrSize dictionary, and the switch case that invoked the optimization
tools/common/Optimizations.cs Set InlineIntPtrSize valid platforms to empty array while keeping the optimization name for backward compatibility
docs/website/optimizations.md Removed the "Inline IntPtr.Size" section and updated code examples to remove IntPtr.Size checks
builds/Versions-tvOS.plist.in Removed inline-intptr-size entry from Optimizations dictionary
builds/Versions-macOS.plist.in Removed inline-intptr-size entry from Optimizations dictionary
builds/Versions-iOS.plist.in Removed inline-intptr-size entry from Optimizations dictionary
builds/Versions-MacCatalyst.plist.in Removed inline-intptr-size entry from Optimizations dictionary

@rolfbjarne rolfbjarne enabled auto-merge (squash) January 31, 2026 01:08
@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #42be985] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 42be9857bc37c7b75efb5a19886445c1439f02fd [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #42be985] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 42be9857bc37c7b75efb5a19886445c1439f02fd [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 42be9857bc37c7b75efb5a19886445c1439f02fd [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #42be985] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 42be9857bc37c7b75efb5a19886445c1439f02fd [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #42be985] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 42be9857bc37c7b75efb5a19886445c1439f02fd [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #42be985] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 42be9857bc37c7b75efb5a19886445c1439f02fd [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #42be985] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 42be9857bc37c7b75efb5a19886445c1439f02fd [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #42be985] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 42be9857bc37c7b75efb5a19886445c1439f02fd [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #42be985] Tests on macOS arm64 - Mac Tahoe (26) passed 💻

All tests on macOS arm64 - Mac Tahoe (26) passed.

Pipeline on Agent
Hash: 42be9857bc37c7b75efb5a19886445c1439f02fd [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🚀 [CI Build #42be985] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 117 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 9 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 42be9857bc37c7b75efb5a19886445c1439f02fd [PR build]

Copy link
Copy Markdown
Member

@dalexsoto dalexsoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32bits no more

@rolfbjarne rolfbjarne merged commit c098811 into main Feb 2, 2026
51 of 52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants