Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

autrijus (1505)

  (email not shown publicly)

Journal of autrijus (1505)

Thursday April 28, 2005
02:25 PM

Day 87: STM: Atomic power!

[ #24431 ]
At nothingmuch's request, I changed all IORef and HashTable in Pugs to use TVar, a STM-powered, concurrency-safe, deadlock-free storage. For people who were not following along, here is a presentation and paper about STM as used in GHC.

This means that all our variable access are automatically atomic -- i.e. there can never be corrupted pads when pads are shared among multiple async blocks. By nothingmuch and my benchmarking, there is no visible performance loss.

In other news, I eliminated the troublesome mutual module recursion, to pave a way for a new EvalT monad transformer that can expose atomic {} to Perl 6 level. The idea is that this should work:

    my ($x, $y) = (1, 2);
    async { atomic { $x = $y * 10; $y = $x * 10 } };
    async { atomic { $x = $y * 10; $y = $x * 10 } };
    async { atomic { $x = $y * 10; $y = $x * 10 } };
    atomic { $x = $y * 10; $y = $x * 10 };
    say "$x, $y"; # always "20000000, 200000000"

But this should throw a catchable exception:

    # die "Can't perform IO inside atomic {} block"
    atomic { say "Hello, World!" };

I'm having some problems in modeling the neccessary MonadCont continuation semantic, so atomic is not exposed right now. However, as a happy side effect, the elimination of mutual recursion has improved performance by another 15% or so. Yay for a fast Pugs!

There are many other notable changes today as well:

  • Stevan committed a working Pod::Stream::Parser to ext/, in preparation for Pugs to be self-documenting.
  • Speaking about documentation, theorbtwo started investigating adding Haddock annotations to Pugs. I have used Haddock for my first Haskell project, OpenAFP, and it is indeed very pretty and useful.
  • For OpenAFP, I added a VOpaque value type, to encapsuate any other types into an opaque reference. The upshot is that we should be able to manipulate arbitary Haskell types (and by extension, C types) as Pugs objects soon.
  • nothingmuch fixed eval_is and eval_ok, then proceeds to implement .wrap. Juerd, I and nothingmuch all agreed that the current semantics in S06 (based on Hook::LexWrap) is very awkward, and conflicts with how .assuming behaves; we worked out a much more perlish semantics, and nothingmuch proceeded to implement it.
  • machack666 is working on supporting block closure traits like FIRST; his work may also provide a more generic trait system for other structures to use.
  • andras checked in Memory Game v0.2, this time with tooltips on each boxes and a turns counter.
  • iblech continues to update loose ends everywhere, including the mandelbrot tests, BEGIN {...} block tests, and more.
  • bsb, nothingmuch and I moved readline probing to Makefile.PL, so the interactive shell should be usable for people who needs the -package readline flag.
  • bsb tested and fixed pick's behaviour on one junctions: one(1).pick should return 1, but one(1,1).pick should be undef.
  • gaal made the YAML harness sort its input, so our tests are always run in the same order, regardless of the underlying filesystem. rootmj also committed a small message fix in
  • Stevan and Limbic_Region added some last/next tests.
  • revdiablo, our new committer, added various tests on recursive function calls and subroutine references.
  • mugwump added tests for a function returning its inner function, ensuring that the inner pad is being preserved.

See you tomorrow!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.