diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-03-13 09:04:32 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-03-13 09:04:32 +0000 |
commit | 056f219ecaa8daa50a77d28bed49fb5a4bf75928 (patch) | |
tree | 331b0dad1cf037e44c5fd9841d02145a86d3494c | |
parent | 107ead2b961452a8df2d0b63eda34b45d9b4ef75 (diff) |
1.1b9_02
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | env.h | 1 | ||||
-rw-r--r-- | eval.c | 8 | ||||
-rw-r--r-- | gc.c | 6 | ||||
-rw-r--r-- | io.c | 4 | ||||
-rw-r--r-- | lib/weakref.rb | 29 | ||||
-rw-r--r-- | object.c | 1 | ||||
-rw-r--r-- | range.c | 6 |
8 files changed, 38 insertions, 24 deletions
@@ -1,3 +1,10 @@ +Fri Mar 13 13:49:24 1998 Yukihiro Matsumoto <matz@netlab.co.jp> + + * object.c (mod_clone): need to dups constants and instance + variables. + + * eval.c (rb_eval): forgot to initialize body for NODE_DEFS. + Thu Mar 12 15:33:57 1998 Yukihiro Matsumoto <matz@netlab.co.jp> * experimental release 1.1b9_01. @@ -12,6 +12,7 @@ #define ENV_H extern struct FRAME { + VALUE self; int argc; VALUE *argv; ID last_func; @@ -1879,8 +1879,9 @@ rb_eval(self, node) } PUSH_ITER(the_iter->iter?ITER_PRE:ITER_NOT); - result = rb_call(RCLASS(the_frame->last_class)->super, self, - the_frame->last_func, argc, argv, 3); + result = rb_call(RCLASS(the_frame->last_class)->super, + the_frame->self, the_frame->last_func, + argc, argv, 3); POP_ITER(); } break; @@ -2234,7 +2235,7 @@ rb_eval(self, node) if (node->nd_defn) { VALUE recv = rb_eval(self, node->nd_recv); VALUE klass; - NODE *body; + NODE *body = 0; if (FIXNUM_P(recv)) { TypeError("Can't define method \"%s\" for Fixnum", @@ -3169,6 +3170,7 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper) PUSH_FRAME(); the_frame->last_func = id; the_frame->last_class = nosuper?0:klass; + the_frame->self = recv; the_frame->argc = argc; the_frame->argv = argv; @@ -1016,6 +1016,10 @@ id2ref(obj, id) INT ptr = NUM2INT(id); if (FIXNUM_P(ptr)) return (VALUE)ptr; + if (ptr == TRUE) return TRUE; + if (ptr == FALSE) return FALSE; + if (ptr == Qnil) return Qnil; + if (!looks_pointerp(ptr)) { IndexError("0x%x is not the id value", ptr); } @@ -1045,7 +1049,7 @@ Init_GC() rb_define_module_function(mObSpace, "remove_finalizer", rm_final, 1); rb_define_module_function(mObSpace, "finalizers", finals, 0); rb_define_module_function(mObSpace, "call_finalizer", call_final, 1); - rb_define_module_function(mObSpace, "id2ref", id2ref, 1); + rb_define_module_function(mObSpace, "_id2ref", id2ref, 1); rb_global_variable(&finalizers); finalizers = ary_new(); @@ -369,7 +369,7 @@ io_gets_method(argc, argv, io) VALUE rs; if (argc == 0) { - return io_gets(io); + rs = RS; } else { rb_scan_args(argc, argv, "1", &rs); @@ -394,7 +394,6 @@ io_gets_method(argc, argv, io) rsptr = 0; rslen = 0; } - newline = rslen ? rsptr[rslen - 1] : 0777; GetOpenFile(io, fptr); io_readable(fptr); @@ -413,6 +412,7 @@ io_gets_method(argc, argv, io) } while (c != EOF); } + newline = rslen ? rsptr[rslen - 1] : 0777; { char buf[8192]; char *bp, *bpe = buf + sizeof buf - 3; diff --git a/lib/weakref.rb b/lib/weakref.rb index 18d3bbc9a3..6a6dcec5a1 100644 --- a/lib/weakref.rb +++ b/lib/weakref.rb @@ -31,26 +31,27 @@ class WeakRef<Delegator def initialize(orig) super - @id = orig.id + @__id = orig.id ObjectSpace.call_finalizer orig - ID_MAP[@id] = self.id - ID_REV_MAP[self.id] = @id + ObjectSpace.call_finalizer self + ID_MAP[@__id] = self.id + ID_REV_MAP[self.id] = @__id end def __getobj__ - unless ID_MAP[@id] + unless ID_MAP[@__id] $@ = caller(1) $! = RefError.new("Illegal Reference - probably recycled") raise end - ObjectSpace.id2ref(@id) + ObjectSpace._id2ref(@__id) # ObjectSpace.each_object do |obj| -# return obj if obj.id == @id +# return obj if obj.id == @__id # end end def weakref_alive? - if ID_MAP[@id] + if ID_MAP[@__id] true else false @@ -62,9 +63,11 @@ class WeakRef<Delegator end end -foo = Object.new -p foo.hash -foo = WeakRef.new(foo) -p foo.hash -ObjectSpace.garbage_collect -p foo.hash +if __FILE__ == $0 + foo = Object.new + p foo.hash + foo = WeakRef.new(foo) + p foo.hash + ObjectSpace.garbage_collect + p foo.hash +end @@ -386,6 +386,7 @@ mod_clone(module) clone->super = RCLASS(module)->super; clone->iv_tbl = 0; clone->m_tbl = 0; /* avoid GC crashing */ + clone->iv_tbl = st_copy(RCLASS(module)->iv_tbl); clone->m_tbl = st_copy(RCLASS(module)->m_tbl); return (VALUE)clone; @@ -21,11 +21,7 @@ static VALUE range_check(args) VALUE *args; { - VALUE v = rb_funcall(args[0], rb_intern("<="), 1, args[1]); - - if (!RTEST(v)) { - Fail(""); /* no ascending values */ - } + rb_funcall(args[0], rb_intern("<=>"), 1, args[1]); return Qnil; } |