[前][次][番号順一覧][スレッド一覧]

ruby-changes:34610

From: nobu <ko1@a...>
Date: Fri, 4 Jul 2014 16:31:01 +0900 (JST)
Subject: [ruby-changes:34610] nobu:r46691 (trunk): parse.y: remove global_symbols.op_sym

nobu	2014-07-04 16:30:11 +0900 (Fri, 04 Jul 2014)

  New Revision: 46691

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46691

  Log:
    parse.y: remove global_symbols.op_sym
    
    * parse.y (global_symbols): remove op_sym, cache by fstring
      instead.

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 46690)
+++ parse.y	(revision 46691)
@@ -10152,7 +10152,6 @@ static struct symbols { https://github.com/ruby/ruby/blob/trunk/parse.y#L10152
     st_table *sym_id;
     st_table *id_str;
     st_table *pinned_dsym;
-    VALUE op_sym[tLAST_OP_ID];
     int minor_marked;
     int pinned_dsym_minor_marked;
 } global_symbols = {tLAST_TOKEN};
@@ -10183,9 +10182,6 @@ rb_gc_mark_symbols(int full_mark) https://github.com/ruby/ruby/blob/trunk/parse.y#L10182
 {
     if (full_mark || global_symbols.minor_marked == 0) {
 	rb_mark_tbl(global_symbols.id_str);
-	rb_gc_mark_locations(global_symbols.op_sym,
-			     global_symbols.op_sym + numberof(global_symbols.op_sym));
-
 	if (!full_mark) global_symbols.minor_marked = 1;
     }
 
@@ -10797,27 +10793,14 @@ rb_id2str(ID id) https://github.com/ruby/ruby/blob/trunk/parse.y#L10793
 	int i = 0;
 
 	if (id < INT_MAX && rb_ispunct((int)id)) {
-	    VALUE str = global_symbols.op_sym[i = (int)id];
-	    if (!str) {
-		char name[2];
-		name[0] = (char)id;
-		name[1] = 0;
-		str = rb_fstring_new(name, 1);
-		global_symbols.op_sym[i] = str;
-		global_symbols.minor_marked = 0;
-	    }
-	    return str;
+	    char name[1];
+	    name[0] = (char)id;
+	    return rb_fstring_new(name, 1);
 	}
 	for (i = 0; i < op_tbl_count; i++) {
 	    if (op_tbl[i].token == id) {
-		VALUE str = global_symbols.op_sym[i];
-		if (!str) {
-		    const char *name = op_tbl[i].name;
-		    str = rb_fstring_new(name, op_tbl_len(i));
-		    global_symbols.op_sym[i] = str;
-		    global_symbols.minor_marked = 0;
-		}
-		return str;
+		const char *name = op_tbl[i].name;
+		return rb_fstring_new(name, op_tbl_len(i));
 	    }
 	}
     }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]