mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Embedded WASI: fix InitializeWithCopy VWT type mismatch
Fixes Embedded Swift concurrency tests that crash with this stack trace:
```
Error: Trap: indirect call type mismatch, expected FunctionType(parameters: [WasmTypes.ValueType.i32, WasmTypes.ValueType.i32], results: []), got FunctionType(parameters: [W
asmTypes.ValueType.i32, WasmTypes.ValueType.i32, WasmTypes.ValueType.i32], results: [WasmTypes.ValueType.i32])
0: swift::AsyncTask::completeFuture(swift::AsyncContext*)
1: completeTaskAndRelease(swift::AsyncContext*, swift::SwiftError*)
2: completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*)
3: $exIeAgHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRyt_Tg5TATQ0_
4: $exIeAgHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRyt_Tg5TQ0_
5: $e1a4MainV4mainyyYaFZyyYacfU_TATQ0_
6: $e1a4MainV4mainyyYaFZyyYacfU_TY1_
7: swift_task_switch
8: $e1a4MainV4mainyyYaFZyyYacfU_TQ0_
9: $e1a4testSiyYaFTY0_
10: swift::runJobInEstablishedExecutorContext(swift::Job*)
11: swift_job_run
12: $es19CooperativeExecutorC8runUntilyySbyXEKF
13: $es19CooperativeExecutorCs07RunLoopB0ssACP3runyyKFTW
14: swift_task_asyncMainDrainQueueImpl
15: swift_task_asyncMainDrainQueue
16: main
17: __main_void
18: _start
19: unknown
```
This commit is contained in:
@@ -241,7 +241,7 @@ struct ResultTypeInfo {
|
||||
#else
|
||||
size_t size = 0;
|
||||
size_t alignMask = 0;
|
||||
void (*initializeWithCopy)(OpaqueValue *result, OpaqueValue *src) = nullptr;
|
||||
OpaqueValue * (*initializeWithCopy)(OpaqueValue *result, OpaqueValue *src, void *type) = nullptr;
|
||||
void (*storeEnumTagSinglePayload)(OpaqueValue *v, unsigned whichCase,
|
||||
unsigned emptyCases) = nullptr;
|
||||
void (*destroy)(OpaqueValue *, void *) = nullptr;
|
||||
@@ -256,7 +256,7 @@ struct ResultTypeInfo {
|
||||
return alignMask + 1;
|
||||
}
|
||||
void vw_initializeWithCopy(OpaqueValue *result, OpaqueValue *src) {
|
||||
initializeWithCopy(result, src);
|
||||
initializeWithCopy(result, src, nullptr);
|
||||
}
|
||||
void vw_storeEnumTagSinglePayload(OpaqueValue *v, unsigned whichCase,
|
||||
unsigned emptyCases) {
|
||||
|
||||
@@ -215,9 +215,9 @@ class ResultTypeInfoTaskOptionRecord : public TaskOptionRecord {
|
||||
size_t size;
|
||||
size_t alignMask;
|
||||
|
||||
void (*__ptrauth_swift_value_witness_function_pointer(
|
||||
OpaqueValue *(*__ptrauth_swift_value_witness_function_pointer(
|
||||
SpecialPointerAuthDiscriminators::InitializeWithCopy)
|
||||
initializeWithCopy)(OpaqueValue *, OpaqueValue *);
|
||||
initializeWithCopy)(OpaqueValue *, OpaqueValue *, void *);
|
||||
|
||||
void (*__ptrauth_swift_value_witness_function_pointer(
|
||||
SpecialPointerAuthDiscriminators::StoreEnumTagSinglePayload)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-frontend -enable-experimental-feature Embedded -parse-as-library %s -c -o %t/a.o
|
||||
// RUN: %target-clang %t/a.o -o %t/a.out -L%swift_obj_root/lib/swift/embedded/%target-cpu-apple-macos -lswift_Concurrency -lswift_ConcurrencyDefaultExecutor -dead_strip
|
||||
// RUN: %target-clang %t/a.o -o %t/a.out -L%swift_obj_root/lib/swift/embedded/%module-target-triple %target-clang-resource-dir-opt -lswift_Concurrency %target-swift-default-executor-opt -dead_strip
|
||||
// RUN: %target-run %t/a.out | %FileCheck %s
|
||||
|
||||
// REQUIRES: executable_test
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: optimized_stdlib
|
||||
// REQUIRES: OS=macosx
|
||||
// REQUIRES: OS=macosx || OS=wasip1
|
||||
// REQUIRES: swift_feature_Embedded
|
||||
|
||||
import _Concurrency
|
||||
|
||||
Reference in New Issue
Block a user