Skip to content

Commit

Permalink
no more inline state just for dynamic dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
andyfischer committed Sep 7, 2015
1 parent 1a8f8d8 commit 904268f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/bytecode.cpp
Expand Up @@ -535,7 +535,7 @@ bool should_write_state_header(Bytecode* bc, Block* block)
// No state allowed in while-loop. Maybe temp, maybe permanant.
if (is_while_loop(block))
return false;
return block_has_state(block) != s_no;
return block_has_state(block) == s_yes;
}

void write_state_header(Bytecode* bc, int keySlot)
Expand Down
11 changes: 11 additions & 0 deletions tests/bytecode_inspection/no_unnecessary_state.ca
@@ -0,0 +1,11 @@

require bytecode_analysis

vm = make_vm(->)
def ops(f)
bytecode_analysis.func_ops(vm f)

def func()
add(1 2)

ops(func) | filter(op -> op.opcode == :push_state_frame) | flatten | equals([]) | assert
2 changes: 1 addition & 1 deletion tests/error/input_cast.ca.output
@@ -1,3 +1,3 @@
[tests/error/input_cast.ca:3]
[inside increment()]
[:649 inside increment()]
Error: Couldn't cast fish to type int

0 comments on commit 904268f

Please sign in to comment.