Thursday, December 10, 2009

partcl-nqp


pmichaud and I and a few others are trying out the latest parrot compiler tools to see if we can create up with a version of partcl that is more maintainable, and will benefit more directly from toolchain improvements that target rakudo (Perl 6 on parrot) and other languages.

The base tool for this is NQP-rx; it's a small compiler for a subset of Perl 6 that targets PIR; It provides a much improved syntax over PIR, even when calling PIR itself - it provides a lot more sugar.

This means that nearly all of the handrolled PIR that was created is no longer needed. There are few cases where it is, and that is pushing development of NPQ-rx so that we can eliminate that PIR and rewrite it NQP.

Currently, there are currently two NQP-rx grammars, one for the language itself, and one for the tcl-specific regular expression language (ARE).

While the ARE is a work in progress (bits are added as needed to pass tests), adding this at all would have been very painful in old partcl (which currently relies on the perl5-like expression engine available via PGE in parrot.) We'll be adding more grammars for globbing, and probably the [format] and [binary] mini-languages as well.

The builtins (that are done) are now all written in NQP - and not having to write them in assembly (even macro'd assembly) makes them much shorter, easier to understand and maintain.

Big Goals:
  1. pass all the tcl based tests written for partcl (Already running 12 of the original all-tcl tests)
  2. start running the spec tests again.
  3. pass almost as many spec tests as partcl...
At which point this new version will become the primary version.

If you're interested in Tcl, parrot, or Perl 6, check us out. There are plenty of small bits of NQP that can be written, and I'd be happy for the help. If you know Tcl but not Perl 6, or Perl 6, but not Tcl, doesn't matter, you can contribute. ^_^


Saturday, October 24, 2009

partcl now passing 4,089 spec tests

With the cleanup of several segfaults in parrot and some recent improvements to ::tcl::mathop, partcl is now passing over 4K of the official 8.5.6 test suite!

That leaves expr.test as the last big source of potentially passing tests that aren't being counted; 347 tests in that file pass before an error due to promotion to bigints causes the file to abort.

Special thanks to moritz for providing CPU cycles for testing.

svn2git

I've moved the repository from svn hosted at googlecode to git at github.

Thanks to dukeleto at parrot.org for doing the heavy lifting on the repository migration.

For now, everything else is staying at googlecode, and I have a pointer on the main page to the github repo.

I had been using git-svn for a while to interact with the old svn repo, and while I really loved the git-like features it provided, there were enough annoyances with git-svn that making the full switch makes development easier for me.

Also, it might encourage Matt to commit some fixes. =-)

Tuesday, September 1, 2009

Now passing 3,363 tcl spec tests

Immediately after parrot 1.5.0 was released, many branches were merged back into trunk, which temporarily disrupted our ability to run the spec test suite.

Thanks to NotFound++ on the parrot team, all of these new failures have been resolved, and we're now able to run the spec test suite again!

Since the speed of partcl has improved a little since we started tracking spec test results, and to give future segfaults more of an opportunity to present themselves, we're now running every file in the test suite that runs to completion (even if they're all skipped).

With various advancements, and a lack of (random) segfaults, we're now running more test files and passing more tests than ever:

Previous High: Files 67 Total 5145 Passed 2972 Skipped 1352 Failed 821 Time: 4374s
Current: Files 93 Total 7397 Passed 3363 Skipped 1989 Failed 2045 Time: 6651s

There are still a few segfaults (but these are repeatable) and out of memory errors remaining, and they're on files with a relatively large set of already passing tests; getting those to run to completion will give us another big bump on the numbers.

Saturday, June 27, 2009

Improved interactive mode

In real tcl, you can use interactive mode to run commands like a shell; There's now just enough logic in partcl to do this as well.

Most of the infrastructure for this was already in place; just added a minimal version of
  • [file executable] - only checks executable status for other, not group or owner.
  • [file split] - isn't windows-friendly, nor does it deal with potentially confusing chars like '~'
  • [exec] - ignores all of the shell metachars and just invokes parrot's spawnw opcode as is.

$ ~/bird/bin/parrot tcl.pbc
% ls src
binary.c binary.h binary.o class grammar macros.pir mathops.pir ops pmc returncodes.pasm tclsh.pir

% rm src/binary.o

% ls src
binary.c binary.h class grammar macros.pir mathops.pir ops pmc returncodes.pasm tclsh.pir


Most of the heavy lifting is done by init.tcl from the standard library.

Friday, June 12, 2009

Partcl now passing 2,972 tcl spec tests

Thanks to prompting from kbk on irc (#tcl at freenode), I finally fixed the parsing of string.test.

It had been complaining about the \udead escape in that file; That isn't really a valid codepoint, and while Tcl accepts it as if it were, parrot (which uses ICU internally) throws an exception when trying to create a string that contains it. So, (at kbk's suggestion), I settled for now to convert any codepoints in the \udead range to \ufffd. That allowed the test to parse...

... but it then ran out of memory, as several other tests have been doing since I started running the tests again.

I've been working with chromatic to try to provide test cases to show where the memory leaks have been coming from, but I've only been going after things I could spot with valgrind. Today, someone on irc (#parrot at irc.parrot.org) posted a very small sample program that eventually ran out of memory... because the garbage collector apparently wasn't.

The small PIR example allowed chromatic to identify and fix that issue in parrot, and partcl has now reclaimed several files which had been exhausting a 1/2 gig of memory.

Current results, over 67 test files that run to completion:

Total 5145 Passed 2972 Skipped 1352 Failed 821

That's the highest number of attempted & passing tests since I started keeping track. It's an additional 1181 passing since the 8th, when I started running the spec tests again.

Monday, June 8, 2009

SpecTest updates

It's been about 4 and a half months since the last "official" spec test run -- partcl was offline for most of that time.

I've finally caught back up with parrot development, can build against svn-latest, an installed parrot, have added a few minor features.

We've lost several files (See http://code.google.com/p/partcl/wiki/SpecTestStatus). I'm running the tests on a machine with a 0.5G ram limit - previously these were running on a machine with no virtual memory limit, so they'd be able to complete. I've opened a ticket with the parrot developers for the biggest parrot memory leak I was able to find with a "hello word" in partcl (See https://trac.parrot.org/parrot/ticket/732). Hopefully they can get that and some other leaks closed.

So, since a lot has changed (including the hardware) between those last two runs, there's not much to compare directly. I'll try to get more, regular updates going forward.

Edit: Actual Spectest results

Monday, June 1, 2009

NaN support

Now that partcl is passing all tests again, took some time over the weekend to add NaN support.

NaN now parses in expressions, and is represented in bytecode as a TclFloat PMC with a value of NaN; most of the operators and functions now [error] appropriately when presented with NaN as an argument; all the partcl tests for NaN are un-skipped and passing.

Thursday, May 28, 2009

Working again after parrot 1.0

Partcl once again builds against parrot (tested against r39220), and passes everything in 'make test'!

While there haven't been any functional changes since the last post, we are now building against an installed parrot; that involved quite a few changes to partcl's build process.

There have also been some incompatible parrot changes since last we built; we're now tracking all of those changes.

Once parrot 1.3 is released, we can switch to just building against an installed monthly release of parrot!

Thanks to allison, Infinoid, NotFound, pmichaud, and cotto from #parrot for their fixes to both partcl and parrot to get us afloat again.

Thursday, March 12, 2009

Distracted, but still here.

I've been working with the core parrot team trying to get as much in order as possible for the upcoming 1.0 release.

Once that release is out the door, I'll come back and make sure that we have a version of partcl that runs against parrot 1.0.

-Coke

Monday, January 26, 2009

partcl progress, January 2009

Keeping up with parrot

Lots of commits this month to keep up with changes in parrot trunk; a recent push in that project to finally remove some items marked as deprecated forced me to finally update our code. This should make things go more smoothly once parrot declares a 1.0 release.

There is one regression in our core tests at the moment due to a recent change in how parrot handles attributes on PMCs. (C-level data structures resembling objects). 

[Trace]? Not yet

I added a basic version of trace that allowed us to parse several specification tests that we previously were unable to; However, the simple version of [trace] involved invoking the tcl compiler with an [uplevel] command (which in turn, invokes the tcl compiler...) on every read access of a traced array; this resulted in about a 4x slowdown in the test suite, so I had to back it out. As we see speedups in other areas, it should be possible to re-enable this.

Run init.tcl

Grabbed a copy of init.tcl from the tcl repository (updating to target 8.5.6 while I was at it.). We are now running this on interpreter startup, and getting a few things for free that we had to roll our own for in the past. The biggest remaining thing is to get [unknown] dispatch working to use the unknown defined here. [auto_load] and friends are now working; unknown support is the last stop to getting several builtins written in tcl automatically loadable.

[array startsearch]

Parrot has had iterators for quite some time, and I finally got around to making them accessible to tcl. The implementation for here involved converting the C-based TclArray data structure (which was a simple extension of a parrot Hash) into a PIR-based version. The PIR based code makes it much easier to add per-instance attributes, include information to track open iterators. 

The only remaining bit to fix is how we reuse the named iterators: start 2 searches; kill the last one; start a new search - the name for that in partcl is off by one from the expected name in Tcl.

Convert TclList?

The relative ease of converting TclArray (combined with a suspicion that this would speed up partcl), led me to try to convert the C code for managing lists to PIR as well. The resulting code is much cleaner (PIR doing a lot of the lifting for us).

However, the conversion didn't go smoothly. PIR subclasses of C-based PMCs are not fully equivalent; I never did get all tests passing after the conversion even with some workarounds in place, and one of the tests that did pass did not run appreciably faster. So that work in progress was discarded.

I was somewhat disappointed to find that there were issues with the PIR subclasses, but was sure to report them back to the parrot project as issues to be tracked.

Note to self: Seriously, stop trying to make things go faster if you don't have a profiler. It's not going to be worth it.

Fix stringification of (some) lists

The Tcl spec test "list.test" was aborting before printing out the results, meaning we couldn't count several passing tests. Tracked this down to two edge cases of stringification of lists elements that we got wrong. There are more, but these two prevented successful execution of the tests. Added them to partcl's core tests to avoid regressions; that's another 64 passing spec tests that we can now count.

$ ./tclsh
% list "{ab}xy" "{ab}\\"
{{ab}xy} \{ab\}\\


Review Tests

Went through the list of skipped tests and found a few that were able to be re-instated. As always, our spec test progress is visible, along with current stats on various .test files. Since last month's posting, we're passing another few hundred tests.