From ceec42bf8c4e350d02d11b84adf9b8ebf7b4af47 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 27 Dec 2000 05:59:03 +0000 Subject: matz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 37 +++++++++++++++++++++++-------------- README | 15 +++++++++------ README.jp | 16 ++++++++++------ eval.c | 19 ++++++++++--------- ext/extmk.rb.in | 2 +- lib/debug.rb | 48 +++++++++++++++++++++++++++++++++++------------- parse.y | 52 +++++++++++++++++++++++++++------------------------- range.c | 3 +++ win32/config.h.in | 8 ++++---- 9 files changed, 122 insertions(+), 78 deletions(-) diff --git a/ChangeLog b/ChangeLog index af5f1f0993..647ddd2b4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ +Tue Dec 26 18:46:41 2000 NAKAMURA Hiroshi + + * lib/debug.rb: Avoid thread deadlock in debugging stopped thread. + + * lib/debug.rb: Uncleared 'finish' state. + Tue Dec 26 16:53:55 2000 Yukihiro Matsumoto + * eval.c (rb_yield_0): remove dvar node by rb_gc_force_recycle() + more eagerly. + * eval.c (rb_f_binding): recycling should be stopped for outer scope too. @@ -859,7 +868,7 @@ Sat Sep 23 03:06:25 2000 Yukihiro Matsumoto Fri Sep 22 15:46:21 2000 Minero Aoki - * lib/net/http.rb: too early parameter expantion in string. + * lib/net/http.rb: too early parameter expansion in string. Fri Sep 22 13:58:51 2000 WATANABE Hirofumi @@ -916,7 +925,7 @@ Wed Sep 20 23:21:38 2000 Yukihiro Matsumoto Wed Sep 20 14:01:45 2000 Yukihiro Matsumoto - * eval.c (rb_provided): detect infnite load loop. + * eval.c (rb_provided): detect infinite load loop. * eval.c (rb_provided): too weak filename comparison. @@ -981,7 +990,7 @@ Thu Sep 14 02:46:54 2000 Yukihiro Matsumoto Wed Sep 13 17:01:03 2000 Yukihiro Matsumoto - * bignum.c (rb_big_eq): imcomplete value compare of bignums. + * bignum.c (rb_big_eq): incomplete value comparison of bignums. Wed Sep 13 06:39:54 2000 Yukihiro Matsumoto @@ -1106,7 +1115,7 @@ Fri Sep 1 10:36:29 2000 Yukihiro Matsumoto * parse.y (aref_args,opt_call_args): add block_call to allow a method without parentheses and with block as a last argument. - * hash.c (rb_hash_sort): should not retrun nil. + * hash.c (rb_hash_sort): should not return nil. * re.c (match_aref): should use rb_reg_nth_match(). @@ -1274,7 +1283,7 @@ Fri Aug 11 15:43:46 2000 Yukihiro Matsumoto Thu Aug 10 08:05:03 2000 Yukihiro Matsumoto - * eval.c (rb_callcc): returned current thread instaed of + * eval.c (rb_callcc): returned current thread instead of continuation wrongly. Thu Aug 10 05:40:28 2000 WATANABE Hirofumi @@ -1447,7 +1456,7 @@ Tue Jul 18 14:58:30 2000 Yukihiro Matsumoto Mon Jul 17 04:29:50 2000 Minero Aoki - * lib/mkmf.rb: converts extention of $objs into $OBJEXT. + * lib/mkmf.rb: converts extension of $objs into $OBJEXT. Sun Jul 16 03:02:34 2000 Dave Thomas @@ -1544,7 +1553,7 @@ Mon Jul 10 09:07:54 2000 Yukihiro Matsumoto Sat Jul 8 23:08:40 2000 Yukihiro Matsumoto * eval.c (rb_thread_start_0): should copy previous scopes to - prevent rb_gc_force_recylce(). + prevent rb_gc_force_recycle(). Fri Jul 7 23:36:36 2000 Katsuyuki Komatsu @@ -1619,7 +1628,7 @@ Wed Jul 5 09:47:14 2000 Yukihiro Matsumoto * time.c (time_arg): Time::local, Time::gm now take 7th optional argument for usec. - * numeric.c (num_ceil, etc): default ceil, floor, round, trancate + * numeric.c (num_ceil, etc): default ceil, floor, round, truncate implementation for Numeric, using `to_f'. * io.c (rb_io_reopen): clear fptr->path after free() to prevent @@ -1710,7 +1719,7 @@ Mon Jul 3 13:15:02 2000 Yukihiro Matsumoto * bignum.c (rb_big_divmod): ditto. - * numeric.c (fixdivmod): does not depend C's undifined % + * numeric.c (fixdivmod): does not depend C's undefined % behavior. adopt to fmod(3m) behavior. * numeric.c (flo_mod): modulo now reserves fmod(3m) behavior. @@ -1753,7 +1762,7 @@ Sat Jul 1 15:22:35 2000 Yukihiro Matsumoto Sat Jul 1 15:22:35 2000 Yukihiro Matsumoto * eval.c (rb_eval): the value from RTEST() is not valid Ruby - objct. result should be either true or false. + object. result should be either true or false. Sat Jul 1 09:30:06 2000 Katsuyuki Komatsu @@ -3946,7 +3955,7 @@ Thu Oct 21 16:14:19 1999 Yukihiro Matsumoto * ruby.c (proc_options): use RUBYOPT environment variable to retrieve the default options. - * dir.c (fnmatch): use eban's fnmatch; do not depend on systems's + * dir.c (fnmatch): use eban's fnmatch; do not depend on system's fnmatch (which may have portability problem) anymore. Wed Oct 20 15:14:24 1999 Yukihiro Matsumoto @@ -6541,7 +6550,7 @@ Sun Nov 1 01:18:52 1998 EGUCHI Osamu Sat Oct 31 23:18:34 1998 Yukihiro Matsumoto * string.c (rb_str_split_method): negative LIMIT means number of - splitted fields are unlimited, as in perl. + split fields are unlimited, as in perl. * string.c (rb_str_split_method): if LIMIT is unspecified, trailing null fields are stripped. @@ -8797,7 +8806,7 @@ Wed Nov 12 13:44:47 1997 Yukihiro Matsumoto Mon Nov 10 11:24:51 1997 Yukihiro Matsumoto - * regex.c (re_compile_pattern): non-resitering parens (?:..). + * regex.c (re_compile_pattern): non-registering parens (?:..). * regex.c (re_compile_pattern): new meta character \< (wordbeg) and \> (wordend). @@ -9053,7 +9062,7 @@ Tue Sep 16 17:54:25 1997 Yukihiro Matsumoto * ruby.c (ruby_prog_init): close stdaux and stdprn for MSDOS. * ruby.c (ruby_prog_init): should not add path from environment - variable, if ruby is running under seuid. + variable, if ruby is running under setuid. * process.c (init_ids): check suid check for setuid/seteuid etc. diff --git a/README b/README index 5794f5daf6..f924702e39 100644 --- a/README +++ b/README @@ -46,11 +46,14 @@ in the mail body (not subject) to the address . This is what you need to do to compile and install Ruby: - 1. Run ./configure, which will generate config.h and Makefile. + 1. If ./configure does not exist or is older than configure.in, + run autoconf to (re)generate configure. - 2. Edit defines.h if you need. Probably this step will not need. + 2. Run ./configure, which will generate config.h and Makefile. - 3. Remove comment mark(#) before the module names from ext/Setup (or + 3. Edit defines.h if you need. Probably this step will not need. + + 4. Remove comment mark(#) before the module names from ext/Setup (or add module names if not present), if you want to link modules statically. @@ -59,13 +62,13 @@ This is what you need to do to compile and install Ruby: remove comment mark from the line "#option nodynamic" in ext/Setup. - 4. Run make. + 5. Run make. - 5. Optionally, run 'make test' to check whether the compiled Ruby + 6. Optionally, run 'make test' to check whether the compiled Ruby interpreter works well. If you see the message "test succeeded", your ruby works as it should (hopefully). - 6. Run 'make install' + 7. Run 'make install' You may have to be a super user to install ruby. diff --git a/README.jp b/README.jp index fccedb2f99..566fbcdac4 100644 --- a/README.jp +++ b/README.jp @@ -78,13 +78,17 @@ Ruby 以下の手順で行ってください. - 1. configureを実行してMakefileなどを生成する + 1. もしconfigureファイルが見つからない、もしくは + configure.inより古いようなら、autoconfを実行して + 新しくconfigureを生成する - 2. (必要ならば)defines.hを編集する + 2. configureを実行してMakefileなどを生成する + + 3. (必要ならば)defines.hを編集する 多分,必要無いと思います. - 3. (必要ならば)ext/Setupに静的にリンクする拡張モジュールを + 4. (必要ならば)ext/Setupに静的にリンクする拡張モジュールを 指定する ext/Setupに記述したモジュールは静的にリンクされます. @@ -95,14 +99,14 @@ Ruby 拡張モジュールを利用するためには,あらかじめ静的にリン クしておく必要があります. - 4. makeを実行してコンパイルする + 5. makeを実行してコンパイルする - 5. make testでテストを行う. + 6. make testでテストを行う. 「test succeeded」と表示されれば成功です.ただしテスト に成功しても完璧だと保証されている訳ではありません. - 6. make install + 7. make install rootで作業する必要があるかもしれません. diff --git a/eval.c b/eval.c index 57286486e0..c7e88cab7d 100644 --- a/eval.c +++ b/eval.c @@ -1982,7 +1982,7 @@ rb_eval(self, n) /* nodes for speed-up(default match) */ case NODE_MATCH: - result = rb_reg_match2(node->nd_head->nd_lit); + result = rb_reg_match2(node->nd_lit); break; /* nodes for speed-up(literal match) */ @@ -3558,17 +3558,18 @@ rb_yield_0(val, self, klass, acheck) pop_state: POP_ITER(); POP_CLASS(); - if ((block->flags & BLOCK_D_SCOPE) && + if (ruby_dyna_vars && (block->flags & BLOCK_D_SCOPE) && !FL_TEST(ruby_dyna_vars, DVAR_DONT_RECYCLE)) { - struct RVarmap *vars = ruby_dyna_vars; + struct RVarmap *vars, *tmp; - while (vars && vars->id != 0) { - struct RVarmap *tmp = vars->next; - rb_gc_force_recycle((VALUE)vars); - vars = tmp; - } - if (ruby_dyna_vars && ruby_dyna_vars->id == 0) { + if (ruby_dyna_vars->id == 0) { + vars = ruby_dyna_vars->next; rb_gc_force_recycle((VALUE)ruby_dyna_vars); + while (vars && vars->id != 0) { + tmp = vars->next; + rb_gc_force_recycle((VALUE)vars); + vars = tmp; + } } } POP_VARS(); diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index 92d11d0f6e..ff6f04b4b6 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -370,7 +370,7 @@ def create_makefile(target) if $configure_args['--enable-shared'] or "@LIBRUBY@" != "@LIBRUBY_A@" $libs = "@LIBRUBYARG@ " + $libs - $LIBPATH |= [$topdir] + $LIBPATH.unshift $topdir end defflag = '' diff --git a/lib/debug.rb b/lib/debug.rb index 3281f7b4e9..220b68d2c9 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -98,13 +98,25 @@ class DEBUGGER__ @stop_next = n end - def suspend + def set_suspend @suspend_next = true end + def clear_suspend + @suspend_next = false + end + + def suspend_all + DEBUGGER__.suspend + end + + def resume_all + DEBUGGER__.resume + end + def check_suspend while (Thread.critical = true; @suspend_next) - waiting.push Thread.current + DEBUGGER__.waiting.push Thread.current @suspend_next = false Thread.stop end @@ -131,14 +143,18 @@ class DEBUGGER__ DEBUGGER__.display end - def waiting - DEBUGGER__.waiting + def context(th) + DEBUGGER__.context(th) end def set_trace_all(arg) DEBUGGER__.set_trace(arg) end + def set_last_thread(th) + DEBUGGER__.set_last_thread(th) + end + def debug_eval(str, binding) begin val = eval(str, binding) @@ -237,7 +253,7 @@ class DEBUGGER__ def debug_command(file, line, id, binding) MUTEX.lock - DEBUGGER__.set_last_thread(Thread.current) + set_last_thread(Thread.current) frame_pos = 0 binding_file = file binding_line = line @@ -506,7 +522,7 @@ class DEBUGGER__ end end MUTEX.unlock - DEBUGGER__.resume_all_thread + resume_all end def debug_print_help @@ -662,14 +678,14 @@ EOHELP stdout.printf "\tfrom %s\n", i end end - DEBUGGER__.suspend_all_thread + suspend_all debug_command(file, line, id, binding) end end def trace_func(event, file, line, id, binding, klass) Tracer.trace_func(event, file, line, id, binding, klass) if trace? - DEBUGGER__.context(Thread.current).check_suspend + context(Thread.current).check_suspend @file = file @line = line case event @@ -687,7 +703,7 @@ EOHELP @stop_next = 1 else @no_step = nil - DEBUGGER__.suspend_all_thread + suspend_all debug_command(file, line, id, binding) @last = [file, line] end @@ -697,7 +713,7 @@ EOHELP @frames.unshift [binding, file, line, id] if check_break_points(file, id.id2name, binding, id) or check_break_points(klass.to_s, id.id2name, binding, id) - DEBUGGER__.suspend_all_thread + suspend_all debug_command(file, line, id, binding) end @@ -710,6 +726,7 @@ EOHELP when 'return', 'end' if @frames.size == @finish_pos @stop_next = 1 + @finish_pos = 0 end @frames.shift @@ -767,20 +784,25 @@ EOHELP @last_thread = th end - def suspend_all_thread + def suspend Thread.critical = true make_thread_list for th in @thread_list next if th[0] == Thread.current - context(th[0]).suspend + context(th[0]).set_suspend end Thread.critical = false # Schedule other threads to suspend as soon as possible. Thread.pass end - def resume_all_thread + def resume Thread.critical = true + make_thread_list + for th in @thread_list + next if th[0] == Thread.current + context(th[0]).clear_suspend + end waiting.each do |th| th.run end diff --git a/parse.y b/parse.y index da7bba3578..94fafdd841 100644 --- a/parse.y +++ b/parse.y @@ -4436,69 +4436,71 @@ assign_in_cond(node) } static NODE* -cond0(node) +cond0(node, log) NODE *node; + int log; { enum node_type type = nd_type(node); assign_in_cond(node); switch (type) { + case NODE_DSTR: + if (log) break; + nd_set_type(node, NODE_DREGX); + /* fall through */ case NODE_DREGX: case NODE_DREGX_ONCE: local_cnt('_'); local_cnt('~'); + rb_warn("string/regex literal in condition"); return NEW_MATCH2(node, NEW_GVAR(rb_intern("$_"))); case NODE_DOT2: case NODE_DOT3: - node->nd_beg = cond2(node->nd_beg); - node->nd_end = cond2(node->nd_end); + node->nd_beg = cond0(node->nd_beg, log); + node->nd_end = cond0(node->nd_end, log); if (type == NODE_DOT2) nd_set_type(node,NODE_FLIP2); else if (type == NODE_DOT3) nd_set_type(node, NODE_FLIP3); node->nd_cnt = local_append(0); + rb_warn("range literal in condition"); return node; + case NODE_STR: + if (log) break; + node->nd_lit = rb_reg_new(RSTRING(node->nd_lit)->ptr,RSTRING(node->nd_lit)->len,0); + goto regexp; + case NODE_LIT: if (TYPE(node->nd_lit) == T_REGEXP) { + regexp: + nd_set_type(node, NODE_MATCH); local_cnt('_'); local_cnt('~'); - return NEW_MATCH(node); + rb_warn("string/regex literal in condition"); + return node; } - if (TYPE(node->nd_lit) == T_STRING) { - local_cnt('_'); - local_cnt('~'); - return NEW_MATCH(rb_reg_new(RSTRING(node)->ptr,RSTRING(node)->len,0)); - } - default: - return node; } + return node; } static NODE* -cond(node) +cond1(node, log) NODE *node; + int log; { if (node == 0) return 0; if (nd_type(node) == NODE_NEWLINE){ - node->nd_next = cond0(node->nd_next); + node->nd_next = cond0(node->nd_next, log); return node; } - return cond0(node); + return cond0(node, log); } static NODE* -cond2(node) +cond(node) NODE *node; { - enum node_type type; - - node = cond(node); - type = nd_type(node); - if (type == NODE_NEWLINE) node = node->nd_next; - if (type == NODE_LIT && FIXNUM_P(node->nd_lit)) { - return call_op(node,tEQ,1,NEW_GVAR(rb_intern("$."))); - } - return node; + return cond1(node, 0); } static NODE* @@ -4507,7 +4509,7 @@ logop(type, left, right) NODE *left, *right; { value_expr(left); - return rb_node_newnode(type, cond(left), cond(right), 0); + return rb_node_newnode(type, cond1(left, 1), cond1(right, 1), 0); } static NODE * diff --git a/range.c b/range.c index ed835c2d4c..cd9750428c 100644 --- a/range.c +++ b/range.c @@ -341,6 +341,9 @@ range_length(range) if (!EXCL(range)) { size = rb_funcall(size, '+', 1, INT2FIX(1)); } + if (TYPE(size) == T_FLOAT) { + size = rb_funcall(size, rb_intern("floor"), 0); + } return size; } diff --git a/win32/config.h.in b/win32/config.h.in index 149faf7d8c..6bffe7eea4 100644 --- a/win32/config.h.in +++ b/win32/config.h.in @@ -45,12 +45,12 @@ #define DEFAULT_KCODE KCODE_NONE #define DLEXT ".so" #define DLEXT2 ".dll" -#define RUBY_LIB "/lib/ruby/1.6" +#define RUBY_LIB "/lib/ruby/1.7" #define RUBY_SITE_LIB "/lib/ruby/site_ruby" -#define RUBY_SITE_LIB2 "/lib/ruby/site_ruby/1.6" +#define RUBY_SITE_LIB2 "/lib/ruby/site_ruby/1.7" #define RUBY_PLATFORM "i586-mswin32" -#define RUBY_ARCHLIB "/lib/ruby/1.6/i586-mswin32" -#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/1.6/i586-mswin32" +#define RUBY_ARCHLIB "/lib/ruby/1.7/i586-mswin32" +#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/1.7/i586-mswin32" #define SIZEOF_INT 4 #define SIZEOF_SHORT 2 -- cgit v1.2.3