[#41120] ActiveScriptRuby で Racc をインストールできない — "conundrum /" <conundrum@...>

conundrumです。

11 messages 2005/09/09

[#41157] RD と rdoc に関する newbie な質問 — "conundrum /" <conundrum@...>

conundrumです。

13 messages 2005/09/19
[#41158] Re: RD と rdoc に関する newbie な質問 — rubikitch <rubikitch@...> 2005/09/19

From: "conundrum /" <conundrum@hotmail.co.jp>

[#41159] Re: RD と rdoc に関する newbie な質問 — "conundrum /" <conundrum@...> 2005/09/19

conundrumです。るびきちさん、直々の回答ありがとうございます。

[ruby-list:41204] Re: ruby 1.8.3がtDiary 2.0.2でSEGV

From: nobuyoshi nakada <nobuyoshi.nakada@...>
Date: 2005-09-30 05:58:16 UTC
List: ruby-list #41204
なかだです。

At Fri, 30 Sep 2005 10:39:14 +0900,
Tanaka Akira wrote in [ruby-list:41201]:
> > とりあえず Guy Decox の [ruby-core:6083] と同様な対処を試すのがいい気
> > がします。
> 
> う、間違えました。Guy Decoux でした。

これでどうでしょうか。

# どうもbison 2.1はpure_parserでないとコンパイルできないソース
# を作ってくれるようなんですが。


Index: gc.c
===================================================================
RCS file: /cvs/ruby/src/ruby/gc.c,v
retrieving revision 1.168.2.25
diff -U2 -p -r1.168.2.25 gc.c
--- gc.c	27 Jul 2005 14:29:11 -0000	1.168.2.25
+++ gc.c	30 Sep 2005 05:31:51 -0000
@@ -881,5 +881,4 @@ gc_mark_children(ptr, lev)
 	  case NODE_POSTEXE:
 	    break;
-#ifdef C_ALLOCA
 	  case NODE_ALLOCA:
 	    mark_locations_array((VALUE*)obj->as.node.u1.value,
@@ -887,5 +886,4 @@ gc_mark_children(ptr, lev)
 	    ptr = (VALUE)obj->as.node.u2.node;
 	    goto again;
-#endif
 
 	  default:		/* unlisted NODE */
@@ -1231,9 +1229,7 @@ obj_free(obj)
 	    }
 	    break;
-#ifdef C_ALLOCA
 	  case NODE_ALLOCA:
 	    RUBY_CRITICAL(free(RANY(obj)->as.node.u1.node));
 	    break;
-#endif
 	}
 	return;			/* no need to free iv_tbl */
Index: node.h
===================================================================
RCS file: /cvs/ruby/src/ruby/node.h,v
retrieving revision 1.50.2.3
diff -U2 -p -r1.50.2.3 node.h
--- node.h	22 Mar 2005 08:35:23 -0000	1.50.2.3
+++ node.h	30 Sep 2005 05:31:22 -0000
@@ -116,7 +116,5 @@ enum node_type {
     NODE_NEWLINE,
     NODE_POSTEXE,
-#ifdef C_ALLOCA
     NODE_ALLOCA,
-#endif
     NODE_DMETHOD,
     NODE_BMETHOD,
Index: parse.y
===================================================================
RCS file: /cvs/ruby/src/ruby/parse.y,v
retrieving revision 1.307.2.15
diff -U2 -p -r1.307.2.15 parse.y
--- parse.y	11 May 2005 16:21:33 -0000	1.307.2.15
+++ parse.y	30 Sep 2005 05:50:39 -0000
@@ -14,4 +14,5 @@
 
 #define YYDEBUG 1
+#define YYERROR_VERBOSE 1
 
 #include "ruby.h"
@@ -24,4 +25,15 @@
 #include <ctype.h>
 
+#if !defined(YYBISON) || ((defined(YYBISON_VERSION) || defined(YYSTACK_USE_ALLOCA)) && !YYSTACK_USE_ALLOCA)
+#define YYMALLOC rb_parser_malloc
+#define YYFREE   rb_parser_free
+#ifndef YYBISON_VERSION
+#define malloc YYMALLOC
+#define free   YYFREE
+#endif
+void *rb_parser_malloc _((size_t));
+void rb_parser_free _((void *));
+#endif
+
 #define yyparse ruby_yyparse
 #define yylex ruby_yylex
@@ -2529,4 +2541,5 @@ int ruby__end__seen;
 
 static VALUE ruby_debug_lines;
+static NODE *parser_heap;
 
 static NODE*
@@ -2568,4 +2581,5 @@ yycompile(f, line)
     ruby_current_node = 0;
     ruby_sourcefile = rb_source_filename(f);
+    parser_heap = 0;
     n = yyparse();
     ruby_debug_lines = 0;
@@ -2579,4 +2593,5 @@ yycompile(f, line)
     in_def = 0;
     cur_mid = 0;
+    parser_heap = 0;
 
     vp = ruby_dyna_vars;
@@ -5727,5 +5742,5 @@ int
 ruby_parser_stack_on_heap()
 {
-#if defined(YYBISON) && !defined(C_ALLOCA)
+#if defined(YYMALLOC)
     return Qfalse;
 #else
@@ -5744,4 +5759,5 @@ rb_gc_mark_parser()
     rb_gc_mark(lex_input);
     rb_gc_mark((VALUE)lex_strterm);
+    rb_gc_mark((VALUE)heap);
 }
 
@@ -6086,2 +6102,30 @@ rb_lastline_set(val)
     }
 }
+
+void *
+rb_parser_malloc(size)
+    size_t size;
+{
+    void *ptr = xmalloc(size);
+    size_t cnt = size % sizeof(YYSTYPE) ? 0 : size / sizeof(YYSTYPE);
+
+    heap = rb_node_newnode(NODE_ALLOCA, (VALUE)ptr, (VALUE)heap, cnt);
+    return ptr;
+}
+
+void
+rb_parser_free(ptr)
+    void *ptr;
+{
+    NODE **prev = &heap, *n;
+
+    while (n = *prev) {
+	if (n->u1.node == ptr) {
+	    *prev = n->u2.node;
+	    rb_gc_force_recycle((VALUE)n);
+	    break;
+	}
+	prev = &n->u2.node;
+    }
+    xfree(ptr);
+}


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread