Bluish Coder

Programming Languages, Martials Arts and Computers. The Weblog of Chris Double.


Why the Scheme->Javascript JIT doesn't work on Firefox

After doing some digging I've found a bug in the Scheme-in-Javascript implementation that seems to be the reason the JIT doesn't work on Firefox.

The system uses Javascript objects as associate arrays (hashtables), mapping symbols names to definitions. For example:

TopEnv['eval'] = function(list) { return doEval(; }

There is a problem with using Javascript objects for this type of thing and that is that "TopEnv['eval']" is really syntactic sugar for 'TopEnv.eval' in Javascript. In firefox this actually returns the 'eval' standard function. You can see this by evaluating the following in a Javascript shell in Firefox:

var x = new Object()
 => function eval() { [native code] }

In Internet Explorer this returns nothing. The JIT process does a lookup on 'eval' at some point and on Firefox it returns the native 'eval' function which breaks the JIT process. On IO it returns the Scheme 'eval' function.

The fix is relatively easy but finding all uses of this type of lookup in the code is time consuming. But JIT will work once I've done this.


This site is accessable over tor as hidden service mh7mkfvezts5j6yu.onion, or Freenet using key: