From: Iain Barnett Date: 2010-08-13T06:52:45+09:00 Subject: Re: Tail recursion with 1.9 On 10 Aug 2010, at 16:43, Joseph E. Savard wrote: > 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 */ > }; > Thanks for the reply. Finally got 1.9.1-p429 to compile, and I set #define OPT_TAILCALL_OPTIMIZATION 1 before compiling, which hopefully is right, I don't know C. Do you know any way I can check it's definitely on, aside from attempting to blow the stack with something hugely recursive? Iain