[前][次][番号順一覧][スレッド一覧]

ruby-changes:34775

From: nobu <ko1@a...>
Date: Fri, 18 Jul 2014 10:53:21 +0900 (JST)
Subject: [ruby-changes:34775] nobu:r46858 (trunk): vm_core.h: redefined_flag in rb_vm_t

nobu	2014-07-18 10:53:18 +0900 (Fri, 18 Jul 2014)

  New Revision: 46858

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46858

  Log:
    vm_core.h: redefined_flag in rb_vm_t
    
    * vm_core.h (struct rb_vm_struct): move redefined_flag from
      ruby_vm_redefined_flag.
    
    * vm_core.h (BASIC_OP_UNREDEFINED_P): move from vm_insnhelper.h.

  Modified files:
    trunk/vm.c
    trunk/vm_core.h
    trunk/vm_insnhelper.h
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 46857)
+++ vm_core.h	(revision 46858)
@@ -318,6 +318,33 @@ enum ruby_special_exceptions { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L318
     ruby_special_error_count
 };
 
+enum ruby_basic_operators {
+    BOP_PLUS,
+    BOP_MINUS,
+    BOP_MULT,
+    BOP_DIV,
+    BOP_MOD,
+    BOP_EQ,
+    BOP_EQQ,
+    BOP_LT,
+    BOP_LE,
+    BOP_LTLT,
+    BOP_AREF,
+    BOP_ASET,
+    BOP_LENGTH,
+    BOP_SIZE,
+    BOP_EMPTY_P,
+    BOP_SUCC,
+    BOP_GT,
+    BOP_GE,
+    BOP_NOT,
+    BOP_NEQ,
+    BOP_MATCH,
+    BOP_FREEZE,
+
+    BOP_LAST_
+};
+
 #define GetVMPtr(obj, ptr) \
   GetCoreDataFromValue((obj), rb_vm_t, (ptr))
 
@@ -410,6 +437,8 @@ typedef struct rb_vm_struct { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L437
 	size_t fiber_vm_stack_size;
 	size_t fiber_machine_stack_size;
     } default_params;
+
+    short redefined_flag[BOP_LAST_];
 } rb_vm_t;
 
 /* default values */
@@ -426,6 +455,19 @@ typedef struct rb_vm_struct { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L455
 #define RUBY_VM_FIBER_MACHINE_STACK_SIZE      (  64 * 1024 * sizeof(VALUE)) /*  256 KB or  512 KB */
 #define RUBY_VM_FIBER_MACHINE_STACK_SIZE_MIN  (  16 * 1024 * sizeof(VALUE)) /*   64 KB or  128 KB */
 
+/* optimize insn */
+#define FIXNUM_REDEFINED_OP_FLAG (1 << 0)
+#define FLOAT_REDEFINED_OP_FLAG  (1 << 1)
+#define STRING_REDEFINED_OP_FLAG (1 << 2)
+#define ARRAY_REDEFINED_OP_FLAG  (1 << 3)
+#define HASH_REDEFINED_OP_FLAG   (1 << 4)
+#define BIGNUM_REDEFINED_OP_FLAG (1 << 5)
+#define SYMBOL_REDEFINED_OP_FLAG (1 << 6)
+#define TIME_REDEFINED_OP_FLAG   (1 << 7)
+#define REGEXP_REDEFINED_OP_FLAG (1 << 8)
+
+#define BASIC_OP_UNREDEFINED_P(op, klass) (LIKELY((GET_VM()->redefined_flag[(op)]&(klass)) == 0))
+
 #ifndef VM_DEBUG_BP_CHECK
 #define VM_DEBUG_BP_CHECK 0
 #endif
Index: vm.c
===================================================================
--- vm.c	(revision 46857)
+++ vm.c	(revision 46858)
@@ -98,8 +98,8 @@ VALUE rb_cThread; https://github.com/ruby/ruby/blob/trunk/vm.c#L98
 VALUE rb_cEnv;
 VALUE rb_mRubyVMFrozenCore;
 
+#define ruby_vm_redefined_flag GET_VM()->redefined_flag
 VALUE ruby_vm_const_missing_count = 0;
-short ruby_vm_redefined_flag[BOP_LAST_];
 rb_thread_t *ruby_current_thread = 0;
 rb_vm_t *ruby_current_vm = 0;
 rb_event_flag_t ruby_vm_event_flags;
Index: vm_insnhelper.h
===================================================================
--- vm_insnhelper.h	(revision 46857)
+++ vm_insnhelper.h	(revision 46858)
@@ -34,34 +34,6 @@ https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.h#L34
 #define VMDEBUG 3
 #endif
 
-enum {
-  BOP_PLUS,
-  BOP_MINUS,
-  BOP_MULT,
-  BOP_DIV,
-  BOP_MOD,
-  BOP_EQ,
-  BOP_EQQ,
-  BOP_LT,
-  BOP_LE,
-  BOP_LTLT,
-  BOP_AREF,
-  BOP_ASET,
-  BOP_LENGTH,
-  BOP_SIZE,
-  BOP_EMPTY_P,
-  BOP_SUCC,
-  BOP_GT,
-  BOP_GE,
-  BOP_NOT,
-  BOP_NEQ,
-  BOP_MATCH,
-  BOP_FREEZE,
-
-  BOP_LAST_
-};
-
-extern short ruby_vm_redefined_flag[BOP_LAST_];
 extern VALUE ruby_vm_const_missing_count;
 
 #if VM_COLLECT_USAGE_DETAILS
@@ -231,18 +203,6 @@ enum vm_regan_acttype { https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.h#L203
 /**********************************************************/
 
 /* optimize insn */
-#define FIXNUM_REDEFINED_OP_FLAG (1 << 0)
-#define FLOAT_REDEFINED_OP_FLAG  (1 << 1)
-#define STRING_REDEFINED_OP_FLAG (1 << 2)
-#define ARRAY_REDEFINED_OP_FLAG  (1 << 3)
-#define HASH_REDEFINED_OP_FLAG   (1 << 4)
-#define BIGNUM_REDEFINED_OP_FLAG (1 << 5)
-#define SYMBOL_REDEFINED_OP_FLAG (1 << 6)
-#define TIME_REDEFINED_OP_FLAG   (1 << 7)
-#define REGEXP_REDEFINED_OP_FLAG (1 << 8)
-
-#define BASIC_OP_UNREDEFINED_P(op, klass) (LIKELY((ruby_vm_redefined_flag[(op)]&(klass)) == 0))
-
 #define FIXNUM_2_P(a, b) ((a) & (b) & 1)
 #if USE_FLONUM
 #define FLONUM_2_P(a, b) (((((a)^2) | ((b)^2)) & 3) == 0) /* (FLONUM_P(a) && FLONUM_P(b)) */

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]