Awelon Project Report VI

Progress in May was disappointing. I didn’t complete either of my primary goals towards improving JIT or typechecking for ABC. My efforts were based around compiling ABC code into an intermediate box-and-wire ‘graph’ that hides the dataflow operators and supports a variety of useful optimizations. However, it seems I aimed to accomplish too much in a single pass: an ad-hoc mix of partial evaluation, inlining, and graph writing. Cumulative complexity dragged me down. 😦

I’ll be making a similar attempt this month, albeit in smaller steps. Partial evaluation, inlining, and similar will occur in separate passes. I’ll probably need a few more intermediate graph types, though implementing a lot of different types can be painful in its own way. Fortunately, this compilation to graph should contribute to my other primary goals for typechecking and reactive implementations…

On a more positive note, my secondary efforts in May were not unfruitful:

  • asynchronous computations: I implemented, tuned, and tested an `{&asynch}` annotation that marks a block for asynchronous computation (`(a→b)→(a→b)`). Under the hood, this uses unsafeInterleaveIO and an MVar, such that clients wait on the `b` value only when they attempt to observe it. There is also a finite pool of worker threads, to avoid starting more computations than we can easily handle. Each action is required to terminate, and we’ll wait for all asynchronous operations to complete at implicit points in the input stream (e.g. between ‘paragraphs’ in a command stream, or between commands in the REPL). Errors from asynchronous operations are accumulated and reported together.
  • asynchronous filesystem ops: all commands to observe or influence the filesystem are now asynchronous, albeit serialized for each filename
  • test.jit added a utility to the `ao` command line to run the test suite via JIT. This currently takes an absurdly long time: over 4 minutes when first compiling the code, then 1.2s using the cached compilations. Compare to 0.18s to run the test suite via interpreter (of which 0.1s is just loading the dictionary).
  • abc.ann added utilities to the `ao` command line for annotated ABC, i.e. including location information from source. This could potentially help with a debugger.
  • equality assertion as annotation: in April, I modified the `>` operator to be monomorphic, operating only on numbers. However, this broke many tests. I developed a new annotation `{&≡}` (that’s U+2261) that is useful for the common case of asserting equivalence. This not only simplifies testing; it should also be useful when (for example) composing maps with user-defined key comparison functions; one can assert the key comparison functions are equivalent without actually observing the equivalence. Only structural equivalence is guaranteed to pass; I don’t require decidable observational equivalence.
  • design thoughts on security for open systems: I’ve been brainstorming a bit about homomorphic encryption and encrypted computations in open distributed systems, and how I might represent this in ABC (mostly via tokens and simple conventions). This doesn’t have any immediate application, but could become a very useful idiom.

I also learned that about 0.6s overhead for loading JIT programs is one-time only (on the first load), and the load cost is only a few milliseconds thereafter. This is much less a problem than I was imagining in April, when most of my tests involved a single {&compile} operation. The more significant cost now regards compilation itself, and I’ll eventually need to generate code that is easy for GHC to parse and compile (and ideally reuse).

This entry was posted in Language Design and tagged , , . Bookmark the permalink.

2 Responses to Awelon Project Report VI

  1. 1234qwerasdfzxcvNeo says:

    Security for open system is also something ethereum is working on. They talk a bit about it in this talk about creating distributed apps on the ethereum platform

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s