Swift ported and running on Haiku

Hello everyone! This report covers the span of the last two weeks of my porting efforts to get swift running on Haiku. I started debugging the runtime library ‘libswiftCore’ on both Haiku and Linux and focused my attention specifically to the ImageInspection logic in order to fully understand how the runtime extracts ‘type metadata’ from a swift generated shared object. My mentor korli, recommended me to use the get_next_image_info() function, which is the Haiku equivalent of iterating through the list of loaded libraries in a executable. Hence this, it was used to implement dl_iterate_phdr() in ImageInspection.cpp, taking some inspiration from the Cygwin port but parts were rewritten to be used on ELF based platforms.

But that however, wasn’t enough to solve the MetadataCache concurrency issues. It still crashes when trying to acquire a lock on a uninitialised mutex handle when performing metadata lookup entries that need to be cached. I spent the second week debugging the swift build on Linux and tracing the concurrency issues present in the Haiku port. Afterwards, I decided to temporarily comment out the code responsible for triggering the locking issues for now, to only show a functioning proof of concept that the swift interpreter is able to directly run simple swift programs.

So, here’s a screenshot of the interpreter working in Haiku:

There’s still more work to be done for getting a usable toolchain in Haiku. The compiler still cannot generate a executable, due to the way wait4() [1] in Haiku is handled when running the compilation jobs in TaskQueue.inc [2] and the port must be tested too. Later next week, I’ll be asking my mentors for more information about the requirements for solving these particular issues #13446 [3] and #13546 [1].

  • Goals Achieved:

    • Swift can directly interpret simple programs on Haiku.
    • Added support for Image Inspection by using get_next_image_info().
    • Refactored swift recipe to include latest changes.
  • Goals For Next Week:

    • Address MetadataCache locking issues.
    • Fixup compiling swift code via issue (#13446).
    • Upstream initial Haiku platform recognition. (Swift 4.0)

References:

[1] Ticket #13546 – wait4() functionality issue

[2] TaskQueue.inc

[3] Ticket #13446 – implement posix_spawn

Hacker News责编内容来自:Hacker News (源链) | 更多关于

阅读提示:酷辣虫无法对本内容的真实性提供任何保证,请自行验证并承担相关的风险与后果!
本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 综合技术 » Swift ported and running on Haiku

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录