diff --git a/crates/cranelift/src/compiler/component.rs b/crates/cranelift/src/compiler/component.rs index 04d90afa8a..4b695746a2 100644 --- a/crates/cranelift/src/compiler/component.rs +++ b/crates/cranelift/src/compiler/component.rs @@ -1788,19 +1788,14 @@ mod host { $( pub(super) fn $name(isa: &dyn TargetIsa, func: &mut ir::Function) -> (ir::SigRef, ComponentBuiltinFunctionIndex) { let pointer_type = isa.pointer_type(); - let params = vec![ - $( AbiParam::new(define!(@ty pointer_type $param)) ),* - ]; - let returns = vec![ - $( AbiParam::new(define!(@ty pointer_type $result)) )? - ]; - let sig = func.import_signature(ir::Signature { - params, - returns, - call_conv: CallConv::triple_default(isa.triple()), - }); - - (sig, ComponentBuiltinFunctionIndex::$name()) + let sig = build_sig( + isa, + func, + &[$( define!(@ty pointer_type $param) ),*], + &[$( define!(@ty pointer_type $result) ),*], + ); + + return (sig, ComponentBuiltinFunctionIndex::$name()) } )* }; @@ -1817,4 +1812,28 @@ mod host { } wasmtime_environ::foreach_builtin_component_function!(define); + + fn build_sig( + isa: &dyn TargetIsa, + func: &mut ir::Function, + params: &[ir::Type], + returns: &[ir::Type], + ) -> ir::SigRef { + let mut sig = ir::Signature { + params: params.iter().map(|ty| AbiParam::new(*ty)).collect(), + returns: returns.iter().map(|ty| AbiParam::new(*ty)).collect(), + call_conv: CallConv::triple_default(isa.triple()), + }; + + // Once we're declaring the signature of a host function we must respect + // the default ABI of the platform which is where argument extension of + // params/results may come into play. + let extension = isa.default_argument_extension(); + for arg in sig.params.iter_mut().chain(sig.returns.iter_mut()) { + if arg.value_type.is_int() { + arg.extension = extension; + } + } + func.import_signature(sig) + } } diff --git a/crates/wasi-http/tests/all/p3/outgoing.rs b/crates/wasi-http/tests/all/p3/outgoing.rs index ac63287bce..9040e4ff17 100644 --- a/crates/wasi-http/tests/all/p3/outgoing.rs +++ b/crates/wasi-http/tests/all/p3/outgoing.rs @@ -76,20 +76,12 @@ async fn p3_http_outbound_request_invalid_version() -> anyhow::Result<()> { run(P3_HTTP_OUTBOUND_REQUEST_INVALID_VERSION_COMPONENT, &server).await } -#[cfg_attr( - target_arch = "riscv64", - ignore = "https://github.com/bytecodealliance/wasip3-prototyping/issues/105" -)] #[test_log::test(tokio::test(flavor = "multi_thread"))] async fn p3_http_outbound_request_invalid_header() -> anyhow::Result<()> { let server = Server::http2(1)?; run(P3_HTTP_OUTBOUND_REQUEST_INVALID_HEADER_COMPONENT, &server).await } -#[cfg_attr( - target_arch = "riscv64", - ignore = "https://github.com/bytecodealliance/wasip3-prototyping/issues/105" -)] #[test_log::test(tokio::test(flavor = "multi_thread"))] async fn p3_http_outbound_request_unknown_method() -> anyhow::Result<()> { let server = Server::http1(1)?; @@ -106,10 +98,6 @@ async fn p3_http_outbound_request_unsupported_scheme() -> anyhow::Result<()> { .await } -#[cfg_attr( - target_arch = "riscv64", - ignore = "https://github.com/bytecodealliance/wasip3-prototyping/issues/105" -)] #[test_log::test(tokio::test(flavor = "multi_thread"))] async fn p3_http_outbound_request_invalid_port() -> anyhow::Result<()> { let server = Server::http1(1)?; @@ -122,10 +110,6 @@ async fn p3_http_outbound_request_invalid_dnsname() -> anyhow::Result<()> { run(P3_HTTP_OUTBOUND_REQUEST_INVALID_DNSNAME_COMPONENT, &server).await } -#[cfg_attr( - target_arch = "riscv64", - ignore = "https://github.com/bytecodealliance/wasip3-prototyping/issues/105" -)] #[test_log::test(tokio::test(flavor = "multi_thread"))] async fn p3_http_outbound_request_response_build() -> anyhow::Result<()> { let server = Server::http1(1)?; @@ -138,10 +122,6 @@ async fn p3_http_outbound_request_content_length() -> anyhow::Result<()> { run(P3_HTTP_OUTBOUND_REQUEST_CONTENT_LENGTH_COMPONENT, &server).await } -#[cfg_attr( - target_arch = "riscv64", - ignore = "https://github.com/bytecodealliance/wasip3-prototyping/issues/105" -)] #[test_log::test(tokio::test(flavor = "multi_thread"))] async fn p3_http_outbound_request_missing_path_and_query() -> anyhow::Result<()> { let server = Server::http1(1)?;