Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 32 additions & 13 deletions crates/cranelift/src/compiler/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
)*
};
Expand All @@ -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)
}
}
20 changes: 0 additions & 20 deletions crates/wasi-http/tests/all/p3/outgoing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand All @@ -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)?;
Expand All @@ -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)?;
Expand All @@ -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)?;
Expand Down