summaryrefslogtreecommitdiff
path: root/insns.def
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-24 08:36:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-24 08:36:53 +0000
commit2314b80d4c5ed712308f6b32aa8bf865d8d9ffff (patch)
tree8a531352ebd8b352e6c1b5cadeeb7d49d28da147 /insns.def
parent8ac52a95d577d00ed7b783fde8bca5b2b76cb404 (diff)
Feature #7035
* compile.c (defined_expr), insns.def (defined): share single frozen strings. [EXPERIMENTAL] [ruby-core:47558][Feature #7035] * iseq.c (rb_iseq_defined_string): make expression strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r--insns.def24
1 files changed, 12 insertions, 12 deletions
diff --git a/insns.def b/insns.def
index e55ec30a07..94e1a24203 100644
--- a/insns.def
+++ b/insns.def
@@ -716,7 +716,7 @@ defined
(VALUE val)
{
VALUE klass;
- const char *expr_type = 0;
+ enum defined_type expr_type = 0;
enum defined_type type = (enum defined_type)op_type;
val = Qnil;
@@ -724,7 +724,7 @@ defined
switch (type) {
case DEFINED_IVAR:
if (rb_ivar_defined(GET_SELF(), SYM2ID(obj))) {
- expr_type = "instance-variable";
+ expr_type = DEFINED_IVAR;
}
break;
case DEFINED_IVAR2:
@@ -732,7 +732,7 @@ defined
break;
case DEFINED_GVAR:
if (rb_gvar_defined(rb_global_entry(SYM2ID(obj)))) {
- expr_type = "global-variable";
+ expr_type = DEFINED_GVAR;
}
break;
case DEFINED_CVAR:
@@ -740,20 +740,20 @@ defined
NODE *cref = rb_vm_get_cref(GET_ISEQ(), GET_EP());
klass = vm_get_cvar_base(cref, GET_CFP());
if (rb_cvar_defined(klass, SYM2ID(obj))) {
- expr_type = "class variable";
+ expr_type = DEFINED_CVAR;
}
break;
}
case DEFINED_CONST:
klass = v;
if (vm_get_ev_const(th, GET_ISEQ(), klass, SYM2ID(obj), 1)) {
- expr_type = "constant";
+ expr_type = DEFINED_CONST;
}
break;
case DEFINED_FUNC:
klass = CLASS_OF(v);
if (rb_method_boundp(klass, SYM2ID(obj), 0)) {
- expr_type = "method";
+ expr_type = DEFINED_METHOD;
}
break;
case DEFINED_METHOD:{
@@ -765,7 +765,7 @@ defined
if (!((me->flag & NOEX_PROTECTED) &&
!rb_obj_is_kind_of(GET_SELF(),
rb_class_real(klass)))) {
- expr_type = "method";
+ expr_type = DEFINED_METHOD;
}
}
}
@@ -776,13 +776,13 @@ defined
args[0] = obj; args[1] = Qfalse;
r = rb_check_funcall(v, rb_intern("respond_to_missing?"), 2, args);
if (r != Qundef && RTEST(r))
- expr_type = "method";
+ expr_type = DEFINED_METHOD;
}
break;
}
case DEFINED_YIELD:
if (GET_BLOCK_PTR()) {
- expr_type = "yield";
+ expr_type = DEFINED_YIELD;
}
break;
case DEFINED_ZSUPER:{
@@ -791,7 +791,7 @@ defined
VALUE klass = vm_search_normal_superclass(GET_CFP()->klass);
ID id = me->def ? me->def->original_id : me->called_id;
if (rb_method_boundp(klass, id, 0)) {
- expr_type = "super";
+ expr_type = DEFINED_ZSUPER;
}
}
break;
@@ -799,7 +799,7 @@ defined
case DEFINED_REF:{
val = vm_getspecial(th, GET_LEP(), Qfalse, FIX2INT(obj));
if (val != Qnil) {
- expr_type = "global-variable";
+ expr_type = DEFINED_GVAR;
}
break;
}
@@ -809,7 +809,7 @@ defined
}
if (expr_type != 0) {
if (needstr != Qfalse) {
- val = rb_str_new2(expr_type);
+ val = rb_iseq_defined_string(expr_type);
}
else {
val = Qtrue;