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

* configure.in (rb_cv_stack_end_address): detect stack end address

variable supplied by system.  [ruby-core:03115]

* gc.c (Init_stack): use system provided address if possible.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2004-07-08 10:27:23 +00:00
parent 4e7110d435
commit aa4878589c
3 changed files with 34 additions and 4 deletions

View file

@ -1,3 +1,10 @@
Thu Jul 8 19:27:16 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (rb_cv_stack_end_address): detect stack end address
variable supplied by system. [ruby-core:03115]
* gc.c (Init_stack): use system provided address if possible.
Thu Jul 8 00:05:23 2004 akira yamada <akira@ruby-lang.org>
* lib/tempfile.rb (Tempfile::initialize): got out code of

View file

@ -389,6 +389,18 @@ AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV
AC_CACHE_CHECK(for stack end address, rb_cv_stack_end_address,
[rb_cv_stack_end_address=no
for addr in __libc_stack_end _SEND; do
AC_TRY_LINK(
[extern void *$addr;],
[if (!$addr) return 1;],
[rb_cv_stack_end_address="$addr"; break])
done])
if test $rb_cv_stack_end_address != no; then
AC_DEFINE_UNQUOTED(STACK_END_ADDRESS, $rb_cv_stack_end_address)
fi
dnl Checks for library functions.
AC_TYPE_GETGROUPS
AC_TYPE_SIGNAL

17
gc.c
View file

@ -44,6 +44,10 @@ extern unsigned long __libc_ia64_register_backing_store_base;
#endif
#endif
#if defined _WIN32 || defined __CYGWIN__
#include <windows.h>
#endif
void re_free_registers _((struct re_registers*));
int rb_io_fptr_finalize _((struct OpenFile*));
@ -1408,9 +1412,16 @@ void
Init_stack(addr)
VALUE *addr;
{
#if defined(__human68k__)
extern void *_SEND;
rb_gc_stack_start = _SEND;
#if defined(_WIN32) || defined(__CYGWIN__)
MEMORY_BASIC_INFORMATION m;
memset(&m, 0, sizeof(m));
VirtualQuery(&m, &m, sizeof(m));
rb_gc_stack_start =
STACK_UPPER((VALUE *)&m, (VALUE *)m.BaseAddress,
(VALUE *)((char *)m.BaseAddress + m.RegionSize) - 1);
#elif defined(STACK_END_ADDRESS)
extern void *STACK_END_ADDRESS;
rb_gc_stack_start = STACK_END_ADDRESS;
#else
if (!addr) addr = (VALUE *)&addr;
STACK_UPPER(&addr, addr, ++addr);