On 2010-12-14, at 3:37 PM, chevalma@iro.umontreal.ca 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.
I thought your goal was to use the parser to find the missing library functions we need to implement. Are you telling us that your goal is to fully compile Tachyon to scheme?
Just enough to run Tachyon and generate some code (no run-time execution of the generated code). This is to find all the runtime functions and features that are used by Tachyon. The code has to be run because JavaScript is a dynamic language (i.e. you can't tell statically what is required, so just parsing Tachyon is not enough).
Not to be grumpy, but I wish that time was spent elsewhere. The parser still isn't fully fixed, as far as I know. There was a long list of fixes you had me e-mail you twice (or was it 3 times?) a little while ago.
The parser is not on the critical path to the bootstrap of Tachyon.
Also, the modifications you've made in the assembler seem to be causing "make run" to segfault on my machine.
I introduced a bug for a few minutes but it should be gone now.
What are those "redundant x86 instructions" you removed?
cmove is just another name for cmovz, so there is no reason to have both (it just bloats the compiler for no good reason). There are other redundant conditional move instructions.
I've also discovered that the following global variables are referenced but they are not used anywhere. Please fix this!
I fixed the ones I was able to locate.
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.
Seriously?
Let me be clear... from now on if I'm being sarcastic in my email I will add a smiley at the end of the sentence.
I really don't appreciate your derogatory tone. So please try to keep things civil.
This should be trivial to implement in any interpreter.
It is not easy when the target language does not have "goto". Remember that at the start of the project we agreed to not use advanced features of JavaScript so that the bootstrap process would be simplified. Labelled statements are neither required, nor particularly good style (I rewrote the current uses of it except for one, with no loss of readability, in fact I would say the code is easier to understand now).
It's also used in lots of places in our code, and it's convenient.
The compiler should not rely on this misfeature of JavaScript. In JavaScript, several objects count as false:
false, 0, null, undefined, ""
so the implementation of
if (x) ...
must in general test if x is one of the false values. It is sufficiently complex that you don't want to generate the tests inline, so an out-of-line function must be called, which is slow. On the other hand, the test
if (x !== undefined) ...
only has to check for a single value. Less machine code is required, the performance is better, and the intent of the programmer is clear (and thus the code is easier to maintain and debug).
Marc