From fb06f683fb5440bc1f91d338fa804dc5a91dc230 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Wed, 16 Apr 2025 21:33:08 +0100 Subject: [PATCH] Embedded: fix arguments mismatch in `ResultTypeInfo` Mismatched number of arguments traps on Wasm. Second argument of `destroy` in VW seems unused, so let's pass `nullptr` as a workaround. --- include/swift/ABI/Task.h | 4 ++-- include/swift/ABI/TaskOptions.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/swift/ABI/Task.h b/include/swift/ABI/Task.h index 1961ec2514996..937cba5ffe9a5 100644 --- a/include/swift/ABI/Task.h +++ b/include/swift/ABI/Task.h @@ -240,7 +240,7 @@ struct ResultTypeInfo { void (*initializeWithCopy)(OpaqueValue *result, OpaqueValue *src) = nullptr; void (*storeEnumTagSinglePayload)(OpaqueValue *v, unsigned whichCase, unsigned emptyCases) = nullptr; - void (*destroy)(OpaqueValue *) = nullptr; + void (*destroy)(OpaqueValue *, void *) = nullptr; bool isNull() { return initializeWithCopy == nullptr; @@ -259,7 +259,7 @@ struct ResultTypeInfo { storeEnumTagSinglePayload(v, whichCase, emptyCases); } void vw_destroy(OpaqueValue *v) { - destroy(v); + destroy(v, nullptr); } #endif }; diff --git a/include/swift/ABI/TaskOptions.h b/include/swift/ABI/TaskOptions.h index f1b8448e3841f..a6e280c683d7f 100644 --- a/include/swift/ABI/TaskOptions.h +++ b/include/swift/ABI/TaskOptions.h @@ -199,7 +199,7 @@ class AsyncLetWithBufferTaskOptionRecord : public TaskOptionRecord { AsyncLet *getAsyncLet() const { return asyncLet; } - + void *getResultBuffer() const { return resultBuffer; } @@ -224,7 +224,7 @@ class ResultTypeInfoTaskOptionRecord : public TaskOptionRecord { storeEnumTagSinglePayload)(OpaqueValue *, unsigned, unsigned); void (*__ptrauth_swift_value_witness_function_pointer( - SpecialPointerAuthDiscriminators::Destroy) destroy)(OpaqueValue *); + SpecialPointerAuthDiscriminators::Destroy) destroy)(OpaqueValue *, void *); static bool classof(const TaskOptionRecord *record) { return record->getKind() == TaskOptionRecordKind::ResultTypeInfo;