summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-03 03:38:10 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-03 03:38:10 (GMT)
commit876bfc6b4ee6c0ddacbeff328dc428889d789a6b (patch)
tree88bb8bfaea318a50351ce4db76ac08683214eb95
parent255adda52fcd161f62fd75eec9504200e6b6eea8 (diff)
Init functions don't need ID caches
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--class.c2
-rw-r--r--enumerator.c1
-rw-r--r--error.c2
-rw-r--r--gc.c1
-rw-r--r--random.c9
-rw-r--r--signal.c2
-rw-r--r--struct.c10
-rw-r--r--transcode.c15
-rw-r--r--variable.c8
9 files changed, 37 insertions, 13 deletions
diff --git a/class.c b/class.c
index feeed88..ae056d1 100644
--- a/class.c
+++ b/class.c
@@ -539,7 +539,7 @@ Init_class_hierarchy(void)
rb_cModule = boot_defclass("Module", rb_cObject);
rb_cClass = boot_defclass("Class", rb_cModule);
- rb_const_set(rb_cObject, rb_intern("BasicObject"), rb_cBasicObject);
+ rb_const_set(rb_cObject, rb_intern_const("BasicObject"), rb_cBasicObject);
RBASIC_SET_CLASS(rb_cClass, rb_cClass);
RBASIC_SET_CLASS(rb_cModule, rb_cClass);
RBASIC_SET_CLASS(rb_cObject, rb_cClass);
diff --git a/enumerator.c b/enumerator.c
index d405c2a..bd75b00 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -2062,6 +2062,7 @@ InitVM_Enumerator(void)
rb_provide("enumerator.so"); /* for backward compatibility */
}
+#undef rb_intern
void
Init_Enumerator(void)
{
diff --git a/error.c b/error.c
index 71375c3..3c2b60b 100644
--- a/error.c
+++ b/error.c
@@ -1856,7 +1856,7 @@ Init_Exception(void)
rb_eLoadError = rb_define_class("LoadError", rb_eScriptError);
/* the path failed to load */
- rb_attr(rb_eLoadError, rb_intern("path"), 1, 0, Qfalse);
+ rb_attr(rb_eLoadError, rb_intern_const("path"), 1, 0, Qfalse);
rb_eNotImpError = rb_define_class("NotImplementedError", rb_eScriptError);
diff --git a/gc.c b/gc.c
index d07d9d3..661f100 100644
--- a/gc.c
+++ b/gc.c
@@ -7749,6 +7749,7 @@ rb_gcdebug_sentinel(VALUE obj, const char *name)
void
Init_GC(void)
{
+#undef rb_intern
VALUE rb_mObjSpace;
VALUE rb_mProfiler;
VALUE gc_constants;
diff --git a/random.c b/random.c
index 23e84ff..b631d77 100644
--- a/random.c
+++ b/random.c
@@ -1352,7 +1352,7 @@ rb_reset_random_seed(void)
*/
void
-Init_Random(void)
+InitVM_Random(void)
{
Init_RandomSeed2();
rb_define_global_function("srand", rb_f_srand, -1);
@@ -1383,7 +1383,14 @@ Init_Random(void)
rb_define_singleton_method(rb_cRandom, "new_seed", random_seed, 0);
rb_define_private_method(CLASS_OF(rb_cRandom), "state", random_s_state, 0);
rb_define_private_method(CLASS_OF(rb_cRandom), "left", random_s_left, 0);
+}
+#undef rb_intern
+void
+Init_Random(void)
+{
id_rand = rb_intern("rand");
id_bytes = rb_intern("bytes");
+
+ InitVM(Random);
}
diff --git a/signal.c b/signal.c
index f49bd2a..f6232fd 100644
--- a/signal.c
+++ b/signal.c
@@ -1312,7 +1312,7 @@ Init_signal(void)
rb_define_method(rb_eSignal, "initialize", esignal_init, -1);
rb_define_method(rb_eSignal, "signo", esignal_signo, 0);
- rb_alias(rb_eSignal, rb_intern("signm"), rb_intern("message"));
+ rb_alias(rb_eSignal, rb_intern_const("signm"), rb_intern_const("message"));
rb_define_method(rb_eInterrupt, "initialize", interrupt_init, -1);
install_sighandler(SIGINT, sighandler);
diff --git a/struct.c b/struct.c
index 0afc0a9..c71bef8 100644
--- a/struct.c
+++ b/struct.c
@@ -1064,7 +1064,7 @@ rb_struct_size(VALUE s)
* Symbol (<code>:name</code>).
*/
void
-Init_Struct(void)
+InitVM_Struct(void)
{
rb_cStruct = rb_define_class("Struct", rb_cObject);
rb_include_module(rb_cStruct, rb_mEnumerable);
@@ -1095,5 +1095,13 @@ Init_Struct(void)
rb_define_method(rb_cStruct, "values_at", rb_struct_values_at, -1);
rb_define_method(rb_cStruct, "members", rb_struct_members_m, 0);
+}
+
+#undef rb_intern
+void
+Init_Struct(void)
+{
id_members = rb_intern("__members__");
+
+ InitVM(Struct);
}
diff --git a/transcode.c b/transcode.c
index 0182a20..b640008 100644
--- a/transcode.c
+++ b/transcode.c
@@ -4388,13 +4388,10 @@ ecerr_incomplete_input(VALUE self)
* correspond with a known converter.
*/
+#undef rb_intern
void
Init_transcode(void)
{
- rb_eUndefinedConversionError = rb_define_class_under(rb_cEncoding, "UndefinedConversionError", rb_eEncodingError);
- rb_eInvalidByteSequenceError = rb_define_class_under(rb_cEncoding, "InvalidByteSequenceError", rb_eEncodingError);
- rb_eConverterNotFoundError = rb_define_class_under(rb_cEncoding, "ConverterNotFoundError", rb_eEncodingError);
-
transcoder_table = st_init_strcasetable();
sym_invalid = ID2SYM(rb_intern("invalid"));
@@ -4426,6 +4423,16 @@ Init_transcode(void)
sym_lf = ID2SYM(rb_intern("lf"));
#endif
+ InitVM(transcode);
+}
+
+void
+InitVM_transcode(void)
+{
+ rb_eUndefinedConversionError = rb_define_class_under(rb_cEncoding, "UndefinedConversionError", rb_eEncodingError);
+ rb_eInvalidByteSequenceError = rb_define_class_under(rb_cEncoding, "InvalidByteSequenceError", rb_eEncodingError);
+ rb_eConverterNotFoundError = rb_define_class_under(rb_cEncoding, "ConverterNotFoundError", rb_eEncodingError);
+
rb_define_method(rb_cString, "encode", str_encode, -1);
rb_define_method(rb_cString, "encode!", str_encode_bang, -1);
diff --git a/variable.c b/variable.c
index dac12ab..34528e8 100644
--- a/variable.c
+++ b/variable.c
@@ -27,13 +27,13 @@ void
Init_var_tables(void)
{
rb_global_tbl = st_init_numtable();
- CONST_ID(autoload, "__autoload__");
+ autoload = rb_intern_const("__autoload__");
/* __classpath__: fully qualified class path */
- CONST_ID(classpath, "__classpath__");
+ classpath = rb_intern_const("__classpath__");
/* __tmp_classpath__: temporary class path which contains anonymous names */
- CONST_ID(tmp_classpath, "__tmp_classpath__");
+ tmp_classpath = rb_intern_const("__tmp_classpath__");
/* __classid__: name given to class/module under an anonymous namespace */
- CONST_ID(classid, "__classid__");
+ classid = rb_intern_const("__classid__");
}
struct fc_result {