Better watch out! D runs on watchOS!

Dan Olson via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Dec 30 13:56:46 PST 2015


Dan Olson <gorox at 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.
-- 
Dan



More information about the Digitalmars-d-announce mailing list