After applying a few workarounds to advance in the bootstrap, I discovered that Tachyon is not compiling pass 4 of parser/ast-passes.js correctly. Specifically the part that handles the ForVarStatement had to be rewritten like this, otherwise the variable accum would be equal to undefined instead of null:
else if (ast instanceof ForVarStatement) { var accum; // CHANGED, used to be: var accum = null; accum = undefined; // CHANGED for (var i=ast.decls.length-1; i>=0; i--) { var decl = ast.decls[i]; this.add_variable(decl.id, false); if (decl.initializer !== null) { decl.initializer = this.walk_expr(decl.initializer); var init = new OpExpr(decl.loc, op2_table[EQUAL_CAT], [new Ref(decl.id.loc, decl.id), decl.initializer]); if (accum === undefined) // CHANGED accum = init; else accum = new OpExpr(decl.loc, op2_table[COMMA_CAT], [init, (accum===undefined)?null:accum]); // CHANGED } } ast.expr2 = this.walk_expr(ast.expr2); ast.expr3 = this.walk_expr(ast.expr3); ast.statement = this.walk_statement(ast.statement); return new ForStatement(ast.loc, (accum===undefined)?null:accum, // CHANGED ast.expr2, ast.expr3, ast.statement); }
Someone with a better understanding of the compiler should debug this.
Marc
Afficher les réponses par date
I tried to write similar code to replicate the issue but things worked fine in both 32 and 64 bits. I remember that Erick fixed issues with the code generation on 64 bits recently, more specifically, issues with comparisons. Do you have the latest Tachyon?
- Maxime
After applying a few workarounds to advance in the bootstrap, I discovered that Tachyon is not compiling pass 4 of parser/ast-passes.js correctly. Specifically the part that handles the ForVarStatement had to be rewritten like this, otherwise the variable accum would be equal to undefined instead of null:
else if (ast instanceof ForVarStatement) { var accum; // CHANGED, used to be: var accum = null; accum = undefined; // CHANGED for (var i=ast.decls.length-1; i>=0; i--) { var decl = ast.decls[i]; this.add_variable(decl.id, false); if (decl.initializer !== null) { decl.initializer = this.walk_expr(decl.initializer); var init = new OpExpr(decl.loc, op2_table[EQUAL_CAT], [new Ref(decl.id.loc, decl.id), decl.initializer]); if (accum === undefined) // CHANGED accum = init; else accum = new OpExpr(decl.loc, op2_table[COMMA_CAT], [init,
(accum===undefined)?null:accum]); // CHANGED } } ast.expr2 = this.walk_expr(ast.expr2); ast.expr3 = this.walk_expr(ast.expr3); ast.statement = this.walk_statement(ast.statement); return new ForStatement(ast.loc, (accum===undefined)?null:accum, // CHANGED ast.expr2, ast.expr3, ast.statement); }
Someone with a better understanding of the compiler should debug this.
Marc
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
On 2011-03-16, at 1:11 PM, chevalma@iro.umontreal.ca wrote:
I tried to write similar code to replicate the issue but things worked fine in both 32 and 64 bits. I remember that Erick fixed issues with the code generation on 64 bits recently, more specifically, issues with comparisons. Do you have the latest Tachyon?
Yes. That's the one that is giving me the problem.
Marc
I found that there was indeed a bug with closure variable initialization. This bug is now fixed. This will hopefully solve the problem you found in ast-passes.
- Maxime
After applying a few workarounds to advance in the bootstrap, I discovered that Tachyon is not compiling pass 4 of parser/ast-passes.js correctly. Specifically the part that handles the ForVarStatement had to be rewritten like this, otherwise the variable accum would be equal to undefined instead of null:
else if (ast instanceof ForVarStatement) { var accum; // CHANGED, used to be: var accum = null; accum = undefined; // CHANGED for (var i=ast.decls.length-1; i>=0; i--) { var decl = ast.decls[i]; this.add_variable(decl.id, false); if (decl.initializer !== null) { decl.initializer = this.walk_expr(decl.initializer); var init = new OpExpr(decl.loc, op2_table[EQUAL_CAT], [new Ref(decl.id.loc, decl.id), decl.initializer]); if (accum === undefined) // CHANGED accum = init; else accum = new OpExpr(decl.loc, op2_table[COMMA_CAT], [init,
(accum===undefined)?null:accum]); // CHANGED } } ast.expr2 = this.walk_expr(ast.expr2); ast.expr3 = this.walk_expr(ast.expr3); ast.statement = this.walk_statement(ast.statement); return new ForStatement(ast.loc, (accum===undefined)?null:accum, // CHANGED ast.expr2, ast.expr3, ast.statement); }
Someone with a better understanding of the compiler should debug this.
Marc
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list