summaryrefslogtreecommitdiffhomepage
path: root/src/codegen.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-08-29 15:09:14 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-08-29 15:09:14 +0900
commit3c4cd5428a1cfc43516f57506c1faf775c2a4abc (patch)
treeb16e23cb072e8b9cd541c0178cbb4d02a304c8d5 /src/codegen.c
parent56384139a842f5ffd0ed9609d81fde53050549da (diff)
downloadmruby-3c4cd5428a1cfc43516f57506c1faf775c2a4abc.tar.gz
mruby-3c4cd5428a1cfc43516f57506c1faf775c2a4abc.zip
allow no_optimize esp. for debugger
Diffstat (limited to 'src/codegen.c')
-rw-r--r--src/codegen.c10
1 files changed, 9 insertions, 1 deletions
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);