1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* gc.c (stack_grow_direction): memoize the direction.

* gc.c (Init_stack): should always move to end of VALUE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2004-06-16 07:01:32 +00:00
parent f895f94cce
commit 83c917df38
2 changed files with 14 additions and 5 deletions

View file

@ -1,3 +1,9 @@
Wed Jun 16 16:01:17 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (stack_grow_direction): memoize the direction.
* gc.c (Init_stack): should always move to end of VALUE.
Tue Jun 15 12:10:04 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: bug fix (TkWindow#grab)
@ -59,7 +65,7 @@ Wed Jun 9 16:09:01 2004 akira yamada <akira@ruby-lang.org>
* lib/uri/generic.rb (URI::Generic::merge,
URI::Generic::route_from): accepts non-hierarchical URI.
[ruby-dev:23631]
* test/uri/test_generic.rb (TestGeneric::test_route,
TestGeneric::test_merge): added tests for above changes.

11
gc.c
View file

@ -447,15 +447,17 @@ static unsigned int STACK_LEVEL_MAX = 655300;
#elif STACK_GROW_DIRECTION < 0
# define STACK_UPPER(x, a, b) b
#else
static int grow_direction;
static int
stack_growup_p(addr)
stack_grow_direction(addr)
VALUE *addr;
{
SET_STACK_END;
if (STACK_END > addr) return Qtrue;
return Qfalse;
if (STACK_END > addr) return grow_direction = 1;
return grow_direction = -1;
}
# define stack_growup_p(x) ((grow_direction ? grow_direction : stack_grow_direction(x)) > 0)
# define STACK_UPPER(x, a, b) (stack_growup_p(x) ? a : b)
#endif
@ -1410,10 +1412,11 @@ Init_stack(addr)
rb_gc_stack_start = _SEND;
#else
if (!addr) addr = (VALUE *)&addr;
STACK_UPPER(&addr, addr, ++addr);
if (rb_gc_stack_start) {
if (STACK_UPPER(&addr,
rb_gc_stack_start > addr,
rb_gc_stack_start < ++addr))
rb_gc_stack_start < addr))
rb_gc_stack_start = addr;
return;
}