On Wednesday, 30 December 2015 at 21:56:46 UTC, Dan Olson wrote:
Dan Olson <go...@comcast.net> writes:

A little progress report. More to come later when I get something pushed to github.

I bought a returned Apple Watch yesterday at discount for $223.99 US and tried to see how much of D would work on it using my iOS fork of LDC. There were a few bumps, like dealing with embedded bitcode (a watchOS requirement). After 4-hours of baby steps, little D programs with incremental druntime support, I was able to download a huge watch app extension with all druntime and phobos unittests and run most of them alphabetically. Everything zipped along fine, only a std.math error, then mysteriously a exit after running std.parallelism test a long time. It was late for me so decided that was enough progress.

This means all of druntime worked and probably most of phobos.

Played with this a little more and learned a bit about watchOS memory. A little test that allocated memory in 5 MB chucks was terminated at 30 MB data RAM. The combined unittests in phobos suck up much more than that, std.uri itself uses over 50 MB. By tailoring memory usage and running phobos unittests in smaller block, they all work. The std.math failure was my own coding error missing a version block for WatchOS.

In end, good news: druntime and phobos fully work on watchOS with LLVM optimizations disabled. With optimzations on, there are alignment problems. For example, compact unwind data generated by LLVM isn't aligned but some of our eh unwinding code casts these to uint. Not so good when the optimizer selects instructions requiring special alignment. I'll track these down gradually.

That sounds like this issue I ran into with ARM EH:

https://github.com/ldc-developers/ldc/issues/489#issuecomment-143560075

I was able to work around it by disabling the mentioned llvm optimization pass:

https://gist.github.com/joakim-noah/1fb23fba1ba5b7e87e1a#file-android_tls-L42

https://gist.github.com/joakim-noah/63693ead3aa62216e1d9#file-ldc_android_arm-L3133

Reply via email to