summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--class.c4
-rw-r--r--common.mk5
-rw-r--r--defs/id.def11
-rw-r--r--object.c23
-rw-r--r--proc.c3
-rw-r--r--variable.c3
-rw-r--r--vm_method.c20
-rw-r--r--vm_trace.c2
9 files changed, 41 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ada4d4..6f9b737 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu May 2 16:54:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * defs/id.def: add more predefined IDs used in core.
+
Thu May 2 13:42:42 2013 Ryan Davis <ryand-ruby@zenspider.com>
* lib/minitest/*: Imported minitest 4.7.4 (r8483)
diff --git a/class.c b/class.c
index 043abe3..9d333fd 100644
--- a/class.c
+++ b/class.c
@@ -32,7 +32,7 @@
#include <ctype.h>
extern st_table *rb_class_tbl;
-static ID id_attached;
+#define id_attached id__attached__
/**
* Allocates a struct RClass for a new class.
@@ -400,8 +400,6 @@ boot_defclass(const char *name, VALUE super)
void
Init_class_hierarchy(void)
{
- id_attached = rb_intern("__attached__");
-
rb_cBasicObject = boot_defclass("BasicObject", 0);
rb_cObject = boot_defclass("Object", rb_cBasicObject);
rb_cModule = boot_defclass("Module", rb_cObject);
diff --git a/common.mk b/common.mk
index b7f2c7e..ebcf24e 100644
--- a/common.mk
+++ b/common.mk
@@ -696,7 +696,8 @@ node.$(OBJEXT): {$(VPATH)}node.c $(RUBY_H_INCLUDES) \
numeric.$(OBJEXT): {$(VPATH)}numeric.c $(RUBY_H_INCLUDES) \
{$(VPATH)}util.h $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h {$(VPATH)}id.h
object.$(OBJEXT): {$(VPATH)}object.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
- {$(VPATH)}internal.h {$(VPATH)}constant.h $(ENCODING_H_INCLUDES) $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h
+ {$(VPATH)}internal.h {$(VPATH)}constant.h $(ENCODING_H_INCLUDES) $(PROBES_H_INCLUDES) \
+ {$(VPATH)}vm_opts.h {$(VPATH)}id.h
pack.$(OBJEXT): {$(VPATH)}pack.c $(RUBY_H_INCLUDES) {$(VPATH)}encoding.h \
{$(VPATH)}oniguruma.h {$(VPATH)}internal.h
parse.$(OBJEXT): {$(VPATH)}parse.c $(RUBY_H_INCLUDES) {$(VPATH)}node.h \
@@ -761,7 +762,7 @@ time.$(OBJEXT): {$(VPATH)}time.c $(RUBY_H_INCLUDES) \
util.$(OBJEXT): {$(VPATH)}util.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
{$(VPATH)}internal.h
variable.$(OBJEXT): {$(VPATH)}variable.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}node.h {$(VPATH)}util.h {$(VPATH)}encoding.h \
+ {$(VPATH)}node.h {$(VPATH)}util.h {$(VPATH)}encoding.h {$(VPATH)}id.h \
{$(VPATH)}oniguruma.h {$(VPATH)}internal.h {$(VPATH)}constant.h
version.$(OBJEXT): {$(VPATH)}version.c $(RUBY_H_INCLUDES) \
$(srcdir)/include/ruby/version.h $(srcdir)/version.h $(srcdir)/revision.h {$(VPATH)}config.h \
diff --git a/defs/id.def b/defs/id.def
index 91c4110..57c0ae9 100644
--- a/defs/id.def
+++ b/defs/id.def
@@ -1,7 +1,16 @@
# -*- mode: ruby; coding: us-ascii -*-
firstline, predefined = __LINE__+1, %[\
+ inspect
intern
+ object_id
+ const_missing
method_missing MethodMissing
+ method_added
+ singleton_method_added
+ method_removed
+ singleton_method_removed
+ method_undefined
+ singleton_method_undefined
length
size
gets
@@ -11,6 +20,7 @@ firstline, predefined = __LINE__+1, %[\
lambda
send
__send__
+ __attached__
initialize
initialize_copy
initialize_clone
@@ -18,6 +28,7 @@ firstline, predefined = __LINE__+1, %[\
_ UScore
"/*NULL*/" NULL
empty?
+ eql?
respond_to? Respond_to
respond_to_missing? Respond_to_missing
<IFUNC>
diff --git a/object.c b/object.c
index db3cbba..b22d8b6 100644
--- a/object.c
+++ b/object.c
@@ -22,6 +22,7 @@
#include <float.h>
#include "constant.h"
#include "internal.h"
+#include "id.h"
#include "probes.h"
VALUE rb_cBasicObject;
@@ -35,9 +36,14 @@ VALUE rb_cNilClass;
VALUE rb_cTrueClass;
VALUE rb_cFalseClass;
-static ID id_eq, id_eql, id_match, id_inspect;
-static ID id_init_copy, id_init_clone, id_init_dup;
-static ID id_const_missing;
+#define id_eq idEq
+#define id_eql idEqlP
+#define id_match idEqTilde
+#define id_inspect idInspect
+#define id_init_copy idInitialize_copy
+#define id_init_clone idInitialize_clone
+#define id_init_dup idInitialize_dup
+#define id_const_missing idConst_missing
#define CLASS_OR_MODULE_P(obj) \
(!SPECIAL_CONST_P(obj) && \
@@ -1425,7 +1431,7 @@ rb_mod_to_s(VALUE klass)
if (FL_TEST(klass, FL_SINGLETON)) {
VALUE s = rb_usascii_str_new2("#<Class:");
- VALUE v = rb_iv_get(klass, "__attached__");
+ VALUE v = rb_ivar_get(klass, id__attached__);
if (CLASS_OR_MODULE_P(v)) {
rb_str_append(s, rb_inspect(v));
@@ -3251,15 +3257,6 @@ Init_Object(void)
*/
rb_define_global_const("FALSE", Qfalse);
- id_eq = rb_intern("==");
- id_eql = rb_intern("eql?");
- id_match = rb_intern("=~");
- id_inspect = rb_intern("inspect");
- id_init_copy = rb_intern("initialize_copy");
- id_init_clone = rb_intern("initialize_clone");
- id_init_dup = rb_intern("initialize_dup");
- id_const_missing = rb_intern("const_missing");
-
for (i=0; conv_method_names[i].method; i++) {
conv_method_names[i].id = rb_intern(conv_method_names[i].method);
}
diff --git a/proc.c b/proc.c
index e0042e6..ed3ef4b 100644
--- a/proc.c
+++ b/proc.c
@@ -31,7 +31,7 @@ VALUE rb_cProc;
static VALUE bmcall(VALUE, VALUE);
static int method_arity(VALUE);
static int method_min_max_arity(VALUE, int *max);
-static ID attached;
+#define attached id__attached__
/* Proc */
@@ -2448,6 +2448,5 @@ Init_Binding(void)
rb_define_method(rb_cBinding, "dup", binding_dup, 0);
rb_define_method(rb_cBinding, "eval", bind_eval, -1);
rb_define_global_function("binding", rb_f_binding, 0);
- attached = rb_intern("__attached__");
}
diff --git a/variable.c b/variable.c
index f6bd70a..1417de0 100644
--- a/variable.c
+++ b/variable.c
@@ -18,6 +18,7 @@
#include "node.h"
#include "constant.h"
#include "internal.h"
+#include "id.h"
st_table *rb_global_tbl;
st_table *rb_class_tbl;
@@ -2300,7 +2301,7 @@ static VALUE
cvar_front_klass(VALUE klass)
{
if (FL_TEST(klass, FL_SINGLETON)) {
- VALUE obj = rb_iv_get(klass, "__attached__");
+ VALUE obj = rb_ivar_get(klass, id__attached__);
if (RB_TYPE_P(obj, T_MODULE) || RB_TYPE_P(obj, T_CLASS)) {
return obj;
}
diff --git a/vm_method.c b/vm_method.c
index badc20e..ddcec6c 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -13,9 +13,14 @@
static void rb_vm_check_redefinition_opt_method(const rb_method_entry_t *me, VALUE klass);
-static ID object_id;
-static ID removed, singleton_removed, undefined, singleton_undefined;
-static ID added, singleton_added, attached;
+#define object_id idObject_id
+#define added idMethod_added
+#define singleton_added idSingleton_method_added
+#define removed idMethod_removed
+#define singleton_removed idSingleton_method_removed
+#define undefined idMethod_undefined
+#define singleton_undefined idSingleton_method_undefined
+#define attached id__attached__
struct cache_entry { /* method hash table. */
VALUE filled_version; /* filled state version */
@@ -1674,15 +1679,6 @@ Init_eval_method(void)
rb_define_private_method(rb_singleton_class(rb_vm_top_self()),
"private", top_private, -1);
- object_id = rb_intern("object_id");
- added = rb_intern("method_added");
- singleton_added = rb_intern("singleton_method_added");
- removed = rb_intern("method_removed");
- singleton_removed = rb_intern("singleton_method_removed");
- undefined = rb_intern("method_undefined");
- singleton_undefined = rb_intern("singleton_method_undefined");
- attached = rb_intern("__attached__");
-
{
#define REPLICATE_METHOD(klass, id, noex) \
rb_method_entry_set((klass), (id), \
diff --git a/vm_trace.c b/vm_trace.c
index 6fafa37..2a40578 100644
--- a/vm_trace.c
+++ b/vm_trace.c
@@ -582,7 +582,7 @@ call_trace_func(rb_event_flag_t event, VALUE proc, VALUE self, ID id, VALUE klas
klass = RBASIC(klass)->klass;
}
else if (FL_TEST(klass, FL_SINGLETON)) {
- klass = rb_iv_get(klass, "__attached__");
+ klass = rb_ivar_get(klass, id__attached__);
}
}