Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable swiftasynccall calling convention with tail-call feature #5568

Open
2 of 4 tasks
kateinoigakukun opened this issue Feb 12, 2024 · 3 comments
Open
2 of 4 tasks

Comments

@kateinoigakukun
Copy link
Member

kateinoigakukun commented Feb 12, 2024

Currently, we are using simple recursive call for coroutine lowering in CoroSplit LLVM pass. However, it limits number of suspension chains due to the limitation of number of call frames.

In theory, with tail-call feature, which is now in standardizing phase, we can use swiftasynccall calling convention and musttail call to ensure the call is tail-called, and it will remove the limitation of the length of suspension chain.

Blockers

  • Swift SDK Support: We need to build separate stdlib builds for tail-call enabled and not, to allow produced binary to be used with WebAssembly runtimes with/without tail-call support. Managing multiple variants of stdlib builds requires supporting Swift SDK at first.
  • Fix WebAssembly LLVM backend for async coroutine lowering. See my comment
  • CI failure: cannot guarantee tail call due to mismatched parameter counts #5567
  • Support tail-call feature in WasmKit, to be able to run tests in upstream CI
@kateinoigakukun kateinoigakukun changed the title Enable swifttail calling convention when -mtail-call is enabled Enable swiftasynccall calling convention with tail-call feature Feb 12, 2024
@kateinoigakukun
Copy link
Member Author

kateinoigakukun commented Feb 12, 2024

I tried to enable swiftasynccall calling convention in LLVM with Wasm, but got assertion hit below:

LLVM patch
diff --git a/clang/lib/Basic/Targets/WebAssembly.h b/clang/lib/Basic/Targets/WebAssembly.h
index 9484898fe1c5..87ddcf8392d8 100644
--- a/clang/lib/Basic/Targets/WebAssembly.h
+++ b/clang/lib/Basic/Targets/WebAssembly.h
@@ -155,7 +155,7 @@ private:
     case CC_Swift:
       return CCCR_OK;
     case CC_SwiftAsync:
-      return CCCR_Error;
+      return hasFeature("tail-call") ? CCCR_OK : CCCR_Error;
     default:
       return CCCR_Warning;
     }
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index f00d02ad4190..483b5e481c09 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -27,6 +27,7 @@
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 #include "llvm/CodeGen/SelectionDAG.h"
 #include "llvm/CodeGen/SelectionDAGNodes.h"
+#include "llvm/IR/CallingConv.h"
 #include "llvm/IR/DiagnosticInfo.h"
 #include "llvm/IR/DiagnosticPrinter.h"
 #include "llvm/IR/Function.h"
@@ -964,7 +965,7 @@ static void fail(const SDLoc &DL, SelectionDAG &DAG, const char *Msg) {
 }

 // Test whether the given calling convention is supported.
-static bool callingConvSupported(CallingConv::ID CallConv) {
+static bool callingConvSupported(CallingConv::ID CallConv, const WebAssemblySubtarget *Subtarget) {
   // We currently support the language-independent target-independent
   // conventions. We don't yet have a way to annotate calls with properties like
   // "cold", and we don't have any call-clobbered registers, so these are mostly
@@ -975,7 +976,8 @@ static bool callingConvSupported(CallingConv::ID CallConv) {
          CallConv == CallingConv::PreserveAll ||
          CallConv == CallingConv::CXX_FAST_TLS ||
          CallConv == CallingConv::WASM_EmscriptenInvoke ||
-         CallConv == CallingConv::Swift;
+         CallConv == CallingConv::Swift ||
+         (Subtarget->hasTailCall() && CallConv == CallingConv::SwiftTail);
 }

 SDValue
@@ -989,7 +991,7 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI,
   auto Layout = MF.getDataLayout();

   CallingConv::ID CallConv = CLI.CallConv;
-  if (!callingConvSupported(CallConv))
+  if (!callingConvSupported(CallConv, Subtarget))
     fail(DL, DAG,
          "WebAssembly doesn't support language-specific or target-specific "
          "calling conventions yet");
@@ -1273,7 +1275,7 @@ SDValue WebAssemblyTargetLowering::LowerReturn(
     SelectionDAG &DAG) const {
   assert((Subtarget->hasMultivalue() || Outs.size() <= 1) &&
          "MVP WebAssembly can only return up to one value");
-  if (!callingConvSupported(CallConv))
+  if (!callingConvSupported(CallConv, Subtarget))
     fail(DL, DAG, "WebAssembly doesn't support non-C calling conventions");

   SmallVector<SDValue, 4> RetOps(1, Chain);
@@ -1300,7 +1302,7 @@ SDValue WebAssemblyTargetLowering::LowerFormalArguments(
     SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,
     const SmallVectorImpl<ISD::InputArg> &Ins, const SDLoc &DL,
     SelectionDAG &DAG, SmallVectorImpl<SDValue> &InVals) const {
-  if (!callingConvSupported(CallConv))
+  if (!callingConvSupported(CallConv, Subtarget))
     fail(DL, DAG, "WebAssembly doesn't support non-C calling conventions");

   MachineFunction &MF = DAG.getMachineFunction();
Swift patch
diff --git a/utils/swift_build_support/swift_build_support/products/wasmstdlib.py b/utils/swift_build_support/swift_build_support/products/wasmstdlib.py
index af138d71ae7..f34c9ea3392 100644
--- a/utils/swift_build_support/swift_build_support/products/wasmstdlib.py
+++ b/utils/swift_build_support/swift_build_support/products/wasmstdlib.py
@@ -97,6 +97,10 @@ class WasmStdlib(cmake_product.CMakeProduct):
         self.cmake_options.define('SWIFT_PATH_TO_STRING_PROCESSING_SOURCE:PATH',
                                   os.path.join(self.source_dir, '..',
                                                'swift-experimental-string-processing'))
+        self.cmake_options.define('SWIFT_STDLIB_EXTRA_SWIFT_COMPILE_FLAGS:STRING',
+                                  '-Xcc;-mtail-call')
+        self.cmake_options.define('SWIFT_STDLIB_EXTRA_C_COMPILE_FLAGS:STRING',
+                                  '-mtail-call')

         # Test configuration
         self.cmake_options.define('SWIFT_INCLUDE_TESTS:BOOL', 'TRUE')
diff --git a/utils/wasm-run.py b/utils/wasm-run.py
index 74bacafa805..1da974f0824 100755
--- a/utils/wasm-run.py
+++ b/utils/wasm-run.py
@@ -24,7 +24,7 @@ class WasmtimeRunner(object):
             subprocess.check_call(command)

     def invocation(self, args):
-        command = ["wasmkit-cli", "run"]
+        command = ["wasmtime", "run", "--wasm", "tail-call"]
         envs = collect_wasm_env()
         for key in envs:
             command.append("--env")
swift-frontend: /home/katei/ghq/work.katei.dev/swift-source/llvm-project/llvm/include/llvm/ADT/ilist_iterator.h:138: llvm::ilist_iterator::reference llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, false, false>::operator*() const [OptionsT = llvm::ilist_detail::node_options<llvm::MachineInstr, true, true, void>, IsReverse = false, IsConst = false]: Assertion `!NodePtr->isKnownSentinel()' failed.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend -frontend -c /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Actor.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncLet.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/CheckedContinuation.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Errors.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Executor.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/ExecutorAssertions.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncCompactMapSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncDropFirstSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncDropWhileSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncFilterSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncFlatMapSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncIteratorProtocol.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncMapSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncPrefixSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncPrefixWhileSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncThrowingCompactMapSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncThrowingDropWhileSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncThrowingFilterSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncThrowingFlatMapSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncThrowingMapSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncThrowingPrefixWhileSequence.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/GlobalActor.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/GlobalConcurrentExecutor.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/MainActor.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/PartialAsyncTask.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/SourceCompatibilityShims.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Task.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Task+TaskExecutor.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/TaskCancellation.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/TaskGroup.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/TaskGroup+TaskExecutor.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/DiscardingTaskGroup.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/TaskLocal.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/TaskSleep.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncStreamBuffer.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncStream.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/AsyncThrowingStream.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/_DequeBuffer.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/_DequeBufferHeader.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/_DequeSlot.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/_UnsafeWrappedBuffer.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Compatibility.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Deque+Storage.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Deque+UnsafeHandle.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Deque.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Deque+Codable.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Deque+Collection.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Deque+CustomDebugStringConvertible.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Deque+CustomReflectable.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Deque+CustomStringConvertible.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Deque+Equatable.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Deque+ExpressibleByArrayLiteral.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Deque+Extras.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Deque+Hashable.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/Deque+Testing.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Deque/UnsafeMutableBufferPointer+Utilities.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/Clock.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/ContinuousClock.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/SuspendingClock.swift /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/TaskSleepDuration.swift -supplementary-output-file-map /tmp/TemporaryDirectory.RrRsAc/supplementaryOutputs-1 -disable-objc-attr-requires-foundation-module -target wasm32-unknown-wasi -disable-objc-interop -sdk /home/katei/ghq/work.katei.dev/swift-source/build/buildbot_linux/wasi-sysroot -I /home/katei/ghq/work.katei.dev/swift-source/swift/stdlib/public/Concurrency/InternalShims -I /home/katei/ghq/work.katei.dev/swift-source/build/buildbot_linux/wasmstdlib-linux-x86_64/lib/swift/wasi -color-diagnostics -warn-implicit-overrides -enable-library-evolution -module-cache-path /home/katei/ghq/work.katei.dev/swift-source/build/buildbot_linux/wasmstdlib-linux-x86_64/module-cache -module-link-name swift_Concurrency -parse-stdlib -static -swift-version 5 -O -diagnostic-style swift -library-level api -D SWIFT_COMPACT_ABSOLUTE_FUNCTION_POINTER -D SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY -D SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING -D SWIFT_RUNTIME_OS_VERSIONING -D SWIFT_STDLIB_ENABLE_UNICODE_DATA -D SWIFT_STDLIB_ENABLE_VECTOR_TYPES -D SWIFT_STDLIB_HAS_COMMANDLINE -D SWIFT_STDLIB_HAS_STDIN -D SWIFT_STDLIB_HAS_ENVIRON -D SWIFT_STDLIB_SINGLE_THREADED_CONCURRENCY -D SWIFT_STDLIB_OVERRIDABLE_RETAIN_RELEASE -D SWIFT_THREADING_NONE -D SWIFT_ENABLE_REFLECTION -require-explicit-availability=ignore -assume-single-threaded -enforce-exclusivity=unchecked -disable-autolinking-runtime-compatibility-concurrency -disable-objc-interop -enable-ossa-modules -enable-lexical-lifetimes=false -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -prespecialize-generic-metadata -define-availability "SwiftStdlib 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999" -define-availability "SwiftStdlib 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2" -define-availability "SwiftStdlib 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0" -define-availability "SwiftStdlib 5.2:macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4" -define-availability "SwiftStdlib 5.3:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0" -define-availability "SwiftStdlib 5.4:macOS 11.3, iOS 14.5, watchOS 7.4, tvOS 14.5" -define-availability "SwiftStdlib 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0" -define-availability "SwiftStdlib 5.6:macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4" -define-availability "SwiftStdlib 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0" -define-availability "SwiftStdlib 5.8:macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4" -define-availability "SwiftStdlib 5.9:macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0" -define-availability "SwiftStdlib 5.10:macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4" -define-availability "SwiftStdlib 5.11:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999" -target-min-inlining-version min -enable-experimental-feature OptionalIsolatedParameters -resource-dir /home/katei/ghq/work.katei.dev/swift-source/build/buildbot_linux/wasmstdlib-linux-x86_64/lib/swift -Xcc -DSWIFT_STDLIB_HAS_ENVIRON -Xcc -mtail-call -module-name _Concurrency -plugin-path /home/katei/ghq/work.katei.dev/swift-source/install/usr/lib/swift/host/plugins -plugin-path /home/katei/ghq/work.katei.dev/swift-source/install/usr/local/lib/swift/host/plugins -parse-as-library -o /home/katei/ghq/work.katei.dev/swift-source/build/buildbot_linux/wasmstdlib-linux-x86_64/stdlib/public/Concurrency/WASI/wasm32/_Concurrency.o -runtime-compatibility-version none -disable-autolinking-runtime-compatibility-dynamic-replacements
1.      Swift version 5.11-dev (LLVM 35482cf965aa5ab, Swift e0fda801d757229)
2.      Compiling with the current language version
3.      Running pass 'Function Pass Manager' on module '/home/katei/ghq/work.katei.dev/swift-source/build/buildbot_linux/wasmstdlib-linux-x86_64/stdlib/public/Concurrency/WASI/wasm32/_Concurrency.o'.
4.      Running pass 'WebAssembly Instruction Selection' on function '@"$ss15ContinuousClockV3nowAB7InstantVvg"'
 #0 0x000055bee29ae567 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0x7a41567)
 #1 0x000055bee29ac29e llvm::sys::RunSignalHandlers() (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0x7a3f29e)
 #2 0x000055bee29aebef SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f4b1f1fb420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f4b1d47800b raise /build/glibc-wuryBv/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f4b1d457859 abort /build/glibc-wuryBv/glibc-2.31/stdlib/abort.c:81:7
 #6 0x00007f4b1d457729 get_sysdep_segment_value /build/glibc-wuryBv/glibc-2.31/intl/loadmsgcat.c:509:8
 #7 0x00007f4b1d457729 _nl_load_domain /build/glibc-wuryBv/glibc-2.31/intl/loadmsgcat.c:970:34
 #8 0x00007f4b1d468fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #9 0x000055bedf87d1c9 llvm::findSplitPointForStackProtector(llvm::MachineBasicBlock*, llvm::TargetInstrInfo const&) (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0x49101c9)
#10 0x000055bedec7d257 llvm::SelectionDAGISel::FinishBasicBlock() (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0x3d10257)
#11 0x000055bedec784e5 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0x3d0b4e5)
#12 0x000055bedec74ca7 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0x3d07ca7)
#13 0x000055bedf9d8c67 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0x4a6bc67)
#14 0x000055bee2626373 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0x76b9373)
#15 0x000055bee262ea71 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0x76c1a71)
#16 0x000055bee2626b54 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0x76b9b54)
#17 0x000055bedc0dc492 swift::compileAndWriteLLVM(llvm::Module*, llvm::TargetMachine*, swift::IRGenOptions const&, swift::UnifiedStatsReporter*, swift::DiagnosticEngine&, llvm::raw_pwrite_stream&, llvm::sys::SmartMutex<false>*, llvm::raw_pwrite_stream*) (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0x116f492)
#18 0x000055bedc0db635 swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef, llvm::vfs::OutputBackend&, swift::UnifiedStatsReporter*) (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0x116e635)
#19 0x000055bedbcb3110 generateCode(swift::CompilerInstance&, llvm::StringRef, llvm::Module*, llvm::GlobalVariable*) FrontendTool.cpp:0:0
#20 0x000055bedbcad942 performCompileStepsPostSILGen(swift::CompilerInstance&, std::unique_ptr<swift::SILModule, std::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) FrontendTool.cpp:0:0
#21 0x000055bedbcac7ca swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0xd3f7ca)
#22 0x000055bedbcc2d99 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) FrontendTool.cpp:0:0
#23 0x000055bedbcb01a5 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) FrontendTool.cpp:0:0
#24 0x000055bedbcae81d swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0xd4181d)
#25 0x000055bedbaa6b67 swift::mainEntry(int, char const**) (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0xb39b67)
#26 0x00007f4b1d459083 __libc_start_main /build/glibc-wuryBv/glibc-2.31/csu/../csu/libc-start.c:342:3
#27 0x000055bedbaa4e4e _start (/home/katei/ghq/work.katei.dev/swift-source/install/usr/bin/swift-frontend+0xb37e4e)

@kateinoigakukun
Copy link
Member Author

WIP branch: swiftlang/llvm-project@stable/20230725...kateinoigakukun:llvm-project:yt/wasm-swifttailcc

The main problem here is Wasm's call is split into two CALL_PARAMS and CALL_RESULTS, and SSP tries to insert check code among them

@kateinoigakukun
Copy link
Member Author

Safari TP 202 shipped tail-call support https://developer.apple.com/documentation/safari-technology-preview-release-notes/stp-release-202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

1 participant