Bluish Coder

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


2006-05-07

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(list.car); }

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()
x["eval"]
 => 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.

Tags


This site is accessable over tor as hidden service 6vp5u25g4izec5c37wv52skvecikld6kysvsivnl6sdg6q7wy25lixad.onion, or Freenet using key:
USK@1ORdIvjL2H1bZblJcP8hu2LjjKtVB-rVzp8mLty~5N4,8hL85otZBbq0geDsSKkBK4sKESL2SrNVecFZz9NxGVQ,AQACAAE/bluishcoder/-61/


Tags

Archives
Links