Change APPEND opcode to directly modify a variable.

Avoids a big O(n^2) loop in constructing arrays. Fixes #61.
This commit is contained in:
Stephen Dolan committed 2013-01-03 12:51:33 +00:00
1 parent fb84541e11
commit c013b557a2
3 files changed
+8 -9

No files matched your search

+1 -5
View File
@@ -292,11 +292,7 @@ block gen_collect(block expr) {
gen_noop(), OP_HAS_VARIABLE);
block c = BLOCK(gen_op_simple(DUP), gen_const(jv_array()), array_var);
block tail = BLOCK(gen_op_simple(DUP),
gen_op_var_bound(LOADV, array_var),
gen_op_simple(SWAP),
gen_op_simple(APPEND),
gen_op_var_bound(STOREV, array_var),
block tail = BLOCK(gen_op_var_bound(APPEND, array_var),
gen_op_simple(BACKTRACK));
return BLOCK(c,