Eigenstate : Myrddin News - Sept 2014

Monthly?

So, you may have noticed that this used to be called Myrddin Monthly. You may have also noticed that it wasn't quite monthly. And finally, you may notice that it is now called Myrddin News.

I think the situation is self explanatory. While there's been a decent amount of progress, I am terrible about writing about it.

Highlights

Pkglocal:

You can now declare an export as 'pkglocal'. This means that it will be available to other users of the library, but will be restricted only to the library itself, and will not be exported outside of the library.

This is done by tagging symbols with the pkglocal specification as hidden when merging usefiles. An example of the syntax is below:

pkg foo =
        /* callable from anywhere */
        const bar       : (int -> int)

        /*
        callable from files that include this package
        as a local usefile, ie, 'use "foo.use"'.
        */
        pkglocal const baz      : (char -> char)
;;

FreeBSD

Thanks to help from Ayaka Koshibe, Myrddin now (mostly) has FreeBSD support. There are a few holes, like listing directories, but it passes most sanity checks, and generates valid, working code.

Libdate

Myrddin now has a simple date/time API, for parsing dates, handling timezones, and doing date conversions. Support is planned for periods, but since I haven't needed them yet, they haven't been implemented.

The documentation is available here

Float64 renaming.

In keeping with abbreviated type names, 'float64' has been renamed to 'flt64', and similarly, 'float32' is now 'flt32'.

Floating point printf

Myrddin now supports printf on flt64 values. This is done with the Dragon4 algorithm by Guy L. Steele. The performance of it isn't currently great, but performance isn't a huge priority for string formatting at the moment.

Eventually I'll look into Grisu3.

Bounds checking on indexing.

Now, if you try to access an out of bounds value for both slices and arrays, your program will crash with an out of bounds error. The program counter where the error occured is also printed.

Faster copying of small values.

I used to do a boneheaded 'rep movsb' blit in all cases. It turns out that while on recent processors, this is the fastest way to do large blits, it has a fairly high setup cost, and as a result, isn't the best way to copy small values.

Replacing this with movs to quadword registers has made the integer sorting benchmark four times faster.

Many floating point fixes.

I've added a mandelbrot renderer to the Myrddin test suite to make sure that it keeps working. Until recently, there were problems with floating point registers getting clobbered across function calls, thanks to completely missing save/restore code.

And much more.

If you want a complete list, check the commit logs.