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

* gc.c (gc_sweep): does reclaim nodes in also compile time, if we can.

* ruby.c (load_file): omit GC if we can.
* parse.y (ruby_parser_stack_on_heap): new function.
* intern.h (ruby_parser_stack_on_heap): added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2002-09-02 12:19:30 +00:00
parent d92e76de64
commit 10c4364287
5 changed files with 29 additions and 3 deletions

View file

@ -1,3 +1,14 @@
Mon Sep 2 21:21:46 2002 Minero Aoki <aamine@loveruby.net>
* gc.c (gc_sweep): does reclaim nodes in also compile time, if we
can.
* ruby.c (load_file): omit GC if we can.
* parse.y (ruby_parser_stack_on_heap): new function.
* intern.h (ruby_parser_stack_on_heap): added.
Sun Sep 1 15:54:33 2002 WATANABE Hirofumi <eban@ruby-lang.org> Sun Sep 1 15:54:33 2002 WATANABE Hirofumi <eban@ruby-lang.org>
* config.guess: fixed for Linux/PPC. * config.guess: fixed for Linux/PPC.

5
gc.c
View file

@ -863,8 +863,9 @@ gc_sweep()
int freed = 0; int freed = 0;
int i, used = heaps_used; int i, used = heaps_used;
if (ruby_in_compile) { if (ruby_in_compile && ruby_parser_stack_on_heap()) {
/* should not reclaim nodes during compilation */ /* should not reclaim nodes during compilation
if yacc's semantic stack is not allocated on machine stack */
for (i = 0; i < used; i++) { for (i = 0; i < used; i++) {
p = heaps[i]; pend = p + heaps_limits[i]; p = heaps[i]; pend = p + heaps_limits[i];
while (p < pend) { while (p < pend) {

View file

@ -291,6 +291,7 @@ int yyparse _((void));
ID rb_id_attrset _((ID)); ID rb_id_attrset _((ID));
void rb_parser_append_print _((void)); void rb_parser_append_print _((void));
void rb_parser_while_loop _((int, int)); void rb_parser_while_loop _((int, int));
int ruby_parser_stack_on_heap _((void));
int rb_is_const_id _((ID)); int rb_is_const_id _((ID));
int rb_is_instance_id _((ID)); int rb_is_instance_id _((ID));
int rb_is_class_id _((ID)); int rb_is_class_id _((ID));

10
parse.y
View file

@ -5341,6 +5341,16 @@ dyna_in_block()
return (lvtbl->dlev > 0); return (lvtbl->dlev > 0);
} }
int
ruby_parser_stack_on_heap()
{
#if defined(YYBISON) && !defined(C_ALLOCA)
return Qfalse;
#else
return Qtrue;
#endif
}
void void
rb_parser_append_print() rb_parser_append_print()
{ {

3
ruby.c
View file

@ -856,8 +856,11 @@ load_file(fname, script)
else if (f != rb_stdin) { else if (f != rb_stdin) {
rb_io_close(f); rb_io_close(f);
} }
if (ruby_parser_stack_on_heap()) {
rb_gc(); rb_gc();
} }
}
void void
rb_load_file(fname) rb_load_file(fname)