Skip to content

Commit

Permalink
* eval.c (mark_frame_adj): need to adjust argv pointer if using
Browse files Browse the repository at this point in the history
  system's alloca. [ruby-core:01503]

* io.c (rb_f_gets): should call next_argv() before type check
  current_file. [ruby-list:38336]

* eval.c (proc_invoke): should retrieve retval when pcall is true.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Sep 5, 2003
1 parent 4198feb commit c492b9b
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 28 deletions.
14 changes: 14 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ Thu Sep 4 12:54:50 2003 why the lucky stiff <[email protected]>
* ext/syck/token.c: headerless documents with root-level spacing now
honored.

Thu Sep 4 00:06:14 2003 Yukihiro Matsumoto <[email protected]>

* eval.c (mark_frame_adj): need to adjust argv pointer if using
system's alloca. [ruby-core:01503]

Wed Sep 3 21:33:20 2003 NAKAMURA, Hiroshi <[email protected]>

* test: add test directory. Test::Unit aware testcases and needed
Expand All @@ -112,11 +117,20 @@ Wed Sep 3 21:33:20 2003 NAKAMURA, Hiroshi <[email protected]>

* test/csv/*: add testcase for lib/csv.rb.

Wed Sep 3 01:37:09 2003 Yukihiro Matsumoto <[email protected]>

* io.c (rb_f_gets): should call next_argv() before type check
current_file. [ruby-list:38336]

Tue Sep 2 20:37:15 2003 GOTOU Yuuzou <[email protected]>

* ext/openssl/lib/net/protocols.rb (SSLIO#ssl_connect): warning
for skipping server verification.

Tue Sep 2 23:36:57 2003 Yukihiro Matsumoto <[email protected]>

* eval.c (proc_invoke): should retrieve retval when pcall is true.

Tue Sep 2 14:09:20 2003 Yukihiro Matsumoto <[email protected]>

* ext/socket/extconf.rb: check s6_addr8 in in6_addr (Tru64 UNIX).
Expand Down
27 changes: 13 additions & 14 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,17 +1095,16 @@ rb_ary_reverse(ary)
VALUE tmp;

rb_ary_modify(ary);
if (RARRAY(ary)->len <= 1) return ary;

p1 = RARRAY(ary)->ptr;
p2 = p1 + RARRAY(ary)->len - 1; /* points last item */

while (p1 < p2) {
tmp = *p1;
*p1++ = *p2;
*p2-- = tmp;
if (RARRAY(ary)->len > 1) {
p1 = RARRAY(ary)->ptr;
p2 = p1 + RARRAY(ary)->len - 1; /* points last item */

while (p1 < p2) {
tmp = *p1;
*p1++ = *p2;
*p2-- = tmp;
}
}

return ary;
}

Expand Down Expand Up @@ -1173,10 +1172,10 @@ rb_ary_sort_bang(ary)
VALUE ary;
{
rb_ary_modify(ary);
if (RARRAY(ary)->len <= 1) return ary;

FL_SET(ary, ARY_TMPLOCK); /* prohibit modification during sort */
rb_ensure(sort_internal, ary, sort_unlock, ary);
if (RARRAY(ary)->len > 1) {
FL_SET(ary, ARY_TMPLOCK); /* prohibit modification during sort */
rb_ensure(sort_internal, ary, sort_unlock, ary);
}
return ary;
}

Expand Down
27 changes: 23 additions & 4 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -7023,7 +7023,7 @@ proc_invoke(proc, args, self, klass)
proc_set_safe_level(proc);
result = rb_yield_0(args, self, self!=Qundef?CLASS_OF(self):0, pcall, Qtrue);
}
else if (TAG_DST()) {
else if (pcall || TAG_DST()) {
result = prot_tag->retval;
}
POP_TAG();
Expand Down Expand Up @@ -8043,6 +8043,25 @@ timeofday()

#define STACK(addr) (th->stk_pos<(VALUE*)(addr) && (VALUE*)(addr)<th->stk_pos+th->stk_len)
#define ADJ(addr) (void*)(STACK(addr)?(((VALUE*)(addr)-th->stk_pos)+th->stk_ptr):(VALUE*)(addr))
#ifdef C_ALLOCA
# define MARK_FRAME_ADJ(f) rb_gc_mark_frame(f)
#else
# define MARK_FRAME_ADJ(f) mark_frame_adj(f, th)
static void
mark_frame_adj(frame, th)
struct FRAME *frame;
rb_thread_t th;
{
if (frame->flags & FRAME_MALLOC) {
rb_gc_mark_locations(frame->argv, frame->argv+frame->argc);
}
else {
VALUE *start = ADJ(frame->argv);
rb_gc_mark_locations(start, start+frame->argc);
}
rb_gc_mark((VALUE)frame->node);
}
#endif

static void
thread_mark(th)
Expand Down Expand Up @@ -8084,13 +8103,13 @@ thread_mark(th)
frame = th->frame;
while (frame && frame != top_frame) {
frame = ADJ(frame);
rb_gc_mark_frame(frame);
MARK_FRAME_ADJ(frame);
if (frame->tmp) {
struct FRAME *tmp = frame->tmp;

while (tmp && tmp != top_frame) {
tmp = ADJ(tmp);
rb_gc_mark_frame(tmp);
MARK_FRAME_ADJ(tmp);
tmp = tmp->prev;
}
}
Expand All @@ -8099,7 +8118,7 @@ thread_mark(th)
block = th->block;
while (block) {
block = ADJ(block);
rb_gc_mark_frame(&block->frame);
MARK_FRAME_ADJ(&block->frame);
block = block->prev;
}
}
Expand Down
2 changes: 1 addition & 1 deletion io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3115,8 +3115,8 @@ rb_f_gets(argc, argv)
{
VALUE line;

if (!next_argv()) return Qnil;
if (TYPE(current_file) != T_FILE) {
if (!next_argv()) return Qnil;
line = rb_funcall3(current_file, rb_intern("gets"), argc, argv);
}
else {
Expand Down
18 changes: 9 additions & 9 deletions string.c
Original file line number Diff line number Diff line change
Expand Up @@ -1807,16 +1807,16 @@ rb_str_reverse_bang(str)
char *s, *e;
char c;

if (RSTRING(str)->len <= 1) return Qnil;
rb_str_modify(str);
s = RSTRING(str)->ptr;
e = s + RSTRING(str)->len - 1;
while (s < e) {
c = *s;
*s++ = *e;
*e-- = c;
if (RSTRING(str)->len > 1) {
rb_str_modify(str);
s = RSTRING(str)->ptr;
e = s + RSTRING(str)->len - 1;
while (s < e) {
c = *s;
*s++ = *e;
*e-- = c;
}
}

return str;
}

Expand Down

0 comments on commit c492b9b

Please sign in to comment.