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

ruby-changes:35230

From: normal <ko1@a...>
Date: Fri, 29 Aug 2014 16:22:38 +0900 (JST)
Subject: [ruby-changes:35230] normal:r47312 (trunk): string.c: remove vm_core.h dependency

normal	2014-08-29 16:22:23 +0900 (Fri, 29 Aug 2014)

  New Revision: 47312

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

  Log:
    string.c: remove vm_core.h dependency [ruby-core:64627]
    
    * string.c: revert part of r47311, add rb_vm_fstring_table(),
      remove vm_core.h dependency. [ruby-core:64627]

  Modified files:
    trunk/ChangeLog
    trunk/common.mk
    trunk/string.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47311)
+++ ChangeLog	(revision 47312)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Aug 29 16:18:26 2014  Eric Wong  <e@8...>
+
+	* string.c: revert part of r47311, add rb_vm_fstring_table(),
+	  remove vm_core.h dependency. [ruby-core:64627]
+
 Fri Aug 29 15:17:13 2014  Eric Wong  <e@8...>
 
 	* string.c: remove static frozen_strings
Index: string.c
===================================================================
--- string.c	(revision 47311)
+++ string.c	(revision 47312)
@@ -17,7 +17,6 @@ https://github.com/ruby/ruby/blob/trunk/string.c#L17
 #include "internal.h"
 #include "probes.h"
 #include "gc.h"
-#include "vm_core.h"
 #include <assert.h>
 
 #define BEG(no) (regs->beg[(no)])
@@ -177,6 +176,15 @@ mustnot_broken(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L176
 
 static int fstring_cmp(VALUE a, VALUE b);
 
+/* in case we restart MVM development, this needs to be per-VM */
+static st_table* frozen_strings;
+
+static inline st_table*
+rb_vm_fstring_table(void)
+{
+    return frozen_strings;
+}
+
 static const struct st_hash_type fstring_hash_type = {
     fstring_cmp,
     rb_str_hash,
@@ -227,7 +235,7 @@ rb_fstring(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L235
 
     do {
 	ret = str;
-	st_update(GET_VM()->frozen_strings, (st_data_t)str,
+	st_update(rb_vm_fstring_table(), (st_data_t)str,
 		    fstr_update_callback, (st_data_t)&ret);
     } while (ret == Qundef);
 
@@ -949,7 +957,7 @@ rb_str_free(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L957
 {
     if (FL_TEST(str, RSTRING_FSTR)) {
 	st_data_t fstr = (st_data_t)str;
-	st_delete(GET_VM()->frozen_strings, &fstr, NULL);
+	st_delete(rb_vm_fstring_table(), &fstr, NULL);
     }
 
     if (!STR_EMBED_P(str) && !FL_TEST(str, STR_SHARED)) {
@@ -8947,13 +8955,13 @@ Init_String(void) https://github.com/ruby/ruby/blob/trunk/string.c#L8955
 
     rb_define_method(rb_cSymbol, "encoding", sym_encoding, 0);
 
-    assert(GET_VM()->frozen_strings);
-    st_foreach(GET_VM()->frozen_strings, fstring_set_class_i, rb_cString);
+    assert(rb_vm_fstring_table());
+    st_foreach(rb_vm_fstring_table(), fstring_set_class_i, rb_cString);
 }
 
 void
 Init_frozen_strings(void)
 {
-    assert(!GET_VM()->frozen_strings);
-    GET_VM()->frozen_strings = st_init_table(&fstring_hash_type);
+    assert(!frozen_strings);
+    frozen_strings = st_init_table(&fstring_hash_type);
 }
Index: common.mk
===================================================================
--- common.mk	(revision 47311)
+++ common.mk	(revision 47312)
@@ -778,7 +778,7 @@ strftime.$(OBJEXT): {$(VPATH)}strftime.c https://github.com/ruby/ruby/blob/trunk/common.mk#L778
   {$(VPATH)}timev.h $(ENCODING_H_INCLUDES)
 string.$(OBJEXT): {$(VPATH)}string.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h {$(VPATH)}gc.h \
   {$(VPATH)}regex.h $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h \
-  $(PROBES_H_INCLUDES) $(VM_CORE_H_INCLUDES)
+  $(PROBES_H_INCLUDES)
 struct.$(OBJEXT): {$(VPATH)}struct.c $(RUBY_H_INCLUDES) {$(VPATH)}internal.h
 symbol.$(OBJEXT): {$(VPATH)}symbol.c $(RUBY_H_INCLUDES) $(ENCODING_H_INCLUDES) \
   {$(VPATH)}internal.h {$(VPATH)}node.h {$(VPATH)}id.h {$(VPATH)}symbol.h \

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

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