summaryrefslogtreecommitdiffstats
path: root/iseq.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-14 05:34:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-14 05:34:04 +0000
commit8ae54c3948a23b3814de1f7771ceea919edf9886 (patch)
tree5d7c6070f6d6abb28fb8d21e9579cdf6dcfbd229 /iseq.c
parent38deb17a19a015b5b3b4d5a74762391ba3b6f256 (diff)
downloadruby-8ae54c3948a23b3814de1f7771ceea919edf9886.tar.gz
ruby-8ae54c3948a23b3814de1f7771ceea919edf9886.tar.xz
ruby-8ae54c3948a23b3814de1f7771ceea919edf9886.zip
* compile.c, compile.h (compile_debug): made runtime option.
* debug.c (ruby_debug_print_indent): returns if debug_level exceeds the threashold. * debug.c (ruby_debug_printf): printf to stderr. * iseq.c (make_compile_option, make_compile_option_value): added debug_level option. * vm_core.h (rb_compile_option_t): added debug_level. * vm_core.h (struct iseq_compile_data): added node_level. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/iseq.c b/iseq.c
index 515980b5f..c54239a81 100644
--- a/iseq.c
+++ b/iseq.c
@@ -241,6 +241,10 @@ make_compile_option(rb_compile_option_t *option, VALUE opt)
if (flag == Qtrue) { o->mem = 1; } \
else if (flag == Qfalse) { o->mem = 0; } \
}
+#define SET_COMPILE_OPTION_NUM(o, h, mem) \
+ { VALUE num = rb_hash_aref(opt, ID2SYM(rb_intern(#mem))); \
+ if (!NIL_P(num)) o->mem = NUM2INT(num); \
+ }
SET_COMPILE_OPTION(option, opt, inline_const_cache);
SET_COMPILE_OPTION(option, opt, peephole_optimization);
SET_COMPILE_OPTION(option, opt, tailcall_optimization);
@@ -249,7 +253,9 @@ make_compile_option(rb_compile_option_t *option, VALUE opt)
SET_COMPILE_OPTION(option, opt, instructions_unification);
SET_COMPILE_OPTION(option, opt, stack_caching);
SET_COMPILE_OPTION(option, opt, trace_instruction);
+ SET_COMPILE_OPTION_NUM(option, opt, debug_level);
#undef SET_COMPILE_OPTION
+#undef SET_COMPILE_OPTION_NUM
}
else {
rb_raise(rb_eTypeError, "Compile option must be Hash/true/false/nil");
@@ -262,6 +268,8 @@ make_compile_option_value(rb_compile_option_t *option)
VALUE opt = rb_hash_new();
#define SET_COMPILE_OPTION(o, h, mem) \
rb_hash_aset(h, ID2SYM(rb_intern(#mem)), o->mem ? Qtrue : Qfalse)
+#define SET_COMPILE_OPTION_NUM(o, h, mem) \
+ rb_hash_aset(h, ID2SYM(rb_intern(#mem)), INT2NUM(o->mem))
{
SET_COMPILE_OPTION(option, opt, inline_const_cache);
SET_COMPILE_OPTION(option, opt, peephole_optimization);
@@ -270,8 +278,10 @@ make_compile_option_value(rb_compile_option_t *option)
SET_COMPILE_OPTION(option, opt, operands_unification);
SET_COMPILE_OPTION(option, opt, instructions_unification);
SET_COMPILE_OPTION(option, opt, stack_caching);
+ SET_COMPILE_OPTION_NUM(option, opt, debug_level);
}
#undef SET_COMPILE_OPTION
+#undef SET_COMPILE_OPTION_NUM
return opt;
}