From: "Joseph E. Savard" Date: 2010-08-11T00:43:30+09:00 Subject: Re: Tail recursion with 1.9 Its commented out. See vm_opts.h. As far as sensing it in Ruby I would think ruby-1.9.2-rc2.tar.bz2> Snippet of vm_opts.h below: #ifndef RUBY_VM_OPTS_H #define RUBY_VM_OPTS_H /* Compile options. * You can change these options at runtime by VM::CompileOption. * Following definitions are default values. */ #define OPT_TRACE_INSTRUCTION 1 #define OPT_TAILCALL_OPTIMIZATION 0 #define OPT_PEEPHOLE_OPTIMIZATION 1 #define OPT_SPECIALISED_INSTRUCTION 1 #define OPT_INLINE_CONST_CACHE 1 RUN TIME OPTIONS could be interesting to play with. You appear to loose the promise of portability. See iseq.c (Interesting rb_compile_option_t ) 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, /* int trace_instruction */ }; > From: Iain Barnett > Reply-To: > Date: Tue, 10 Aug 2010 23:04:50 +0900 > To: ruby-talk ML > Subject: Tail recursion with 1.9 > > Hi, > > I read in the first answer here > http://stackoverflow.com/questions/824562/does-ruby-perform-tail-call-optimiza > tion that tail recursion is not on by default and is enabled by uncommenting a > line in the source before compilation. Is this still true, and is there anyway > to tell if it's on or not in a particular installation? > > > Regards, > Iain