diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-18 01:53:18 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-18 01:53:18 +0000 |
commit | c317e978f79c920924f70eea8f66e69b40369fa5 (patch) | |
tree | 6c721c85c4b280479c219094d01f834846fda9d6 /vm_core.h | |
parent | ce4cfec88afb29ed59b61dcb8f84149823b9a5bc (diff) | |
download | ruby-c317e978f79c920924f70eea8f66e69b40369fa5.tar.gz |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r-- | vm_core.h | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -318,6 +318,33 @@ enum ruby_special_exceptions { 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 { 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 { #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 |