allow no_optimize esp. for debugger

This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-08-29 15:09:14 +09:00
parent 56384139a8
commit 3c4cd5428a
3 changed files with 12 additions and 1 deletions
+9 -1
View File
@@ -162,11 +162,19 @@ genop(codegen_scope *s, mrb_code i)
#define NOVAL 0
#define VAL 1
static mrb_bool
no_optimize(codegen_scope *s)
{
if (s && s->parser && s->parser->no_optimize)
return TRUE;
return FALSE;
}
static int
genop_peep(codegen_scope *s, mrb_code i, int val)
{
/* peephole optimization */
if (s->lastlabel != s->pc && s->pc > 0) {
if (!no_optimize(s) && s->lastlabel != s->pc && s->pc > 0) {
mrb_code i0 = s->iseq[s->pc-1];
int c1 = GET_OPCODE(i);
int c0 = GET_OPCODE(i0);