[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 2019 Final Report
- Haiku Activity Report: Performance Edition
- new PVS studio scan
- Coding week 4,5,6
- [GSoc 2019] Weeks #4, #5 and #6 progress report
- Haiku monthly activity report - 06/2019
- Coding week no 2 and 3
- [GSoC 2019] Weeks #1, #2 and #3 progress reports
- Haiku monthly activity report, May 2019
- Coding week #1