vx-scheme

A Scheme interpreter for VxWorks.

[ Home ]

Release History

Announcing the fifth public release, 0.7. The long-awaited (by me, anyway) bytecode compiler is here, with some cool featurs described on the compiler page. The compiler is written in Scheme and bootstraps itself using the interpreter. By the way, the 0.7 interpreter is faster too, as you can see on the benchmark page. Other enhancements:
  • 14% faster interpreter and 47% faster compiler: The interpreter got faster due to just general tuning. The compiler helps a great deal for computationally-bound programs.
  • New functions: By analogy with Common LISP, bound?, nconc and symbol-value. For utility purposes, getcwd, chdir, display* (which displays each of its arguments in turn, and primitive-procedure? (for recognizing procedures produced by compilation).
  • Hosted by Google! I was maintaining the project with CVS, but decided to try my current employer's new ne facility, based on Subversion. Click for the vx-scheme project page. You can get my current working source from the trunk or work with version 0.7, which as been tagged as v0.7.
  • Compatibility? I can't really say that this version runs with VxWorks since I haven't tried it. Wind River, my former employer, used to have a Tornado Prototyper you could download to experiment with things like this, but they haven't done that in a while. Likewise, I don't have any Win32 machines in the house any more, having switched to Mac. The code does run fine on Mac OS X, Fedora, and Ubuntu.
Consult the change log for more information.

Announcing the fourth public release, 0.6. Improvements from 0.5 involve some performance enhancements achieved by tweaking the VM.
  • 39% faster: This release was motivated by noticing that the test suite was spending most of its time collecting garbage. Obviously, reducing garbage generation and simplifying garbage collection would improve performance, and that was done in this release, with the following two (internal) changes:
  • Win32 port: Project files are provided so vx-scheme can compile ith Visual Studio .NET.
  • Short Integers: Internally, an integer that can fit in 24 bits is now stored as a special kind of pointer with no cell space allocated. This means that computations with small integers can proceed with much less garbage generated. (Many classic LISP systems use this trick.) The short arithmetic automatically expands to 32 bits when necessary, preserving the full range of 32-bit arithmetic with no programmer intervention needed. Still no arbitrary-precision arithmetic, though.
  • Uniform cell-size: Versions before this one had the concept of single- and double-size cells. While this saved a small amount of memory, it greatly complicated the garbage collector.
Consult the change log for more information.

Changes from 0.4 to 0.5:
  • Property lists: You can now say (put 'symbol 'key value) to make a property association "key->value" on the given symbol, and (get 'symbol 'key) to retrieve the value. (NB: getting a property that doesn't exist will return #f, rather than () as in Common Lisp.)
  • Perl-style vector operations: New functions vector-shift!, vector-unshift!, vector-push!, and vector-pop! are provided. Shift and unshift work at the left side of a vector, push and pop at the right. Vectors will grow and shrink as needed.
  • More testcases:Three new testcases, adding 500 more lines to the suite.

I've started writing a bytecode compiler, which has been an interesting exercise. If that interests you drop me a note!

Download

The easy-to-build source distribution is available here: Previous versions can be downloaded as well, but I don't recommend them. Newer releases always pass a stronger test suite than older ones. The previous releases are 0.6 [tgz, zip], 0.5 [tgz, zip], 0.4 [tgz, zip], and 0.3 (the first release) [tgz, zip].

You can contact me at colin.smith@gmail.com with any questions or observations. For all I know, I'm the only person out there who's interested in Scheme and VxWorks simultaneously. If you are too, drop me a note!

Documentation

See the main page.

A word about the coding convention

This code uses the VxWorks coding convention, used extensively at Wind River. The brace indenting is a bit unorthodox. At Wind, the party line was always "they're nobody's favorite indenting rules, but we all use them, and therein lies the value." True enough. Now that I've left WR to work at Google, I've been tempted to reformat the code in a more mainstream style, though. Maybe next version.

Installation Notes

For VxWorks:

Just unpack the archive anywhere you like. A Tornado workspace containing two projects is provided in tornado/vx-scheme.wsp. The first project, "target-shell", will build a VxSim executable that has enough C++ features selected to host the Scheme interpreter. The second is the interpreter itself. Build them both.

Note: For the present, vx-scheme only runs on the target shell: starting it from windsh will only confuse things.

Start the simulator you just built. Once it's launched you can use a script in ../startup that will load the Scheme image. (The startup script is in the parent directory of the directory where the sim starts in case you define new builds on your own.)

-> <../startup
cd "../../vx-scheme/SIMNTgnu"
value = 0 = 0x0
ld < vx-scheme.out
value = 30727944 = 0x1d4df08 = _dtors + 0x14
cd "../../../testcases"
value = 0 = 0x0
->

For UNIX:

For UNIX-like systems (FreeBSD, Cygwin, etc.) there's an ordinary Makefile in the src directory of the distribution. Just say make or gmake (whatever it takes to launch GNU make on your system) in that directory. This will build a "vx-scheme" executable configured for use on your host system.

Test Suite

For VxWorks:

To run the test suite on VxWorks, follow the installation steps above and then, in your simulator window, do

-> scheme
=> 

The prompt changes to => when reading Scheme expressions. The startup script set the working directory to the place where the test suite lies so now we need only say:

=> (load "vx-test.scm")
PASS: sort
PASS: factor
PASS: object->string
PASS: r4rstest
PASS: pi
PASS: sieve
PASS: cf
PASS: series
PASS: ack
PASS: scheme
PASS: dynamic
PASS: earley
PASS: maze
PASS: dderiv
PASS: boyer
PASS: puzzle

Note: Running the test suite defines a lot of symbols. In particular, "i" is defined, which masks the VxWorks definition. It's probably best to ^X the simulator and start over after running the suite.

For UNIX:

To run the test suite for UNIX: after building with make (or gmake) in the unix directory, just do a "make test".

Note: The "good" files are slightly different for VxWorks: in that case, expected to fail the "mult-float-print-test" on VxWorks and the "good" file contains these failures, so the suite will "pass". But as explained elsewhere we just take what the native I/O system gives us.

Roadmap

Now that the bytecode compiler (whose design is indebted to that given by Peter Norvig in Paradigms of Artificial Intelligence Programming) is complete, I don't have any big plans. Feel free to write if you're thinking of using this code for anything at all!

Copyright © 2002 Colin Smith.