| ... | @@ -125,40 +125,33 @@ pub fn getExternalExecutor( | ... | @@ -125,40 +125,33 @@ pub fn getExternalExecutor( |
| 125 | }; | 125 | }; |
| 126 | } | 126 | } |
| 127 | | 127 | |
| | 128 | if (options.allow_wasmtime and candidate.cpu.arch.isWasm()) { |
| | 129 | return Executor{ .wasmtime = "wasmtime" }; |
| | 130 | } |
| | 131 | |
| 128 | switch (candidate.os.tag) { | 132 | switch (candidate.os.tag) { |
| 129 | .windows => { | 133 | .windows => { |
| 130 | if (options.allow_wine) { | 134 | if (options.allow_wine) { |
| 131 | // x86_64 wine does not support emulating aarch64-windows and | 135 | const wine_supported = switch (candidate.cpu.arch) { |
| 132 | // vice versa. | 136 | .thumb => switch (host.cpu.arch) { |
| 133 | if (candidate.cpu.arch != builtin.cpu.arch and | 137 | .arm, .thumb, .aarch64 => true, |
| 134 | !(candidate.cpu.arch == .thumb and builtin.cpu.arch == .aarch64) and | 138 | else => false, |
| 135 | !(candidate.cpu.arch == .x86 and builtin.cpu.arch == .x86_64)) | 139 | }, |
| 136 | { | 140 | .aarch64 => host.cpu.arch == .aarch64, |
| 137 | return bad_result; | 141 | .x86 => host.cpu.arch.isX86(), |
| 138 | } | 142 | .x86_64 => host.cpu.arch == .x86_64, |
| 139 | switch (candidate.ptrBitWidth()) { | 143 | else => false, |
| 140 | 32 => return Executor{ .wine = "wine" }, | 144 | }; |
| 141 | 64 => return Executor{ .wine = "wine64" }, | 145 | return if (wine_supported) Executor{ .wine = "wine" } else bad_result; |
| 142 | else => return bad_result, | | |
| 143 | } | | |
| 144 | } | | |
| 145 | return bad_result; | | |
| 146 | }, | | |
| 147 | .wasi => { | | |
| 148 | if (options.allow_wasmtime) { | | |
| 149 | switch (candidate.ptrBitWidth()) { | | |
| 150 | 32 => return Executor{ .wasmtime = "wasmtime" }, | | |
| 151 | else => return bad_result, | | |
| 152 | } | | |
| 153 | } | 146 | } |
| 154 | return bad_result; | 147 | return bad_result; |
| 155 | }, | 148 | }, |
| 156 | .macos => { | 149 | .driverkit, .macos => { |
| 157 | if (options.allow_darling) { | 150 | if (options.allow_darling) { |
| 158 | // This check can be loosened once darling adds a QEMU-based emulation | 151 | // This check can be loosened once darling adds a QEMU-based emulation |
| 159 | // layer for non-host architectures: | 152 | // layer for non-host architectures: |
| 160 | // https://github.com/darlinghq/darling/issues/863 | 153 | // https://github.com/darlinghq/darling/issues/863 |
| 161 | if (candidate.cpu.arch != builtin.cpu.arch) { | 154 | if (candidate.cpu.arch != host.cpu.arch) { |
| 162 | return bad_result; | 155 | return bad_result; |
| 163 | } | 156 | } |
| 164 | return Executor{ .darling = "darling" }; | 157 | return Executor{ .darling = "darling" }; |