More bugs and bad style comments...
1) Don't forget to add a "var" declaration at top-level when defining a global variable. So instead of:
PLATFORM_PTR_SIZE = 4; ArithInstr = function () ...
write
var PLATFORM_PTR_SIZE = 4; var ArithInstr = function () ...
2) Don't use "delete" gratuitously. In ir/instructions.js some properties were deleted that were added just a few lines before.
3) The PLATFORM_PTR_SIZE global variable is a bad idea. Once we have Tachyon running on a 32 bit machine, how will we bootstrap on a 64 bit machine? We can't assign 8 to PLATFORM_PTR_SIZE because that will break the VM itself. It must be possible to generate 64 bit code on 32 bit x86, just like it should be possible to generate ARM code on x86. The compiler should be parameterized by a "target" object indicating the specifics of the target processor.
Marc
On 2010-12-14, at 1:58 PM, Marc Feeley wrote:
I have started to bootstrap Tachyon with js2scm to find which library functions are required. In the process I have had to resolve a few issues with the Tachyon sources.
In particular the js2scm compiler does not support LabelledStatements yet (i.e. <label> : <statement>) and this is used in a few places to control loop exit. I have rewritten such uses when it was easy, but there remains one use in ir/optpatterns.js that I don't dare modify because the control flow and invariants are not obvious. Maxime: could you take a look and rewrite it without "continue <label>;" statements?
I've also discovered that the following global variables are referenced but they are not used anywhere. Please fix this!
newdest reg rhsValAssg signExtend u2 upperAddr
Also, I have encountered this style of code:
if (Error.captureStackTrace)
to test for the existence of a particular feature (V8 specific?). Please use this instead:
if (Error.captureStackTrace !== undefined)
which will make implementing "if" easier. In other words, make sure the test of an if yields a boolean.
Marc