aboutsummaryrefslogtreecommitdiffstats
path: root/vm_method.c
diff options
context:
space:
mode:
authornari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-26 04:57:47 +0000
committernari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-26 04:57:47 +0000
commit90b70738427567dc065ad75b32fa932b280c304a (patch)
treec123b148394a08abcb0ecebcb407a251388af33b /vm_method.c
parent2bf56dededed9d4c376893f783aa5b4300b08495 (diff)
downloadruby-90b70738427567dc065ad75b32fa932b280c304a.tar.gz
* parse.y: support Symbol GC. [ruby-trunk Feature #9634]
See this ticket about Symbol GC. * include/ruby/ruby.h: Declare few functions. * rb_sym2id: almost same as old SYM2ID but support dynamic symbols. * rb_id2sym: almost same as old ID2SYM but support dynamic symbols. * rb_sym2str: almost same as `rb_id2str(SYM2ID(sym))` but not pin down a dynamic symbol. Declare a new struct. * struct RSymbol: represents a dynamic symbol as object in Ruby's heaps. Add few macros. * STATIC_SYM_P: check a static symbol. * DYNAMIC_SYM_P: check a dynamic symbol. * RSYMBOL: cast to RSymbol * gc.c: declare RSymbol. support T_SYMBOL. * internal.h: Declare few functions. * rb_gc_free_dsymbol: free up a dynamic symbol. GC call this function at a sweep phase. * rb_str_dynamic_intern: convert a string to a dynamic symbol. * rb_check_id_without_pindown: not pinning function. * rb_sym2id_without_pindown: ditto. * rb_check_id_cstr_without_pindown: ditto. * string.c (Init_String): String#intern and String#to_sym use rb_str_dynamic_intern. * template/id.h.tmpl: use LSB of ID as a flag for determining a static symbol, so we shift left other ruby_id_types. * string.c: use rb_sym2str instead `rb_id2str(SYM2ID(sym))` to avoid pinning. * load.c: use xx_without_pindown function at creating temporary ID to avoid pinning. * object.c: ditto. * sprintf.c: ditto. * struct.c: ditto. * thread.c: ditto. * variable.c: ditto. * vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/vm_method.c b/vm_method.c
index 6516a0b03e..6b2eaf8f1b 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -791,7 +791,7 @@ rb_mod_remove_method(int argc, VALUE *argv, VALUE mod)
for (i = 0; i < argc; i++) {
VALUE v = argv[i];
- ID id = rb_check_id(&v);
+ ID id = rb_check_id_without_pindown(&v);
if (!id) {
rb_name_error_str(v, "method `%s' not defined in %s",
RSTRING_PTR(v), rb_class2name(mod));
@@ -1002,7 +1002,7 @@ rb_mod_undef_method(int argc, VALUE *argv, VALUE mod)
int i;
for (i = 0; i < argc; i++) {
VALUE v = argv[i];
- ID id = rb_check_id(&v);
+ ID id = rb_check_id_without_pindown(&v);
if (!id) {
rb_method_name_error(mod, v);
}
@@ -1042,7 +1042,7 @@ rb_mod_undef_method(int argc, VALUE *argv, VALUE mod)
static VALUE
rb_mod_method_defined(VALUE mod, VALUE mid)
{
- ID id = rb_check_id(&mid);
+ ID id = rb_check_id_without_pindown(&mid);
if (!id || !rb_method_boundp(mod, id, 1)) {
return Qfalse;
}
@@ -1056,7 +1056,7 @@ static VALUE
check_definition(VALUE mod, VALUE mid, rb_method_flag_t noex)
{
const rb_method_entry_t *me;
- ID id = rb_check_id(&mid);
+ ID id = rb_check_id_without_pindown(&mid);
if (!id) return Qfalse;
me = rb_method_entry(mod, id, 0);
if (me) {
@@ -1685,7 +1685,7 @@ obj_respond_to(int argc, VALUE *argv, VALUE obj)
ID id;
rb_scan_args(argc, argv, "11", &mid, &priv);
- if (!(id = rb_check_id(&mid))) {
+ if (!(id = rb_check_id_without_pindown(&mid))) {
if (!rb_method_basic_definition_p(CLASS_OF(obj), idRespond_to_missing)) {
VALUE args[2];
args[0] = ID2SYM(rb_to_id(mid));