Skip to content

Commit

Permalink
matz - disappointing fixes
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Sep 20, 2000
1 parent 0fdea54 commit 48fd3fc
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 11 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
@@ -1,3 +1,16 @@
Wed Sep 20 14:01:45 2000 Yukihiro Matsumoto <matz@ruby-lang.org>

* eval.c (rb_provided): detect infnite load loop.

* eval.c (rb_provided): too weak filename comparison.

* eval.c (rb_thread_alloc): avoid recycling still referenced
dvar structures.

* eval.c (rb_callcc): ditto.

* eval.c (THREAD_ALLOC): fiil dyna_vars field by ruby_dyna_vars.

Tue Sep 19 17:47:03 2000 Yukihiro Matsumoto <matz@ruby-lang.org>

* stable version 1.6.0 released.
Expand Down
32 changes: 27 additions & 5 deletions eval.c
Expand Up @@ -3483,7 +3483,7 @@ rb_yield_0(val, self, klass, acheck)
if ((block->flags & BLOCK_D_SCOPE) &&
!FL_TEST(ruby_dyna_vars, DVAR_DONT_RECYCLE)) {
struct RVarmap *vars = ruby_dyna_vars;

while (vars && vars->id != 0) {
rb_gc_force_recycle((VALUE)vars);
vars = vars->next;
Expand Down Expand Up @@ -5043,7 +5043,9 @@ rb_provided(feature)
if (strcmp(f+len, ".so") == 0) {
return Qtrue;
}
goto load_wait;
if (strcmp(f+len, ".rb") == 0) {
goto load_wait;
}
}
p++;
}
Expand All @@ -5053,7 +5055,12 @@ rb_provided(feature)
if (loading_tbl) {
char *ext = strrchr(f, '.');
if (strcmp(ext, ".rb") == 0) {
while (st_lookup(loading_tbl, f, 0)) {
rb_thread_t th;

while (st_lookup(loading_tbl, f, &th)) {
if (th == curr_thread) {
rb_raise(rb_eLoadError, "infinite load loop -- %s", f);
}
CHECK_INTS;
rb_thread_schedule();
}
Expand Down Expand Up @@ -5186,7 +5193,8 @@ rb_f_require(obj, fname)
if (!loading_tbl) {
loading_tbl = st_init_strtable();
}
st_insert(loading_tbl, strdup(feature), 0); /* partial state */
/* partial state */
st_insert(loading_tbl, strdup(feature), curr_thread);

PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
Expand Down Expand Up @@ -5866,6 +5874,7 @@ rb_f_binding(self)
}

for (vars = data->d_vars; vars; vars = vars->next) {
if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
FL_SET(vars, DVAR_DONT_RECYCLE);
}
scope_dup(data->scope);
Expand Down Expand Up @@ -5947,6 +5956,7 @@ proc_new(klass)
data->flags |= BLOCK_DYNAMIC;

for (vars = data->d_vars; vars; vars = vars->next) {
if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
FL_SET(vars, DVAR_DONT_RECYCLE);
}
scope_dup(data->scope);
Expand Down Expand Up @@ -7617,7 +7627,7 @@ rb_thread_abort_exc_set(thread, val)
th->scope = 0;\
th->klass = 0;\
th->wrapper = 0;\
th->dyna_vars = 0;\
th->dyna_vars = ruby_dyna_vars;\
th->block = 0;\
th->iter = 0;\
th->tag = 0;\
Expand All @@ -7637,6 +7647,7 @@ rb_thread_alloc(klass)
VALUE klass;
{
rb_thread_t th;
struct RVarmap *vars;

THREAD_ALLOC(th);
th->thread = Data_Wrap_Struct(klass, thread_mark, thread_free, th);
Expand All @@ -7654,6 +7665,10 @@ rb_thread_alloc(klass)
th->status = THREAD_RUNNABLE;
}

for (vars = th->dyna_vars; vars; vars = vars->next) {
if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
FL_SET(vars, DVAR_DONT_RECYCLE);
}
return th;
}

Expand Down Expand Up @@ -8140,6 +8155,7 @@ rb_callcc(self)
volatile VALUE cont;
rb_thread_t th;
struct tag *tag;
struct RVarmap *vars;

THREAD_ALLOC(th);
cont = Data_Wrap_Struct(rb_cCont, thread_mark,
Expand All @@ -8151,6 +8167,12 @@ rb_callcc(self)
}
th->prev = th->next = 0;
th->thread = curr_thread->thread;

for (vars = th->dyna_vars; vars; vars = vars->next) {
if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
FL_SET(vars, DVAR_DONT_RECYCLE);
}

if (THREAD_SAVE_CONTEXT(th)) {
return th->result;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/thread.rb
Expand Up @@ -223,7 +223,7 @@ def max

def max=(max)
Thread.critical = true
if @max >= max
if max >= @max
@max = max
Thread.critical = false
else
Expand Down
2 changes: 1 addition & 1 deletion lib/thwait.rb
Expand Up @@ -115,7 +115,7 @@ def next_wait(nonblock = nil)
@threads.delete(th = @wait_queue.pop(nonblock))
th
rescue ThreadError
ThreadsWait.fail ErrNoFinshedThread
ThreadsWait.fail ErrNoFinishedThread
end
end

Expand Down
8 changes: 4 additions & 4 deletions version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.6.0"
#define RUBY_RELEASE_DATE "2000-09-19"
#define RUBY_VERSION_CODE 160
#define RUBY_RELEASE_CODE 20000919
#define RUBY_VERSION "1.6.1"
#define RUBY_RELEASE_DATE "2000-09-20"
#define RUBY_VERSION_CODE 161
#define RUBY_RELEASE_CODE 20000920

0 comments on commit 48fd3fc

Please sign in to comment.