[GSoC 2017] Porting Swift to Haiku - Week #4 #5
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()  in Haiku is handled when running the compilation jobs in TaskQueue.inc  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  and #13546 .
- 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)
- [GSoC 2018 - TrackGit] Progress Report 11
- [GSoC 2018: SDHCI MMC Driver]: Third Phase Outline
- [GSoC 2018: SDHCI MMC Driver]: Week #8
- [GSoC 2018 - TrackGit] Progress Report 10
- LibreOffice for Haiku, a not-so-short story
- The State of Rust on Haiku - July 2018
- [GSoC 2018: SDHCI MMC Driver]: Week #7
- [GSoC 2018: XFS support] Week #7 and #8
- Haiku monthly activity report - 06/2018
- [GSoC 2018 - TrackGit] Progress Report 9