debase-ruby_core_source 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -1
  3. data/README.md +1 -1
  4. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/addr2line.h +21 -0
  5. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/constant.h +36 -0
  6. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/dln.h +50 -0
  7. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/encdb.h +169 -0
  8. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/eval_intern.h +241 -0
  9. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/gc.h +104 -0
  10. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/id.h +135 -0
  11. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/insns.inc +187 -0
  12. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/insns_info.inc +724 -0
  13. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/internal.h +395 -0
  14. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/iseq.h +140 -0
  15. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/known_errors.inc +731 -0
  16. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/method.h +138 -0
  17. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/node.h +541 -0
  18. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/node_name.inc +212 -0
  19. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/opt_sc.inc +702 -0
  20. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/optinsn.inc +83 -0
  21. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/optunifs.inc +120 -0
  22. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/parse.h +181 -0
  23. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/probes_helper.h +67 -0
  24. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/regenc.h +227 -0
  25. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/regint.h +915 -0
  26. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/regparse.h +367 -0
  27. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/revision.h +1 -0
  28. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/ruby_atomic.h +170 -0
  29. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/siphash.h +48 -0
  30. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/thread_pthread.h +56 -0
  31. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/thread_win32.h +45 -0
  32. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/timev.h +21 -0
  33. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/transcode_data.h +127 -0
  34. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/transdb.h +193 -0
  35. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/version.h +52 -0
  36. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/vm.inc +3196 -0
  37. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/vm_core.h +1015 -0
  38. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/vm_debug.h +41 -0
  39. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/vm_exec.h +173 -0
  40. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/vm_insnhelper.h +274 -0
  41. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/vm_opts.h +56 -0
  42. data/lib/debase/ruby_core_source/ruby-2.0.0-p576/vmtc.inc +101 -0
  43. data/lib/debase/ruby_core_source/version.rb +1 -1
  44. metadata +41 -2
@@ -0,0 +1,104 @@
1
+
2
+ #ifndef RUBY_GC_H
3
+ #define RUBY_GC_H 1
4
+
5
+ #if defined(__x86_64__) && defined(__GNUC__) && !defined(__native_client__)
6
+ #define SET_MACHINE_STACK_END(p) __asm__ volatile ("movq\t%%rsp, %0" : "=r" (*(p)))
7
+ #elif defined(__i386) && defined(__GNUC__) && !defined(__native_client__)
8
+ #define SET_MACHINE_STACK_END(p) __asm__ volatile ("movl\t%%esp, %0" : "=r" (*(p)))
9
+ #else
10
+ NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
11
+ #define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p)
12
+ #define USE_CONSERVATIVE_STACK_END
13
+ #endif
14
+
15
+ /* for GC debug */
16
+
17
+ #ifndef RUBY_MARK_FREE_DEBUG
18
+ #define RUBY_MARK_FREE_DEBUG 0
19
+ #endif
20
+
21
+ #if RUBY_MARK_FREE_DEBUG
22
+ extern int ruby_gc_debug_indent;
23
+
24
+ static inline void
25
+ rb_gc_debug_indent(void)
26
+ {
27
+ printf("%*s", ruby_gc_debug_indent, "");
28
+ }
29
+
30
+ static inline void
31
+ rb_gc_debug_body(const char *mode, const char *msg, int st, void *ptr)
32
+ {
33
+ if (st == 0) {
34
+ ruby_gc_debug_indent--;
35
+ }
36
+ rb_gc_debug_indent();
37
+ printf("%s: %s %s (%p)\n", mode, st ? "->" : "<-", msg, ptr);
38
+
39
+ if (st) {
40
+ ruby_gc_debug_indent++;
41
+ }
42
+
43
+ fflush(stdout);
44
+ }
45
+
46
+ #define RUBY_MARK_ENTER(msg) rb_gc_debug_body("mark", (msg), 1, ptr)
47
+ #define RUBY_MARK_LEAVE(msg) rb_gc_debug_body("mark", (msg), 0, ptr)
48
+ #define RUBY_FREE_ENTER(msg) rb_gc_debug_body("free", (msg), 1, ptr)
49
+ #define RUBY_FREE_LEAVE(msg) rb_gc_debug_body("free", (msg), 0, ptr)
50
+ #define RUBY_GC_INFO rb_gc_debug_indent(); printf
51
+
52
+ #else
53
+ #define RUBY_MARK_ENTER(msg)
54
+ #define RUBY_MARK_LEAVE(msg)
55
+ #define RUBY_FREE_ENTER(msg)
56
+ #define RUBY_FREE_LEAVE(msg)
57
+ #define RUBY_GC_INFO if(0)printf
58
+ #endif
59
+
60
+ #define RUBY_MARK_UNLESS_NULL(ptr) if(RTEST(ptr)){rb_gc_mark(ptr);}
61
+ #define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);(ptr)=NULL;}
62
+
63
+ #if STACK_GROW_DIRECTION > 0
64
+ # define STACK_UPPER(x, a, b) (a)
65
+ #elif STACK_GROW_DIRECTION < 0
66
+ # define STACK_UPPER(x, a, b) (b)
67
+ #else
68
+ RUBY_EXTERN int ruby_stack_grow_direction;
69
+ int ruby_get_stack_grow_direction(volatile VALUE *addr);
70
+ # define stack_growup_p(x) ( \
71
+ (ruby_stack_grow_direction ? \
72
+ ruby_stack_grow_direction : \
73
+ ruby_get_stack_grow_direction(x)) > 0)
74
+ # define STACK_UPPER(x, a, b) (stack_growup_p(x) ? (a) : (b))
75
+ #endif
76
+
77
+ #if STACK_GROW_DIRECTION
78
+ #define STACK_GROW_DIR_DETECTION
79
+ #define STACK_DIR_UPPER(a,b) STACK_UPPER(0, (a), (b))
80
+ #else
81
+ #define STACK_GROW_DIR_DETECTION VALUE stack_grow_dir_detection
82
+ #define STACK_DIR_UPPER(a,b) STACK_UPPER(&stack_grow_dir_detection, (a), (b))
83
+ #endif
84
+ #define IS_STACK_DIR_UPPER() STACK_DIR_UPPER(1,0)
85
+
86
+ #if defined __GNUC__ && __GNUC__ >= 4
87
+ #pragma GCC visibility push(default)
88
+ #endif
89
+
90
+ /* exports for objspace module */
91
+ size_t rb_objspace_data_type_memsize(VALUE obj);
92
+ void rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *data);
93
+ int rb_objspace_markable_object_p(VALUE obj);
94
+ int rb_objspace_internal_object_p(VALUE obj);
95
+
96
+ void rb_objspace_each_objects(
97
+ int (*callback)(void *start, void *end, size_t stride, void *data),
98
+ void *data);
99
+
100
+ #if defined __GNUC__ && __GNUC__ >= 4
101
+ #pragma GCC visibility pop
102
+ #endif
103
+
104
+ #endif /* RUBY_GC_H */
@@ -0,0 +1,135 @@
1
+ /* DO NOT EDIT THIS FILE DIRECTLY */
2
+ /**********************************************************************
3
+
4
+ id.h -
5
+
6
+ $Author: nobu $
7
+ created at: Sun Oct 19 21:12:51 2008
8
+
9
+ Copyright (C) 2007 Koichi Sasada
10
+
11
+ **********************************************************************/
12
+
13
+ #ifndef RUBY_ID_H
14
+ #define RUBY_ID_H
15
+
16
+ #define ID_SCOPE_SHIFT 3
17
+ #define ID_SCOPE_MASK 0x07
18
+ #define ID_LOCAL 0x00
19
+ #define ID_INSTANCE 0x01
20
+ #define ID_GLOBAL 0x03
21
+ #define ID_ATTRSET 0x04
22
+ #define ID_CONST 0x05
23
+ #define ID_CLASS 0x06
24
+ #define ID_JUNK 0x07
25
+ #define ID_INTERNAL ID_JUNK
26
+
27
+ #define ID2ATTRSET(id) (((id)&~ID_SCOPE_MASK)|ID_ATTRSET)
28
+
29
+ #define symIFUNC ID2SYM(idIFUNC)
30
+ #define symCFUNC ID2SYM(idCFUNC)
31
+
32
+ #define RUBY_TOKEN_DOT2 128
33
+ #define RUBY_TOKEN_DOT3 129
34
+ #define RUBY_TOKEN_UPLUS 130
35
+ #define RUBY_TOKEN_UMINUS 131
36
+ #define RUBY_TOKEN_POW 132
37
+ #define RUBY_TOKEN_DSTAR 133
38
+ #define RUBY_TOKEN_CMP 134
39
+ #define RUBY_TOKEN_LSHFT 135
40
+ #define RUBY_TOKEN_RSHFT 136
41
+ #define RUBY_TOKEN_LEQ 137
42
+ #define RUBY_TOKEN_GEQ 138
43
+ #define RUBY_TOKEN_EQ 139
44
+ #define RUBY_TOKEN_EQQ 140
45
+ #define RUBY_TOKEN_NEQ 141
46
+ #define RUBY_TOKEN_MATCH 142
47
+ #define RUBY_TOKEN_NMATCH 143
48
+ #define RUBY_TOKEN_AREF 144
49
+ #define RUBY_TOKEN_ASET 145
50
+ #define RUBY_TOKEN_COLON2 146
51
+ #define RUBY_TOKEN_COLON3 147
52
+ #define RUBY_TOKEN(t) RUBY_TOKEN_##t
53
+
54
+ enum ruby_method_ids {
55
+ idDot2 = RUBY_TOKEN(DOT2),
56
+ idDot3 = RUBY_TOKEN(DOT3),
57
+ idUPlus = RUBY_TOKEN(UPLUS),
58
+ idUMinus = RUBY_TOKEN(UMINUS),
59
+ idPow = RUBY_TOKEN(POW),
60
+ idCmp = RUBY_TOKEN(CMP),
61
+ idPLUS = '+',
62
+ idMINUS = '-',
63
+ idMULT = '*',
64
+ idDIV = '/',
65
+ idMOD = '%',
66
+ idLT = '<',
67
+ idLTLT = RUBY_TOKEN(LSHFT),
68
+ idLE = RUBY_TOKEN(LEQ),
69
+ idGT = '>',
70
+ idGE = RUBY_TOKEN(GEQ),
71
+ idEq = RUBY_TOKEN(EQ),
72
+ idEqq = RUBY_TOKEN(EQQ),
73
+ idNeq = RUBY_TOKEN(NEQ),
74
+ idNot = '!',
75
+ idBackquote = '`',
76
+ idEqTilde = RUBY_TOKEN(MATCH),
77
+ idNeqTilde = RUBY_TOKEN(NMATCH),
78
+ idAREF = RUBY_TOKEN(AREF),
79
+ idASET = RUBY_TOKEN(ASET),
80
+ tPRESERVED_ID_BEGIN = 147,
81
+ idNULL,
82
+ idEmptyP,
83
+ idRespond_to,
84
+ idRespond_to_missing,
85
+ idIFUNC,
86
+ idCFUNC,
87
+ id_core_set_method_alias,
88
+ id_core_set_variable_alias,
89
+ id_core_undef_method,
90
+ id_core_define_method,
91
+ id_core_define_singleton_method,
92
+ id_core_set_postexe,
93
+ id_core_hash_from_ary,
94
+ id_core_hash_merge_ary,
95
+ id_core_hash_merge_ptr,
96
+ id_core_hash_merge_kwd,
97
+ tPRESERVED_ID_END,
98
+ tIntern,
99
+ tMethodMissing,
100
+ tLength,
101
+ tSize,
102
+ tGets,
103
+ tSucc,
104
+ tEach,
105
+ tProc,
106
+ tLambda,
107
+ tSend,
108
+ t__send__,
109
+ tInitialize,
110
+ tInitialize_copy,
111
+ tInitialize_clone,
112
+ tInitialize_dup,
113
+ tUScore,
114
+ #define TOKEN2LOCALID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_LOCAL)
115
+ TOKEN2LOCALID(Intern),
116
+ TOKEN2LOCALID(MethodMissing),
117
+ TOKEN2LOCALID(Length),
118
+ TOKEN2LOCALID(Size),
119
+ TOKEN2LOCALID(Gets),
120
+ TOKEN2LOCALID(Succ),
121
+ TOKEN2LOCALID(Each),
122
+ TOKEN2LOCALID(Proc),
123
+ TOKEN2LOCALID(Lambda),
124
+ TOKEN2LOCALID(Send),
125
+ TOKEN2LOCALID(__send__),
126
+ TOKEN2LOCALID(Initialize),
127
+ TOKEN2LOCALID(Initialize_copy),
128
+ TOKEN2LOCALID(Initialize_clone),
129
+ TOKEN2LOCALID(Initialize_dup),
130
+ TOKEN2LOCALID(UScore),
131
+ tLAST_OP_ID = tPRESERVED_ID_END-1,
132
+ idLAST_OP_ID = tLAST_OP_ID >> ID_SCOPE_SHIFT
133
+ };
134
+
135
+ #endif /* RUBY_ID_H */
@@ -0,0 +1,187 @@
1
+ /** -*-c-*-
2
+ This file contains YARV instructions list.
3
+
4
+ ----
5
+ This file is auto generated by insns2vm.rb
6
+ DO NOT TOUCH!
7
+
8
+ If you want to fix something, you must edit 'template/insns.inc.tmpl'
9
+ or insns2vm.rb
10
+ */
11
+
12
+
13
+ /* BIN : Basic Instruction Name */
14
+ #define BIN(n) YARVINSN_##n
15
+
16
+ enum ruby_vminsn_type {
17
+ BIN(nop) = 0,
18
+
19
+ BIN(getlocal) = 1,
20
+
21
+ BIN(setlocal) = 2,
22
+
23
+ BIN(getspecial) = 3,
24
+
25
+ BIN(setspecial) = 4,
26
+
27
+ BIN(getinstancevariable) = 5,
28
+
29
+ BIN(setinstancevariable) = 6,
30
+
31
+ BIN(getclassvariable) = 7,
32
+
33
+ BIN(setclassvariable) = 8,
34
+
35
+ BIN(getconstant) = 9,
36
+
37
+ BIN(setconstant) = 10,
38
+
39
+ BIN(getglobal) = 11,
40
+
41
+ BIN(setglobal) = 12,
42
+
43
+ BIN(putnil) = 13,
44
+
45
+ BIN(putself) = 14,
46
+
47
+ BIN(putobject) = 15,
48
+
49
+ BIN(putspecialobject) = 16,
50
+
51
+ BIN(putiseq) = 17,
52
+
53
+ BIN(putstring) = 18,
54
+
55
+ BIN(concatstrings) = 19,
56
+
57
+ BIN(tostring) = 20,
58
+
59
+ BIN(toregexp) = 21,
60
+
61
+ BIN(newarray) = 22,
62
+
63
+ BIN(duparray) = 23,
64
+
65
+ BIN(expandarray) = 24,
66
+
67
+ BIN(concatarray) = 25,
68
+
69
+ BIN(splatarray) = 26,
70
+
71
+ BIN(newhash) = 27,
72
+
73
+ BIN(newrange) = 28,
74
+
75
+ BIN(pop) = 29,
76
+
77
+ BIN(dup) = 30,
78
+
79
+ BIN(dupn) = 31,
80
+
81
+ BIN(swap) = 32,
82
+
83
+ BIN(reput) = 33,
84
+
85
+ BIN(topn) = 34,
86
+
87
+ BIN(setn) = 35,
88
+
89
+ BIN(adjuststack) = 36,
90
+
91
+ BIN(defined) = 37,
92
+
93
+ BIN(checkmatch) = 38,
94
+
95
+ BIN(trace) = 39,
96
+
97
+ BIN(defineclass) = 40,
98
+
99
+ BIN(send) = 41,
100
+
101
+ BIN(opt_send_simple) = 42,
102
+
103
+ BIN(invokesuper) = 43,
104
+
105
+ BIN(invokeblock) = 44,
106
+
107
+ BIN(leave) = 45,
108
+
109
+ BIN(throw) = 46,
110
+
111
+ BIN(jump) = 47,
112
+
113
+ BIN(branchif) = 48,
114
+
115
+ BIN(branchunless) = 49,
116
+
117
+ BIN(getinlinecache) = 50,
118
+
119
+ BIN(onceinlinecache) = 51,
120
+
121
+ BIN(setinlinecache) = 52,
122
+
123
+ BIN(opt_case_dispatch) = 53,
124
+
125
+ BIN(opt_plus) = 54,
126
+
127
+ BIN(opt_minus) = 55,
128
+
129
+ BIN(opt_mult) = 56,
130
+
131
+ BIN(opt_div) = 57,
132
+
133
+ BIN(opt_mod) = 58,
134
+
135
+ BIN(opt_eq) = 59,
136
+
137
+ BIN(opt_neq) = 60,
138
+
139
+ BIN(opt_lt) = 61,
140
+
141
+ BIN(opt_le) = 62,
142
+
143
+ BIN(opt_gt) = 63,
144
+
145
+ BIN(opt_ge) = 64,
146
+
147
+ BIN(opt_ltlt) = 65,
148
+
149
+ BIN(opt_aref) = 66,
150
+
151
+ BIN(opt_aset) = 67,
152
+
153
+ BIN(opt_length) = 68,
154
+
155
+ BIN(opt_size) = 69,
156
+
157
+ BIN(opt_empty_p) = 70,
158
+
159
+ BIN(opt_succ) = 71,
160
+
161
+ BIN(opt_not) = 72,
162
+
163
+ BIN(opt_regexpmatch1) = 73,
164
+
165
+ BIN(opt_regexpmatch2) = 74,
166
+
167
+ BIN(opt_call_c_function) = 75,
168
+
169
+ BIN(bitblt) = 76,
170
+
171
+ BIN(answer) = 77,
172
+
173
+ BIN(getlocal_OP__WC__0) = 78,
174
+
175
+ BIN(getlocal_OP__WC__1) = 79,
176
+
177
+ BIN(setlocal_OP__WC__0) = 80,
178
+
179
+ BIN(setlocal_OP__WC__1) = 81,
180
+
181
+ BIN(putobject_OP_INT2FIX_O_0_C_) = 82,
182
+
183
+ BIN(putobject_OP_INT2FIX_O_1_C_) = 83,
184
+
185
+ VM_INSTRUCTION_SIZE = 84
186
+ };
187
+
@@ -0,0 +1,724 @@
1
+ /** -*-c-*-
2
+ This file contains instruction information for yarv instruction sequence.
3
+
4
+ ----
5
+ This file is auto generated by insns2vm.rb
6
+ DO NOT TOUCH!
7
+
8
+ If you want to fix something, you must edit 'template/insns_info.inc.tmpl'
9
+ or insns2vm.rb
10
+ */
11
+
12
+ #define TS_OFFSET 'O'
13
+ #define TS_NUM 'N'
14
+ #define TS_LINDEX 'L'
15
+ #define TS_VALUE 'V'
16
+ #define TS_ID 'I'
17
+ #define TS_GENTRY 'G'
18
+ #define TS_IC 'K'
19
+ #define TS_CALLINFO 'C'
20
+ #define TS_CDHASH 'H'
21
+ #define TS_ISEQ 'S'
22
+ #define TS_VARIABLE '.'
23
+ #define TS_FUNCPTR 'F'
24
+
25
+ static const char *const insn_name_info[] = {
26
+ "nop",
27
+ "getlocal",
28
+ "setlocal",
29
+ "getspecial",
30
+ "setspecial",
31
+ "getinstancevariable",
32
+ "setinstancevariable",
33
+ "getclassvariable",
34
+ "setclassvariable",
35
+ "getconstant",
36
+ "setconstant",
37
+ "getglobal",
38
+ "setglobal",
39
+ "putnil",
40
+ "putself",
41
+ "putobject",
42
+ "putspecialobject",
43
+ "putiseq",
44
+ "putstring",
45
+ "concatstrings",
46
+ "tostring",
47
+ "toregexp",
48
+ "newarray",
49
+ "duparray",
50
+ "expandarray",
51
+ "concatarray",
52
+ "splatarray",
53
+ "newhash",
54
+ "newrange",
55
+ "pop",
56
+ "dup",
57
+ "dupn",
58
+ "swap",
59
+ "reput",
60
+ "topn",
61
+ "setn",
62
+ "adjuststack",
63
+ "defined",
64
+ "checkmatch",
65
+ "trace",
66
+ "defineclass",
67
+ "send",
68
+ "opt_send_simple",
69
+ "invokesuper",
70
+ "invokeblock",
71
+ "leave",
72
+ "throw",
73
+ "jump",
74
+ "branchif",
75
+ "branchunless",
76
+ "getinlinecache",
77
+ "onceinlinecache",
78
+ "setinlinecache",
79
+ "opt_case_dispatch",
80
+ "opt_plus",
81
+ "opt_minus",
82
+ "opt_mult",
83
+ "opt_div",
84
+ "opt_mod",
85
+ "opt_eq",
86
+ "opt_neq",
87
+ "opt_lt",
88
+ "opt_le",
89
+ "opt_gt",
90
+ "opt_ge",
91
+ "opt_ltlt",
92
+ "opt_aref",
93
+ "opt_aset",
94
+ "opt_length",
95
+ "opt_size",
96
+ "opt_empty_p",
97
+ "opt_succ",
98
+ "opt_not",
99
+ "opt_regexpmatch1",
100
+ "opt_regexpmatch2",
101
+ "opt_call_c_function",
102
+ "bitblt",
103
+ "answer",
104
+ "getlocal_OP__WC__0",
105
+ "getlocal_OP__WC__1",
106
+ "setlocal_OP__WC__0",
107
+ "setlocal_OP__WC__1",
108
+ "putobject_OP_INT2FIX_O_0_C_",
109
+ "putobject_OP_INT2FIX_O_1_C_",
110
+
111
+ };
112
+
113
+ static const char *const insn_operand_info[] = {
114
+ "",
115
+ "LN",
116
+ "LN",
117
+ "NN",
118
+ "N",
119
+ "IK",
120
+ "IK",
121
+ "I",
122
+ "I",
123
+ "I",
124
+ "I",
125
+ "G",
126
+ "G",
127
+ "",
128
+ "",
129
+ "V",
130
+ "N",
131
+ "S",
132
+ "V",
133
+ "N",
134
+ "",
135
+ "NN",
136
+ "N",
137
+ "V",
138
+ "NN",
139
+ "",
140
+ "V",
141
+ "N",
142
+ "N",
143
+ "",
144
+ "",
145
+ "N",
146
+ "",
147
+ "",
148
+ "N",
149
+ "N",
150
+ "N",
151
+ "NVV",
152
+ "N",
153
+ "N",
154
+ "ISN",
155
+ "C",
156
+ "C",
157
+ "C",
158
+ "C",
159
+ "",
160
+ "N",
161
+ "O",
162
+ "O",
163
+ "O",
164
+ "OK",
165
+ "OK",
166
+ "K",
167
+ "HO",
168
+ "C",
169
+ "C",
170
+ "C",
171
+ "C",
172
+ "C",
173
+ "C",
174
+ "CC",
175
+ "C",
176
+ "C",
177
+ "C",
178
+ "C",
179
+ "C",
180
+ "C",
181
+ "C",
182
+ "C",
183
+ "C",
184
+ "C",
185
+ "C",
186
+ "C",
187
+ "V",
188
+ "",
189
+ "F",
190
+ "",
191
+ "",
192
+ "L",
193
+ "L",
194
+ "L",
195
+ "L",
196
+ "",
197
+ "",
198
+
199
+ };
200
+
201
+ static const int insn_len_info[] = {
202
+ 1,
203
+ 3,
204
+ 3,
205
+ 3,
206
+ 2,
207
+ 3,
208
+ 3,
209
+ 2,
210
+ 2,
211
+ 2,
212
+ 2,
213
+ 2,
214
+ 2,
215
+ 1,
216
+ 1,
217
+ 2,
218
+ 2,
219
+ 2,
220
+ 2,
221
+ 2,
222
+ 1,
223
+ 3,
224
+ 2,
225
+ 2,
226
+ 3,
227
+ 1,
228
+ 2,
229
+ 2,
230
+ 2,
231
+ 1,
232
+ 1,
233
+ 2,
234
+ 1,
235
+ 1,
236
+ 2,
237
+ 2,
238
+ 2,
239
+ 4,
240
+ 2,
241
+ 2,
242
+ 4,
243
+ 2,
244
+ 2,
245
+ 2,
246
+ 2,
247
+ 1,
248
+ 2,
249
+ 2,
250
+ 2,
251
+ 2,
252
+ 3,
253
+ 3,
254
+ 2,
255
+ 3,
256
+ 2,
257
+ 2,
258
+ 2,
259
+ 2,
260
+ 2,
261
+ 2,
262
+ 3,
263
+ 2,
264
+ 2,
265
+ 2,
266
+ 2,
267
+ 2,
268
+ 2,
269
+ 2,
270
+ 2,
271
+ 2,
272
+ 2,
273
+ 2,
274
+ 2,
275
+ 2,
276
+ 1,
277
+ 2,
278
+ 1,
279
+ 1,
280
+ 2,
281
+ 2,
282
+ 2,
283
+ 2,
284
+ 1,
285
+ 1,
286
+
287
+ };
288
+
289
+ #ifdef USE_INSN_RET_NUM
290
+ static const int insn_stack_push_num_info[] = {
291
+ 0,
292
+ 1,
293
+ 0,
294
+ 1,
295
+ 0,
296
+ 1,
297
+ 0,
298
+ 1,
299
+ 0,
300
+ 1,
301
+ 0,
302
+ 1,
303
+ 0,
304
+ 1,
305
+ 1,
306
+ 1,
307
+ 1,
308
+ 1,
309
+ 1,
310
+ 1,
311
+ 1,
312
+ 1,
313
+ 1,
314
+ 1,
315
+ 1,
316
+ 1,
317
+ 1,
318
+ 1,
319
+ 1,
320
+ 0,
321
+ 2,
322
+ 1,
323
+ 2,
324
+ 1,
325
+ 1,
326
+ 1,
327
+ 1,
328
+ 1,
329
+ 1,
330
+ 0,
331
+ 1,
332
+ 1,
333
+ 1,
334
+ 1,
335
+ 1,
336
+ 1,
337
+ 1,
338
+ 0,
339
+ 0,
340
+ 0,
341
+ 1,
342
+ 1,
343
+ 1,
344
+ 0,
345
+ 1,
346
+ 1,
347
+ 1,
348
+ 1,
349
+ 1,
350
+ 1,
351
+ 1,
352
+ 1,
353
+ 1,
354
+ 1,
355
+ 1,
356
+ 1,
357
+ 1,
358
+ 1,
359
+ 1,
360
+ 1,
361
+ 1,
362
+ 1,
363
+ 1,
364
+ 1,
365
+ 1,
366
+ 0,
367
+ 1,
368
+ 1,
369
+ 1,
370
+ 1,
371
+ 0,
372
+ 0,
373
+ 1,
374
+ 1,
375
+
376
+ };
377
+ #endif
378
+
379
+ #ifdef USE_INSN_STACK_INCREASE
380
+ static int
381
+ insn_stack_increase(int depth, int insn, VALUE *opes)
382
+ {
383
+ switch(insn){
384
+ case BIN(nop):{
385
+ return depth + 0;
386
+ }
387
+ case BIN(getlocal):{
388
+ return depth + 1;
389
+ }
390
+ case BIN(setlocal):{
391
+ return depth + -1;
392
+ }
393
+ case BIN(getspecial):{
394
+ return depth + 1;
395
+ }
396
+ case BIN(setspecial):{
397
+ return depth + -1;
398
+ }
399
+ case BIN(getinstancevariable):{
400
+ return depth + 1;
401
+ }
402
+ case BIN(setinstancevariable):{
403
+ return depth + -1;
404
+ }
405
+ case BIN(getclassvariable):{
406
+ return depth + 1;
407
+ }
408
+ case BIN(setclassvariable):{
409
+ return depth + -1;
410
+ }
411
+ case BIN(getconstant):{
412
+ return depth + 0;
413
+ }
414
+ case BIN(setconstant):{
415
+ return depth + -2;
416
+ }
417
+ case BIN(getglobal):{
418
+ return depth + 1;
419
+ }
420
+ case BIN(setglobal):{
421
+ return depth + -1;
422
+ }
423
+ case BIN(putnil):{
424
+ return depth + 1;
425
+ }
426
+ case BIN(putself):{
427
+ return depth + 1;
428
+ }
429
+ case BIN(putobject):{
430
+ return depth + 1;
431
+ }
432
+ case BIN(putspecialobject):{
433
+ return depth + 1;
434
+ }
435
+ case BIN(putiseq):{
436
+ return depth + 1;
437
+ }
438
+ case BIN(putstring):{
439
+ return depth + 1;
440
+ }
441
+ case BIN(concatstrings):{
442
+ int inc = 0;
443
+ int num = FIX2INT(opes[0]);
444
+ inc += 1 - num;;
445
+ return depth + inc;
446
+ }
447
+ case BIN(tostring):{
448
+ return depth + 0;
449
+ }
450
+ case BIN(toregexp):{
451
+ int inc = 0;
452
+ int cnt = FIX2INT(opes[1]);
453
+ inc += 1 - cnt;;
454
+ return depth + inc;
455
+ }
456
+ case BIN(newarray):{
457
+ int inc = 0;
458
+ int num = FIX2INT(opes[0]);
459
+ inc += 1 - num;;
460
+ return depth + inc;
461
+ }
462
+ case BIN(duparray):{
463
+ return depth + 1;
464
+ }
465
+ case BIN(expandarray):{
466
+ int inc = 0;
467
+ int num = FIX2INT(opes[0]);
468
+ int flag = FIX2INT(opes[1]);
469
+ inc += num - 1 + (flag & 1 ? 1 : 0);;
470
+ return depth + inc;
471
+ }
472
+ case BIN(concatarray):{
473
+ return depth + -1;
474
+ }
475
+ case BIN(splatarray):{
476
+ return depth + 0;
477
+ }
478
+ case BIN(newhash):{
479
+ int inc = 0;
480
+ int num = FIX2INT(opes[0]);
481
+ inc += 1 - num;;
482
+ return depth + inc;
483
+ }
484
+ case BIN(newrange):{
485
+ return depth + -1;
486
+ }
487
+ case BIN(pop):{
488
+ return depth + -1;
489
+ }
490
+ case BIN(dup):{
491
+ return depth + 1;
492
+ }
493
+ case BIN(dupn):{
494
+ int inc = 0;
495
+ int n = FIX2INT(opes[0]);
496
+ inc += n;;
497
+ return depth + inc;
498
+ }
499
+ case BIN(swap):{
500
+ return depth + 0;
501
+ }
502
+ case BIN(reput):{
503
+ int inc = 0;
504
+ inc += 0;;
505
+ return depth + inc;
506
+ }
507
+ case BIN(topn):{
508
+ int inc = 0;
509
+ inc += 1;;
510
+ return depth + inc;
511
+ }
512
+ case BIN(setn):{
513
+ int inc = 0;
514
+ inc += 0;
515
+ return depth + inc;
516
+ }
517
+ case BIN(adjuststack):{
518
+ int inc = 0;
519
+ int n = FIX2INT(opes[0]);
520
+ inc -= n;
521
+ return depth + inc;
522
+ }
523
+ case BIN(defined):{
524
+ return depth + 0;
525
+ }
526
+ case BIN(checkmatch):{
527
+ return depth + -1;
528
+ }
529
+ case BIN(trace):{
530
+ return depth + 0;
531
+ }
532
+ case BIN(defineclass):{
533
+ return depth + -1;
534
+ }
535
+ case BIN(send):{
536
+ int inc = 0;
537
+ CALL_INFO ci = (CALL_INFO)(opes[0]);
538
+ inc += - (int)(ci->orig_argc + ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0));;
539
+ return depth + inc;
540
+ }
541
+ case BIN(opt_send_simple):{
542
+ int inc = 0;
543
+ CALL_INFO ci = (CALL_INFO)(opes[0]);
544
+ inc += -ci->orig_argc;;
545
+ return depth + inc;
546
+ }
547
+ case BIN(invokesuper):{
548
+ int inc = 0;
549
+ CALL_INFO ci = (CALL_INFO)(opes[0]);
550
+ inc += - (int)(ci->orig_argc + ((ci->flag & VM_CALL_ARGS_BLOCKARG) ? 1 : 0));;
551
+ return depth + inc;
552
+ }
553
+ case BIN(invokeblock):{
554
+ int inc = 0;
555
+ CALL_INFO ci = (CALL_INFO)(opes[0]);
556
+ inc += 1 - ci->orig_argc;;
557
+ return depth + inc;
558
+ }
559
+ case BIN(leave):{
560
+ return depth + 0;
561
+ }
562
+ case BIN(throw):{
563
+ return depth + 0;
564
+ }
565
+ case BIN(jump):{
566
+ return depth + 0;
567
+ }
568
+ case BIN(branchif):{
569
+ return depth + -1;
570
+ }
571
+ case BIN(branchunless):{
572
+ return depth + -1;
573
+ }
574
+ case BIN(getinlinecache):{
575
+ return depth + 1;
576
+ }
577
+ case BIN(onceinlinecache):{
578
+ return depth + 1;
579
+ }
580
+ case BIN(setinlinecache):{
581
+ return depth + 0;
582
+ }
583
+ case BIN(opt_case_dispatch):{
584
+ int inc = 0;
585
+ inc += -1;;
586
+ return depth + inc;
587
+ }
588
+ case BIN(opt_plus):{
589
+ return depth + -1;
590
+ }
591
+ case BIN(opt_minus):{
592
+ return depth + -1;
593
+ }
594
+ case BIN(opt_mult):{
595
+ return depth + -1;
596
+ }
597
+ case BIN(opt_div):{
598
+ return depth + -1;
599
+ }
600
+ case BIN(opt_mod):{
601
+ return depth + -1;
602
+ }
603
+ case BIN(opt_eq):{
604
+ return depth + -1;
605
+ }
606
+ case BIN(opt_neq):{
607
+ return depth + -1;
608
+ }
609
+ case BIN(opt_lt):{
610
+ return depth + -1;
611
+ }
612
+ case BIN(opt_le):{
613
+ return depth + -1;
614
+ }
615
+ case BIN(opt_gt):{
616
+ return depth + -1;
617
+ }
618
+ case BIN(opt_ge):{
619
+ return depth + -1;
620
+ }
621
+ case BIN(opt_ltlt):{
622
+ return depth + -1;
623
+ }
624
+ case BIN(opt_aref):{
625
+ return depth + -1;
626
+ }
627
+ case BIN(opt_aset):{
628
+ return depth + -2;
629
+ }
630
+ case BIN(opt_length):{
631
+ return depth + 0;
632
+ }
633
+ case BIN(opt_size):{
634
+ return depth + 0;
635
+ }
636
+ case BIN(opt_empty_p):{
637
+ return depth + 0;
638
+ }
639
+ case BIN(opt_succ):{
640
+ return depth + 0;
641
+ }
642
+ case BIN(opt_not):{
643
+ return depth + 0;
644
+ }
645
+ case BIN(opt_regexpmatch1):{
646
+ return depth + 0;
647
+ }
648
+ case BIN(opt_regexpmatch2):{
649
+ return depth + -1;
650
+ }
651
+ case BIN(opt_call_c_function):{
652
+ return depth + 0;
653
+ }
654
+ case BIN(bitblt):{
655
+ return depth + 1;
656
+ }
657
+ case BIN(answer):{
658
+ return depth + 1;
659
+ }
660
+ case BIN(getlocal_OP__WC__0):{
661
+ return depth + 1;
662
+ }
663
+ case BIN(getlocal_OP__WC__1):{
664
+ return depth + 1;
665
+ }
666
+ case BIN(setlocal_OP__WC__0):{
667
+ return depth + -1;
668
+ }
669
+ case BIN(setlocal_OP__WC__1):{
670
+ return depth + -1;
671
+ }
672
+ case BIN(putobject_OP_INT2FIX_O_0_C_):{
673
+ return depth + 1;
674
+ }
675
+ case BIN(putobject_OP_INT2FIX_O_1_C_):{
676
+ return depth + 1;
677
+ }
678
+
679
+ default:
680
+ rb_bug("insn_sp_increase: unreachable");
681
+ }
682
+ return 0;
683
+ }
684
+ #endif
685
+
686
+ /* some utilities */
687
+
688
+ static int
689
+ insn_len(VALUE insn)
690
+ {
691
+ return insn_len_info[(int)insn];
692
+ }
693
+
694
+ static const char *
695
+ insn_name(VALUE insn)
696
+ {
697
+ return insn_name_info[(int)insn];
698
+ }
699
+
700
+ static const char *
701
+ insn_op_types(VALUE insn)
702
+ {
703
+ return insn_operand_info[(int)insn];
704
+ }
705
+
706
+ static int
707
+ insn_op_type(VALUE insn, long pos)
708
+ {
709
+ int len = insn_len(insn) - 1;
710
+ if(pos < len){
711
+ return insn_operand_info[(int)insn][pos];
712
+ }
713
+ else{
714
+ return 0;
715
+ }
716
+ }
717
+
718
+ #ifdef USE_INSN_RET_NUM
719
+ static int
720
+ insn_ret_num(VALUE insn)
721
+ {
722
+ return insn_stack_push_num_info[(int)insn];
723
+ }
724
+ #endif