Commit d992df3
committed
fix(runtime): Windows OSArchitecture reports the OS, and an unknown target is a build error (#1983)
The Windows branch returned getProcessArchitectureProperty() directly, so a 32-bit process on
64-bit Windows -- WOW64 -- reported X86 as the OPERATING SYSTEM's architecture. And
getProcessArchitectureProperty() FABRICATED X64 for a compilation target it did not recognise.
Landed under SA-5.
TWO OF THE TICKET'S THREE ABSENCES ARE GONE. #1983 was "BLOCKED on three independent absences,
ALL of which must be resolved before any code is written": no Windows toolchain (gone --
x86_64-w64-mingw32-g++ is installed), no /rv/tmp/runtime (gone), and no mixed-bitness Windows
host (remains). The third gates RUNTIME OBSERVATION rather than implementation, which is exactly
where #2378 stood; this takes its evidence pattern -- cross-compile the arm, prove by symbol
inspection that it is confined, state the runtime limit.
The Windows arm is RuntimeInformation.Windows.cs:34-113 transcribed: IsWow64Process2 resolved at
run time from kernel32 (it exists only on Windows 10+), mapping nativeMachine through the
IMAGE_FILE_MACHINE constants; otherwise GetNativeSystemInfo, mapping wProcessorArchitecture
through the PROCESSOR_ARCHITECTURE constants. TWO MAPPING TABLES, NOT ONE -- they are different
enumerations -- and two asymmetries are transcribed rather than tidied: the machine-constant
default falls back to ProcessArchitecture while the processor-architecture default is X86.
AN UNKNOWN TARGET IS NOW A BUILD ERROR, WHICH IS ALL .NET OFFERS. ProcessArchitecture's chain of
#if TARGET_* ends in `#error Unknown Architecture` (RuntimeInformation.cs:49-50). There is no
runtime fallback because there is no correct runtime answer: the property is a statement about
the compilation target, so an unknown target means the BUILD is wrong.
Mutations: 4 attempts, 2 valid, both caught; 2 invalid as first written (a bad splice past a
closing brace, and a verdict I printed backwards) and reformulated rather than counted.
- The Windows arm reverting to ProcessArchitecture is caught by symbol inspection: the Windows
object's imports of GetModuleHandleW/GetProcAddress/GetNativeSystemInfo drop from 2 to 0 and
the "IsWow64Process2" string from 1 to 0. The POSIX object has none of them and still calls
uname, so the branch is confined by construction.
- Replacing the #error with a fabricated X64 is caught by a probe that lifts the preprocessor
chain verbatim and compiles it with the recognised target macros suppressed: the baseline is
REJECTED and the mutation COMPILES. (The file itself cannot be recompiled with __x86_64__
suppressed -- the system headers fail first -- which is why the chain is lifted.)
ONE MUTATION IS UNCAUGHT AND CANNOT BE CAUGHT HERE: making the IMAGE_FILE_MACHINE default invent
X64 instead of falling back alters no symbol and no string, so symbol inspection passes it. The
arm's BEHAVIOUR is unverifiable without executing it -- that is the third absence, restated
rather than waved away. The mapping tables are transcribed constant by constant for that reason,
and the note is at the site.
Gate: 17,404 run, 17,404 passed, 0 failed, 0 skipped across 38 executables (+2, in
SharpRuntimeTests_Runtime, 168 -> 170). The Windows arm cross-compiles clean with -Wall -Wextra.
Built in build/ with --parallel 2. No behaviour change on Linux, macOS or Emscripten.
Downstream: zero RuntimeInformation code sites in cna and mobile-eggbert.
docs/Migration-RuntimeInformationOSArchitecture.md1 parent c96e67f commit d992df3
5 files changed
Lines changed: 211 additions & 3 deletions
File tree
- docs
- modules/runtime
- src/System/Runtime/InteropServices
- tests/System/Runtime/InteropServices
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
Lines changed: 74 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
35 | 46 | | |
36 | 47 | | |
37 | 48 | | |
| |||
42 | 53 | | |
43 | 54 | | |
44 | 55 | | |
45 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
46 | 118 | | |
47 | 119 | | |
48 | 120 | | |
| |||
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
Binary file not shown.
0 commit comments