aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--parse.y33
-rw-r--r--thread.c16
-rw-r--r--version.h6
4 files changed, 39 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c264df36e..2fdfb3219e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Wed Dec 5 13:41:25 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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@ruby-lang.org>
* ext/iconv/iconv.c (iconv_convert): should not set encoding unless
diff --git a/parse.y b/parse.y
index 12d2e8893b..43d45c6826 100644
--- a/parse.y
+++ b/parse.y
@@ -4656,15 +4656,15 @@ parser_yyerror(struct parser_params *parser, const char *msg)
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 @@ debug_lines(VALUE f)
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 @@ yycompile(struct parser_params *parser, const char *f, int line)
}
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,12 +4714,20 @@ yycompile(struct parser_params *parser, const char *f, int line)
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 */
diff --git a/thread.c b/thread.c
index 7f2aa68143..e03e23a1bb 100644
--- a/thread.c
+++ b/thread.c
@@ -2880,7 +2880,7 @@ get_event_name(rb_event_flag_t event)
}
}
-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 @@ struct call_trace_func_args {
};
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 @@ call_trace_func(rb_event_flag_t event, VALUE proc, VALUE self, ID id, VALUE klas
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 @@ ruby_suppress_tracing(VALUE (*func)(ANYARGS), VALUE arg)
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
- result = (*func)(arg);
+ result = (*func)(arg, tracing);
}
if (raised) {
@@ -2964,7 +2964,7 @@ ruby_suppress_tracing(VALUE (*func)(ANYARGS), VALUE arg)
}
POP_TAG();
- th->tracing = 0;
+ th->tracing = tracing;
if (state) {
JUMP_TAG(state);
}
diff --git a/version.h b/version.h
index 54700f5549..28591e0ecd 100644
--- a/version.h
+++ b/version.h
@@ -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[];