summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-21 04:46:51 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-21 04:46:51 +0000
commitaffa7430b70336b53cd496496d889c2544d41322 (patch)
tree5a1ed8dee97b8ee1c9a78aa83abd8f566246f1a3 /iseq.c
parent696cbbd7a6c364687522cc41992b0896f3c0507b (diff)
* compile.c, vm_macro.def: support tail call optimization
(on default, this feature is not enabled). * iseq.c, compile.c, vm_opts.h: add "tailcall_optimization" option. * sample/test.rb (test_ok): fix to adjust tailcall stack layout. * insns.def, vm.c, compile.c, yarvcore.c, yarvcore.h: add opt_gt, opt_le instructions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/iseq.c b/iseq.c
index 11d5b9cbaa..e8c75d5625 100644
--- a/iseq.c
+++ b/iseq.c
@@ -196,11 +196,12 @@ cleanup_iseq_build(rb_iseq_t *iseq)
static rb_compile_option_t COMPILE_OPTION_DEFAULT = {
OPT_INLINE_CONST_CACHE, /* int inline_const_cache; */
OPT_PEEPHOLE_OPTIMIZATION, /* int peephole_optimization; */
+ OPT_TAILCALL_OPTIMIZATION, /* int tailcall_optimization */
OPT_SPECIALISED_INSTRUCTION, /* int specialized_instruction; */
OPT_OPERANDS_UNIFICATION, /* int operands_unification; */
OPT_INSTRUCTIONS_UNIFICATION, /* int instructions_unification; */
OPT_STACK_CACHING, /* int stack_caching; */
- OPT_TRACE_INSTRUCTION,
+ OPT_TRACE_INSTRUCTION, /* int trace_instruction */
};
static const rb_compile_option_t COMPILE_OPTION_FALSE;
@@ -217,13 +218,16 @@ make_compile_option(rb_compile_option_t *option, VALUE opt)
memset(option, 1, sizeof(rb_compile_option_t));
}
else if (CLASS_OF(opt) == rb_cHash) {
+ *option = COMPILE_OPTION_DEFAULT;
+
#define SET_COMPILE_OPTION(o, h, mem) \
- { VALUE flag = rb_hash_aref(h, ID2SYM(rb_intern(#mem))); dp(flag);\
+ { VALUE flag = rb_hash_aref(h, ID2SYM(rb_intern(#mem))); \
if (flag == Qtrue) { o->mem = 1; } \
- if (flag == Qfalse) { o->mem = 0; } \
+ else if (flag == Qfalse) { o->mem = 0; } \
}
SET_COMPILE_OPTION(option, opt, inline_const_cache);
SET_COMPILE_OPTION(option, opt, peephole_optimization);
+ SET_COMPILE_OPTION(option, opt, tailcall_optimization);
SET_COMPILE_OPTION(option, opt, specialized_instruction);
SET_COMPILE_OPTION(option, opt, operands_unification);
SET_COMPILE_OPTION(option, opt, instructions_unification);
@@ -245,6 +249,7 @@ make_compile_option_value(rb_compile_option_t *option)
{
SET_COMPILE_OPTION(option, opt, inline_const_cache);
SET_COMPILE_OPTION(option, opt, peephole_optimization);
+ SET_COMPILE_OPTION(option, opt, tailcall_optimization);
SET_COMPILE_OPTION(option, opt, specialized_instruction);
SET_COMPILE_OPTION(option, opt, operands_unification);
SET_COMPILE_OPTION(option, opt, instructions_unification);