From 3259145c33c7e44e207f57c5101460ddaf79b47a Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 16 Jun 2004 07:01:32 +0000 Subject: * gc.c (stack_grow_direction): memoize the direction. * gc.c (Init_stack): should always move to end of VALUE. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@6461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 14 ++++++++++---- gc.c | 11 +++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 207bdaf93..5544bd83a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Jun 16 16:01:17 2004 Nobuyoshi Nakada + + * 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 * ext/tk/lib/tk.rb: bug fix (TkWindow#grab) @@ -50,14 +56,14 @@ Thu Jun 10 19:19:41 2004 Yukihiro Matsumoto [ruby-talk:103062] Wed Jun 9 18:04:14 2004 akira yamada - + * 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. - + Wed Jun 9 17:39:37 2004 Akinori MUSHA * config.guess, config.sub: Update to a more recent version as of @@ -146,7 +152,7 @@ Thu May 27 23:15:18 2004 NAKAMURA, Hiroshi Thu May 27 21:37:50 2004 Tanaka Akira - * lib/pathname.rb (Pathname#initialize): refine pathname initialization + * lib/pathname.rb (Pathname#initialize): refine pathname initialization by pathname. Thu May 27 20:22:05 Hirokazu Yamamoto diff --git a/gc.c b/gc.c index 24ac61dfb..ce3d72645 100644 --- a/gc.c +++ b/gc.c @@ -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 @@ -1411,10 +1413,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; } -- cgit