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

ruby-changes:31973

From: charliesome <ko1@a...>
Date: Sun, 8 Dec 2013 09:41:12 +0900 (JST)
Subject: [ruby-changes:31973] charliesome:r44052 (trunk): * array.c (rb_ary_or): use RHASH_TBL_RAW instead of RHASH_TBL

charliesome	2013-12-08 09:41:01 +0900 (Sun, 08 Dec 2013)

  New Revision: 44052

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

  Log:
    * array.c (rb_ary_or): use RHASH_TBL_RAW instead of RHASH_TBL
    
    * process.c (rb_execarg_fixup): use RHASH_TBL_RAW and insert write
      barriers where appropriate
    
    * vm.c (kwmerge_i): use RHASH_TBL_RAW
    
    * vm.c (HASH_ASET): use rb_hash_aset instead of calling directly into
      st_insert

  Modified files:
    trunk/ChangeLog
    trunk/array.c
    trunk/process.c
    trunk/vm.c
Index: array.c
===================================================================
--- array.c	(revision 44051)
+++ array.c	(revision 44052)
@@ -4058,7 +4058,7 @@ rb_ary_or(VALUE ary1, VALUE ary2) https://github.com/ruby/ruby/blob/trunk/array.c#L4058
 
     for (i=0; i<RARRAY_LEN(ary2); i++) {
 	VALUE elt = RARRAY_AREF(ary2, i);
-	if (!st_update(RHASH_TBL(hash), (st_data_t)elt, ary_hash_orset, (st_data_t)elt)) {
+	if (!st_update(RHASH_TBL_RAW(hash), (st_data_t)elt, ary_hash_orset, (st_data_t)elt)) {
 	    OBJ_WRITTEN(hash, Qundef, elt);
 	}
     }
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44051)
+++ ChangeLog	(revision 44052)
@@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Dec  8 09:40:00 2013  Charlie Somerville  <charliesome@r...>
+
+	* array.c (rb_ary_or): use RHASH_TBL_RAW instead of RHASH_TBL
+
+	* process.c (rb_execarg_fixup): use RHASH_TBL_RAW and insert write
+	  barriers where appropriate
+
+	* vm.c (kwmerge_i): use RHASH_TBL_RAW
+
+	* vm.c (HASH_ASET): use rb_hash_aset instead of calling directly into
+	  st_insert
+
 Sat Dec  7 11:15:52 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* hash.c (rb_hash_reject): copy unrejected elements only to new hash,
Index: process.c
===================================================================
--- process.c	(revision 44051)
+++ process.c	(revision 44052)
@@ -2316,24 +2316,26 @@ rb_execarg_fixup(VALUE execarg_obj) https://github.com/ruby/ruby/blob/trunk/process.c#L2316
         }
         hide_obj(envtbl);
         if (envopts != Qfalse) {
-            st_table *stenv = RHASH_TBL(envtbl);
+	    st_table *stenv = RHASH_TBL_RAW(envtbl);
             long i;
             for (i = 0; i < RARRAY_LEN(envopts); i++) {
                 VALUE pair = RARRAY_AREF(envopts, i);
                 VALUE key = RARRAY_AREF(pair, 0);
                 VALUE val = RARRAY_AREF(pair, 1);
                 if (NIL_P(val)) {
-                    st_data_t stkey = (st_data_t)key;
-                    st_delete(stenv, &stkey, NULL);
+		    st_data_t stkey = (st_data_t)key;
+		    st_delete(stenv, &stkey, NULL);
                 }
                 else {
-                    st_insert(stenv, (st_data_t)key, (st_data_t)val);
+		    st_insert(stenv, (st_data_t)key, (st_data_t)val);
+		    OBJ_WRITTEN(envtbl, Qundef, key);
+		    OBJ_WRITTEN(envtbl, Qundef, val);
                 }
             }
         }
         envp_buf = rb_str_buf_new(0);
         hide_obj(envp_buf);
-        st_foreach(RHASH_TBL(envtbl), fill_envp_buf_i, (st_data_t)envp_buf);
+        st_foreach(RHASH_TBL_RAW(envtbl), fill_envp_buf_i, (st_data_t)envp_buf);
         envp_str = rb_str_buf_new(sizeof(char*) * (RHASH_SIZE(envtbl) + 1));
         hide_obj(envp_str);
         p = RSTRING_PTR(envp_buf);
Index: vm.c
===================================================================
--- vm.c	(revision 44051)
+++ vm.c	(revision 44052)
@@ -2212,7 +2212,7 @@ static int https://github.com/ruby/ruby/blob/trunk/vm.c#L2212
 kwmerge_i(VALUE key, VALUE value, VALUE hash)
 {
     if (!SYMBOL_P(key)) Check_Type(key, T_SYMBOL);
-    if (st_update(RHASH_TBL(hash), key, kwmerge_ii, (st_data_t)value) == 0) { /* !existing */
+    if (st_update(RHASH_TBL_RAW(hash), key, kwmerge_ii, (st_data_t)value) == 0) { /* !existing */
 	OBJ_WRITTEN(hash, Qundef, value);
     }
     return ST_CONTINUE;
@@ -2675,7 +2675,7 @@ VALUE rb_insn_operand_intern(rb_iseq_t * https://github.com/ruby/ruby/blob/trunk/vm.c#L2675
 
 #if VM_COLLECT_USAGE_DETAILS
 
-#define HASH_ASET(h, k, v) st_insert(RHASH_TBL(h), (st_data_t)(k), (st_data_t)(v))
+#define HASH_ASET(h, k, v) rb_hash_aset((h), (st_data_t)(k), (st_data_t)(v))
 
 /* uh = {
  *   insn(Fixnum) => ihash(Hash)

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

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