<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">On 6 Sep 2017, at 11:29, blaster_in_black via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi, Alex, and thank you so much for such a throroughly reply!<br class=""></div><div class=""><br class=""></div><div class="">Abusing your good will, let me ask you yet another question. I understand, as you've pointed out, that certain parts of functionality shall always be implemented in low-level language with direct access to syscalls, such as C/C++. Are you able to suggest me a way to find all, or at least most of those parts? I'd like to estimate what they represent - what they build and provide on top of syscalls and libc.<br class=""></div></div></blockquote><br class=""></div><div>Well, one way would be to clone the <a href="https://github.com/apple/swift/" class="">https://github.com/apple/swift/</a> repository and then find out any files which end in .c or .cpp :)</div><div><br class=""></div><div>The problem is that there's a lot of stuff there, which means it's difficult to answer your question directly. In addition, Swift builds upon other libraries - for example, using ICU to perform the Unicode boundaries - and it's not clear where you want to draw the line.</div><div><br class=""></div><div>Most of the Swift infrastructure is built upon LLVM - in fact, the Swift REPL is really just an extra set of runtime functions on top of the existing LLVM/LLDB type repls (you can switch into LLDB using : in a Swift interpreter, and back to Swift with repl). LLDB in turn has Python embedded within which you can run with 'script':</div><div><br class=""></div><div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">$ swift</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Welcome to Apple Swift version 4.0-dev (LLVM f53eb03c15, Clang 1757394ff0, Swift 75b7e05e20). Type :help for assistance.</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(169, 169, 169); background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 1> </span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">:</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(169, 169, 169); background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">(lldb) </span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">script</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">>>> print("Hello from Python in LLDB in Swift")</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Hello from Python in LLDB in Swift</span></div><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">>>> </span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></div><div class="">I'm not sure what kind of 'syscalls' and 'libc' you are looking for, but you can use various tracing programs (e.g. strace, dtrace) to find out where they are being called directly, or you could run it under lldb and set various breakpoints to do the same.</div><div class=""><br class=""></div><div class="">Finally, the resulting executable generated by a Swift compiler consists of a number of parts; information generated by the compiler and optimiser phases, calls out to external libraries (like libc or libicu), as well as calls to runtime functionality used by the Swift runtime, such as memory allocation and reference counting. There isn't a clear delineation of where those come from, so unless you want to get a little bit more specific about what you're hoping to find, you're probably best just spelunking through the codebase.</div><div class=""><br class=""></div><div class="">Alex</div></body></html>