clean up bytecode
This commit is contained in:
18
mcode.cm
18
mcode.cm
@@ -850,9 +850,9 @@ var mcode = function(ast) {
|
||||
emit_3("setarg", f, 2, item)
|
||||
emit_2("invoke", f, acc)
|
||||
if (forward) {
|
||||
emit_3("add_int", i, i, one)
|
||||
emit_3("add", i, i, one)
|
||||
} else {
|
||||
emit_3("sub_int", i, i, one)
|
||||
emit_3("subtract", i, i, one)
|
||||
}
|
||||
emit_jump(loop_label)
|
||||
}
|
||||
@@ -882,7 +882,7 @@ var mcode = function(ast) {
|
||||
emit_3("setarg", f, 1, item)
|
||||
emit_3("setarg", f, 2, i)
|
||||
emit_2("invoke", f, discard)
|
||||
emit_3("add_int", i, i, one)
|
||||
emit_3("add", i, i, one)
|
||||
emit_jump(loop_label)
|
||||
emit_label(done_label)
|
||||
emit_1("null", dest)
|
||||
@@ -916,7 +916,7 @@ var mcode = function(ast) {
|
||||
emit_3("setarg", f, 1, item)
|
||||
emit_2("invoke", f, val)
|
||||
emit_jump_cond("jump_false", val, ret_false)
|
||||
emit_3("add_int", i, i, one)
|
||||
emit_3("add", i, i, one)
|
||||
emit_jump(loop_label)
|
||||
emit_label(ret_true)
|
||||
emit_1("true", dest)
|
||||
@@ -954,7 +954,7 @@ var mcode = function(ast) {
|
||||
emit_3("setarg", f, 1, item)
|
||||
emit_2("invoke", f, val)
|
||||
emit_jump_cond("jump_true", val, ret_true)
|
||||
emit_3("add_int", i, i, one)
|
||||
emit_3("add", i, i, one)
|
||||
emit_jump(loop_label)
|
||||
emit_label(ret_true)
|
||||
emit_1("true", dest)
|
||||
@@ -996,7 +996,7 @@ var mcode = function(ast) {
|
||||
emit_jump_cond("jump_false", val, skip_label)
|
||||
emit_2("push", result, item)
|
||||
emit_label(skip_label)
|
||||
emit_3("add_int", i, i, one)
|
||||
emit_3("add", i, i, one)
|
||||
emit_jump(loop_label)
|
||||
emit_label(done_label)
|
||||
emit_2("move", dest, result)
|
||||
@@ -1095,9 +1095,9 @@ var mcode = function(ast) {
|
||||
emit_jump(final_label)
|
||||
// No initial, reverse
|
||||
emit_label(no_init_rev)
|
||||
emit_3("sub_int", i, len, one)
|
||||
emit_3("subtract", i, len, one)
|
||||
emit_3("load_index", acc, arr_slot, i)
|
||||
emit_3("sub_int", i, i, one)
|
||||
emit_3("subtract", i, i, one)
|
||||
emit_reduce_loop(r, false, d2)
|
||||
emit_label(d2)
|
||||
emit_2("move", dest, acc)
|
||||
@@ -1118,7 +1118,7 @@ var mcode = function(ast) {
|
||||
// Has initial, reverse
|
||||
emit_label(init_rev)
|
||||
emit_2("move", acc, init_slot)
|
||||
emit_3("sub_int", i, len, one)
|
||||
emit_3("subtract", i, len, one)
|
||||
emit_reduce_loop(r, false, d4)
|
||||
emit_label(d4)
|
||||
emit_2("move", dest, acc)
|
||||
|
||||
Reference in New Issue
Block a user