summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-02 12:19:30 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-02 12:19:30 +0000
commit10c4364287e67e8d74d28f90c72b667aa8d8be3b (patch)
treee76417887fb3e3fe98f895eac82cfbd1ff060953
parentd92e76de6451d13ae4d22be61f3a9e21bebfa775 (diff)
* 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
-rw-r--r--ChangeLog11
-rw-r--r--gc.c5
-rw-r--r--intern.h1
-rw-r--r--parse.y10
-rw-r--r--ruby.c5
5 files changed, 29 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index af8c37596e..9b2836eaee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* config.guess: fixed for Linux/PPC.
diff --git a/gc.c b/gc.c
index 1503d42a74..e5ecea76f4 100644
--- a/gc.c
+++ b/gc.c
@@ -863,8 +863,9 @@ gc_sweep()
int freed = 0;
int i, used = heaps_used;
- if (ruby_in_compile) {
- /* should not reclaim nodes during compilation */
+ if (ruby_in_compile && ruby_parser_stack_on_heap()) {
+ /* should not reclaim nodes during compilation
+ if yacc's semantic stack is not allocated on machine stack */
for (i = 0; i < used; i++) {
p = heaps[i]; pend = p + heaps_limits[i];
while (p < pend) {
diff --git a/intern.h b/intern.h
index 59fcfa67fc..afc902d267 100644
--- a/intern.h
+++ b/intern.h
@@ -291,6 +291,7 @@ int yyparse _((void));
ID rb_id_attrset _((ID));
void rb_parser_append_print _((void));
void rb_parser_while_loop _((int, int));
+int ruby_parser_stack_on_heap _((void));
int rb_is_const_id _((ID));
int rb_is_instance_id _((ID));
int rb_is_class_id _((ID));
diff --git a/parse.y b/parse.y
index 0ba14a1c73..661188e95d 100644
--- a/parse.y
+++ b/parse.y
@@ -5341,6 +5341,16 @@ dyna_in_block()
return (lvtbl->dlev > 0);
}
+int
+ruby_parser_stack_on_heap()
+{
+#if defined(YYBISON) && !defined(C_ALLOCA)
+ return Qfalse;
+#else
+ return Qtrue;
+#endif
+}
+
void
rb_parser_append_print()
{
diff --git a/ruby.c b/ruby.c
index 8aa20ce11e..dfaa2e1c9c 100644
--- a/ruby.c
+++ b/ruby.c
@@ -856,7 +856,10 @@ load_file(fname, script)
else if (f != rb_stdin) {
rb_io_close(f);
}
- rb_gc();
+
+ if (ruby_parser_stack_on_heap()) {
+ rb_gc();
+ }
}
void