summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-12 07:07:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-12 07:07:25 +0000
commit3c4f8ce0921a5b64b77c5d6be69737f9dbf48d70 (patch)
tree5f0c95030bd7647d9aaeeec78b6c5294f075aebd
parent9354b05e5cd4ee0fb0a6ed823145657eb4e68d55 (diff)
downloadruby-3c4f8ce0921a5b64b77c5d6be69737f9dbf48d70.tar.gz
method.h: NOEX_SAFE_SHIFT_OFFSET
* method.h (rb_method_flag_t): name a magic number for NOEX_SAFE and NOEX_WITH as NOEX_SAFE_SHIFT_OFFSET. * method.h (rb_method_type_t, method_optimized_type): C89 forbids a comma after the last element in enum. * proc.c (rb_method_entry_arity), vm_eval.c (vm_call0_body), vm_insnhelper.c (vm_call_method): add VM_METHOD_TYPE__MAX case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog11
-rw-r--r--method.h15
-rw-r--r--proc.c2
-rw-r--r--vm_eval.c2
-rw-r--r--vm_insnhelper.c2
5 files changed, 28 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 37c91a662b..90836e280e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Wed Dec 12 16:07:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * method.h (rb_method_flag_t): name a magic number for NOEX_SAFE and
+ NOEX_WITH as NOEX_SAFE_SHIFT_OFFSET.
+
+ * method.h (rb_method_type_t, method_optimized_type): C89 forbids a
+ comma after the last element in enum.
+
+ * proc.c (rb_method_entry_arity), vm_eval.c (vm_call0_body),
+ vm_insnhelper.c (vm_call_method): add VM_METHOD_TYPE__MAX case.
+
Wed Dec 12 14:16:35 2012 Eric Hodel <drbrain@segment7.net>
* lib/rdoc/class_module.rb: Added RDoc::ClassModule#documented? which
diff --git a/method.h b/method.h
index f8ceb84ff9..56b33e7b47 100644
--- a/method.h
+++ b/method.h
@@ -22,11 +22,14 @@ typedef enum {
NOEX_MODFUNC = 0x12,
NOEX_SUPER = 0x20,
NOEX_VCALL = 0x40,
- NOEX_RESPONDS = 0x80
+ NOEX_RESPONDS = 0x80,
+
+ NOEX_BIT_WIDTH = 8,
+ NOEX_SAFE_SHIFT_OFFSET = ((NOEX_BIT_WIDTH+3)/4)*4 /* round up to nibble */
} rb_method_flag_t;
-#define NOEX_SAFE(n) ((int)((n) >> 8) & 0x0F)
-#define NOEX_WITH(n, s) (((s) << 8) | (n) | (ruby_running ? 0 : NOEX_BASIC))
+#define NOEX_SAFE(n) ((int)((n) >> NOEX_SAFE_SHIFT_OFFSET) & 0x0F)
+#define NOEX_WITH(n, s) (((s) << NOEX_SAFE_SHIFT_OFFSET) | (n) | (ruby_running ? 0 : NOEX_BASIC))
#define NOEX_WITH_SAFE(n) NOEX_WITH((n), rb_safe_level())
/* method data type */
@@ -44,6 +47,8 @@ typedef enum {
VM_METHOD_TYPE_MISSING, /* wrapper for method_missing(id) */
VM_METHOD_TYPE_CFUNC_FRAMELESS,
VM_METHOD_TYPE_REFINED,
+
+ VM_METHOD_TYPE__MAX
} rb_method_type_t;
struct rb_call_info_struct;
@@ -71,7 +76,9 @@ typedef struct rb_method_definition_struct {
VALUE proc; /* should be mark */
enum method_optimized_type {
OPTIMIZED_METHOD_TYPE_SEND,
- OPTIMIZED_METHOD_TYPE_CALL
+ OPTIMIZED_METHOD_TYPE_CALL,
+
+ OPTIMIZED_METHOD_TYPE__MAX
} optimize_type;
struct rb_method_entry_struct *orig_me;
} body;
diff --git a/proc.c b/proc.c
index a112677e69..03355dff18 100644
--- a/proc.c
+++ b/proc.c
@@ -1686,6 +1686,8 @@ rb_method_entry_arity(const rb_method_entry_t *me)
}
case VM_METHOD_TYPE_REFINED:
return -1;
+ case VM_METHOD_TYPE__MAX:
+ break;
}
rb_bug("rb_method_entry_arity: invalid method entry type (%d)", def->type);
diff --git a/vm_eval.c b/vm_eval.c
index 190d2bc559..4d5e47d5f4 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -227,6 +227,8 @@ vm_call0_body(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv)
}
case VM_METHOD_TYPE_UNDEF:
break;
+ case VM_METHOD_TYPE__MAX:
+ break;
}
rb_bug("vm_call0: unsupported method type (%d)", ci->me->def->type);
return Qundef;
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index caaab54e1d..64b812dd4b 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1786,6 +1786,8 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci)
goto zsuper_method_dispatch;
}
}
+ case VM_METHOD_TYPE__MAX:
+ break;
}
rb_bug("vm_call_method: unsupported method type (%d)", ci->me->def->type);
}