Browse Source

Build and test wasmtime-fiber on i686/arm (#9035)

Now that we've got CI for Pulley throw in `wasmtime-fiber` as well with
a few extra fixes. This should also help improve the compilation
experience of Wasmtime to 32-bit platforms to hit a more first-class
error about unsupported platforms.
pull/9038/head
Alex Crichton 3 months ago
committed by GitHub
parent
commit
169b97fc77
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 32
      ci/build-test-matrix.js
  2. 3
      crates/fiber/src/lib.rs
  3. 5
      crates/fiber/src/unix/arm.rs
  4. 12
      crates/fiber/src/unix/x86.rs

32
ci/build-test-matrix.js

@ -26,6 +26,15 @@ const FAST_MATRIX = [
},
];
// Returns whether the given package supports a 32-bit architecture, used when
// testing on i686 and armv7 below.
function supports32Bit(pkg) {
if (pkg.indexOf("pulley") !== -1)
return true;
return pkg == 'wasmtime-fiber';
}
// This is the full, unsharded, and unfiltered matrix of what we test on
// CI. This includes a number of platforms and a number of cross-compiled
// targets that are emulated with QEMU. This must be kept tightly in sync with
@ -123,16 +132,15 @@ const FULL_MATRIX = [
"isa": "riscv64",
},
{
"name": "Test Pulley on i686-unknown-linux-gnu",
"name": "Tests on i686-unknown-linux-gnu",
"32-bit": true,
"os": "ubuntu-latest",
"target": "i686-unknown-linux-gnu",
"gcc_package": "gcc-i686-linux-gnu",
"gcc": "i686-linux-gnu-gcc",
"filter": "pulley",
},
{
"name": "Test Pulley on armv7-unknown-linux-gnueabihf",
"name": "Tests on armv7-unknown-linux-gnueabihf",
"32-bit": true,
"os": "ubuntu-latest",
"target": "armv7-unknown-linux-gnueabihf",
@ -140,7 +148,6 @@ const FULL_MATRIX = [
"gcc": "arm-linux-gnueabihf-gcc",
"qemu": "qemu-arm -L /usr/arm-linux-gnueabihf -E LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib",
"qemu_target": "arm-linux-user",
"filter": "pulley",
},
];
@ -218,14 +225,16 @@ async function shard(configs) {
// created above.
const sharded = [];
for (const config of configs) {
// Special case 32-bit configs. Only Pulley runs on 32-bit targets.
// Special case 32-bit configs. Only some crates, according to
// `supports32Bit`, run on this target. At this time the set of supported
// crates is small enough that they're not sharded.
if (config["32-bit"] === true) {
sharded.push(Object.assign(
{},
config,
{
bucket: members
.map(c => c.indexOf("pulley") !== -1 ? `--package ${c}` : `--exclude ${c}`)
.map(c => supports32Bit(c) ? `--package ${c}` : `--exclude ${c}`)
.join(" "),
}
));
@ -290,9 +299,14 @@ async function main() {
return true;
}
// If any Pulley source file was modified, then run Pulley-specific configs.
if (names.includes("pulley") && config.filter == "pulley") {
return true;
// For matrix entries that represent 32-bit only some crates support that,
// so whenever the crates are changed be sure to run 32-bit tests on PRs
// too.
if (config["32-bit"] === true) {
if (names.includes("pulley"))
return true;
if (names.includes("fiber"))
return true;
}
// If the commit explicitly asks for this test config, then include it.

3
crates/fiber/src/lib.rs

@ -283,6 +283,9 @@ mod tests {
|| cfg!(windows)
// TODO: the system libunwind is broken (#2808)
|| cfg!(all(target_os = "macos", target_arch = "aarch64"))
// TODO: see comments in `arm.rs` about how this seems to work
// in gdb but not at runtime, unsure why at this time.
|| cfg!(target_arch = "arm")
);
}

5
crates/fiber/src/unix/arm.rs

@ -8,7 +8,7 @@
// Also at this time this file is heavily based off the x86_64 file, so you'll
// probably want to read that one as well.
use wasmtime_asm_macros::{asm_func, asm_sym};
use wasmtime_asm_macros::asm_func;
// fn(top_of_stack(%r0): *mut u8)
asm_func!(
@ -36,7 +36,7 @@ asm_func!(
asm_func!(
wasmtime_versioned_export_macros::versioned_stringify_ident!(wasmtime_fiber_init),
"
adr r3, wasmtime_fiber_start
adr r3, {start}
str r3, [r0, #-0x0c] // => lr
str r0, [r0, #-0x10] // => r11
str r1, [r0, #-0x14] // => r10
@ -46,6 +46,7 @@ asm_func!(
str r3, [r0, #-0x08]
bx lr
",
start = sym super::wasmtime_fiber_start,
);
asm_func!(

12
crates/fiber/src/unix/x86.rs

@ -10,11 +10,11 @@
// different so the reserved space at the top of the stack is 8 bytes, not 16
// bytes. Still two pointers though.
use wasmtime_asm_macros::{asm_func, asm_sym};
use wasmtime_asm_macros::asm_func;
// fn(top_of_stack: *mut u8)
asm_func!(
"wasmtime_fiber_switch",
wasmtime_versioned_export_macros::versioned_stringify_ident!(wasmtime_fiber_switch),
"
// Load our stack-to-use
mov eax, 0x4[esp]
@ -45,7 +45,7 @@ asm_func!(
// entry_arg0: *mut u8,
// )
asm_func!(
"wasmtime_fiber_init",
wasmtime_versioned_export_macros::versioned_stringify_ident!(wasmtime_fiber_init),
"
mov eax, 4[esp]
@ -58,8 +58,7 @@ asm_func!(
// Move our start function to the return address which the `ret` in
// `wasmtime_fiber_start` will return to.
lea ecx, wasmtime_fiber_start2
lea ecx, wasmtime_fiber_start
lea ecx, {start}
mov -0x14[eax], ecx
// And move `entry_point` to get loaded into `%ebp` through the context
@ -81,10 +80,11 @@ asm_func!(
mov -0x08[eax], ecx
ret
",
start = sym super::wasmtime_fiber_start,
);
asm_func!(
"wasmtime_fiber_start",
wasmtime_versioned_export_macros::versioned_stringify_ident!(wasmtime_fiber_start),
"
.cfi_startproc simple
.cfi_def_cfa_offset 0

Loading…
Cancel
Save