From 3c4cd5428a1cfc43516f57506c1faf775c2a4abc Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 29 Aug 2014 15:09:14 +0900 Subject: allow no_optimize esp. for debugger --- src/codegen.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/codegen.c') diff --git a/src/codegen.c b/src/codegen.c index 031605eb7..78d641faf 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -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); -- cgit v1.2.3