ruby-changes:2613
From: ko1@a...
Date: 5 Dec 2007 13:41:58 +0900
Subject: [ruby-changes:2613] nobu - Ruby:r14104 (trunk): * parse.y (yycompile): get rid of tracing while parsing.
nobu 2007-12-05 13:41:27 +0900 (Wed, 05 Dec 2007) New Revision: 14104 Modified files: trunk/ChangeLog trunk/parse.y trunk/thread.c trunk/version.h Log: * parse.y (yycompile): get rid of tracing while parsing. [ruby-dev:31351] * thread.c (ruby_suppress_tracing): added a new parameter, which directs to call func always. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/version.h?r1=14104&r2=14103 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/parse.y?r1=14104&r2=14103 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14104&r2=14103 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/thread.c?r1=14104&r2=14103 Index: ChangeLog =================================================================== --- ChangeLog (revision 14103) +++ ChangeLog (revision 14104) @@ -1,3 +1,11 @@ +Wed Dec 5 13:41:25 2007 Nobuyoshi Nakada <nobu@r...> + + * parse.y (yycompile): get rid of tracing while parsing. + [ruby-dev:31351] + + * thread.c (ruby_suppress_tracing): added a new parameter, which + directs to call func always. + Tue Dec 4 19:56:42 2007 Nobuyoshi Nakada <nobu@r...> * ext/iconv/iconv.c (iconv_convert): should not set encoding unless Index: thread.c =================================================================== --- thread.c (revision 14103) +++ thread.c (revision 14104) @@ -2880,7 +2880,7 @@ } } -VALUE ruby_suppress_tracing(VALUE (*func)(ANYARGS), VALUE arg); +VALUE ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always); struct call_trace_func_args { rb_event_flag_t event; @@ -2891,7 +2891,7 @@ }; static VALUE -call_trace_proc(VALUE args) +call_trace_proc(VALUE args, int tracing) { struct call_trace_func_args *p = (struct call_trace_func_args *)args; VALUE eventname = rb_str_new2(get_event_name(p->event)); @@ -2935,17 +2935,17 @@ args.self = self; args.id = id; args.klass = klass; - ruby_suppress_tracing(call_trace_proc, (VALUE)&args); + ruby_suppress_tracing(call_trace_proc, (VALUE)&args, Qfalse); } VALUE -ruby_suppress_tracing(VALUE (*func)(ANYARGS), VALUE arg) +ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always) { rb_thread_t *th = GET_THREAD(); - int state, raised; + int state, raised, tracing; VALUE result = Qnil; - if (th->tracing) { + if ((tracing = th->tracing) != 0 && !always) { return Qnil; } else { @@ -2956,7 +2956,7 @@ PUSH_TAG(); if ((state = EXEC_TAG()) == 0) { - result = (*func)(arg); + result = (*func)(arg, tracing); } if (raised) { @@ -2964,7 +2964,7 @@ } POP_TAG(); - th->tracing = 0; + th->tracing = tracing; if (state) { JUMP_TAG(state); } Index: parse.y =================================================================== --- parse.y (revision 14103) +++ parse.y (revision 14104) @@ -4656,15 +4656,15 @@ static void parser_prepare(struct parser_params *parser); #ifndef RIPPER -VALUE ruby_suppress_tracing(VALUE (*func)(ANYARGS), VALUE arg); +VALUE ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always); static VALUE -debug_lines(VALUE f) +debug_lines(const char *f) { if (rb_const_defined_at(rb_cObject, rb_intern("SCRIPT_LINES__"))) { VALUE hash = rb_const_get_at(rb_cObject, rb_intern("SCRIPT_LINES__")); if (TYPE(hash) == T_HASH) { - VALUE fname = rb_str_new2((const char *)f); + VALUE fname = rb_str_new2(f); VALUE lines = rb_hash_lookup(hash, fname); if (NIL_P(lines)) { lines = rb_ary_new(); @@ -4676,17 +4676,18 @@ return 0; } -static NODE* -yycompile(struct parser_params *parser, const char *f, int line) +static VALUE +yycompile0(VALUE arg, int tracing) { int n; NODE *tree; + struct parser_params *parser = (struct parser_params *)arg; if (!compile_for_eval && rb_safe_level() == 0) { - ruby_debug_lines = ruby_suppress_tracing(debug_lines, (VALUE)f); - if (ruby_debug_lines && line > 1) { + ruby_debug_lines = debug_lines(ruby_sourcefile); + if (ruby_debug_lines && ruby_sourceline > 0) { VALUE str = rb_str_new(0, 0); - n = line - 1; + n = ruby_sourceline; do { rb_ary_push(ruby_debug_lines, str); } while (--n); @@ -4694,8 +4695,6 @@ } parser->enc = rb_enc_get(lex_input); - ruby_sourcefile = rb_source_filename(f); - ruby_sourceline = line - 1; parser_prepare(parser); n = yyparse((void*)parser); ruby_debug_lines = 0; @@ -4715,13 +4714,21 @@ if (scope) { scope->nd_body = NEW_PRELUDE(ruby_eval_tree_begin, scope->nd_body); } - return scope; + tree = scope; } else { - return ruby_eval_tree; + tree = ruby_eval_tree; } - return tree; + return (VALUE)tree; } + +static NODE* +yycompile(struct parser_params *parser, const char *f, int line) +{ + ruby_sourcefile = rb_source_filename(f); + ruby_sourceline = line - 1; + return (NODE *)ruby_suppress_tracing(yycompile0, (VALUE)parser, Qtrue); +} #endif /* !RIPPER */ static VALUE Index: version.h =================================================================== --- version.h (revision 14103) +++ version.h (revision 14104) @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2007-12-04" +#define RUBY_RELEASE_DATE "2007-12-05" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20071204 +#define RUBY_RELEASE_CODE 20071205 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 12 -#define RUBY_RELEASE_DAY 4 +#define RUBY_RELEASE_DAY 5 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml