diff options
author | Adrian Thurston <thurston@colm.net> | 2018-05-15 17:36:30 -0400 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2018-05-15 17:36:30 -0400 |
commit | 44f8ba6d73a3de862d05c5606fda32a3141018aa (patch) | |
tree | 5cc799c662eebfeda0382795303ca020a31ca7f9 /src/bytecode.c | |
parent | c6868422f732147146fd4cf58252187df1afb438 (diff) | |
download | colm-44f8ba6d73a3de862d05c5606fda32a3141018aa.tar.gz |
merged the EXIT instructions into PARSE_FRAG
Diffstat (limited to 'src/bytecode.c')
-rw-r--r-- | src/bytecode.c | 62 |
1 files changed, 20 insertions, 42 deletions
diff --git a/src/bytecode.c b/src/bytecode.c index 523eb7aa..ae57763a 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -2346,8 +2346,7 @@ again: vm_push_stream( stream ); - //instr += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE; - instr += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE; + instr += SIZEOF_CODE + SIZEOF_CODE; } else { stream_append_text( prg, sp, stream, input ); @@ -2374,8 +2373,7 @@ again: vm_push_stream( stream ); - //instr += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE; - instr += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE; + instr += SIZEOF_CODE + SIZEOF_CODE; } else { parser_t *parser = stream->parser; @@ -2427,8 +2425,7 @@ again: vm_push_stream( stream ); - //instr += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE; - instr += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE; + instr += SIZEOF_CODE + SIZEOF_CODE; } else { parser_t *parser = stream->parser; @@ -2457,8 +2454,7 @@ again: vm_push_stream( stream ); - //instr += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE; - instr += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE; + instr += SIZEOF_CODE + SIZEOF_CODE; } else { parser_t *parser = stream->parser; @@ -2558,8 +2554,7 @@ again: } if ( stream->parser == 0 ) - //instr += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE; - instr += SIZEOF_CODE + SIZEOF_CODE + SIZEOF_CODE; + instr += SIZEOF_CODE + SIZEOF_CODE; break; } @@ -2700,29 +2695,20 @@ again: * through to call some code, then jump back here. */ if ( exec->pcr != PCR_DONE ) instr = pcr_call( prg, exec, &sp, instr, stream ); - break; - } - - case IN_PARSE_FRAG_EXIT_W: { - debug( prg, REALM_BYTECODE, "IN_PARSE_FRAG_EXIT_W \n" ); - - stream_t *stream = vm_pop_stream(); - vm_push_stream( stream ); - - if ( exec->WV ) { - rcode_unit_start( exec ); + else { + if ( exec->WV ) { + rcode_unit_start( exec ); + + rcode_code( exec, IN_PARSE_INIT_BKT ); + rcode_word( exec, (word_t)stream ); + rcode_word( exec, (word_t)exec->steps ); + rcode_code( exec, IN_PARSE_FRAG_BKT ); + rcode_unit_term( exec ); + } - rcode_code( exec, IN_PARSE_INIT_BKT ); - rcode_word( exec, (word_t)stream ); - rcode_word( exec, (word_t)exec->steps ); - rcode_code( exec, IN_PARSE_FRAG_BKT ); - rcode_code( exec, IN_PARSE_FRAG_EXIT_BKT ); - rcode_unit_term( exec ); + if ( prg->induce_exit ) + goto out; } - - if ( prg->induce_exit ) - goto out; - break; } @@ -2737,13 +2723,9 @@ again: if ( exec->pcr != PCR_DONE ) instr = pcr_call( prg, exec, &sp, instr, stream ); - break; - } - - case IN_PARSE_FRAG_EXIT_BKT: { - debug( prg, REALM_BYTECODE, "IN_PARSE_FRAG_EXIT_BKT\n" ); - - vm_pop_stream(); + else { + vm_pop_stream(); + } break; } @@ -4721,10 +4703,6 @@ again: debug( prg, REALM_BYTECODE, "IN_PARSE_FRAG_BKT\n" ); break; } - case IN_PARSE_FRAG_EXIT_BKT: { - debug( prg, REALM_BYTECODE, "IN_PARSE_FRAG_EXIT_BKT\n" ); - break; - } case IN_PCR_RET: { debug( prg, REALM_BYTECODE, "IN_PCR_RET\n" ); return; |