debase-ruby_core_source 0.10.9 → 0.10.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +1 -1
  4. data/debase-ruby_core_source.gemspec +3 -2
  5. data/lib/debase/ruby_core_source.rb +0 -2
  6. data/lib/debase/ruby_core_source/version.rb +1 -1
  7. metadata +22 -113
  8. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/addr2line.h +0 -21
  9. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/build_assert/build_assert.h +0 -40
  10. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/check_type/check_type.h +0 -63
  11. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/container_of/container_of.h +0 -142
  12. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/list/list.h +0 -788
  13. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ccan/str/str.h +0 -16
  14. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/constant.h +0 -54
  15. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/debug_counter.h +0 -378
  16. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/dln.h +0 -51
  17. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/encindex.h +0 -69
  18. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/eval_intern.h +0 -314
  19. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/gc.h +0 -129
  20. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/hrtime.h +0 -168
  21. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/id.h +0 -292
  22. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/id_table.h +0 -34
  23. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/insns.inc +0 -249
  24. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/insns_info.inc +0 -9614
  25. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/internal.h +0 -2682
  26. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/iseq.h +0 -312
  27. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/known_errors.inc +0 -791
  28. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/method.h +0 -232
  29. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/mjit.h +0 -179
  30. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/mjit_compile.inc +0 -7883
  31. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/node.h +0 -483
  32. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/node_name.inc +0 -210
  33. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/opt_sc.inc +0 -109
  34. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/optinsn.inc +0 -128
  35. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/optunifs.inc +0 -43
  36. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/parse.h +0 -210
  37. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/probes_helper.h +0 -42
  38. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/regenc.h +0 -254
  39. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/regint.h +0 -938
  40. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/regparse.h +0 -370
  41. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/revision.h +0 -2
  42. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ruby_assert.h +0 -15
  43. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ruby_atomic.h +0 -244
  44. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/siphash.h +0 -48
  45. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/symbol.h +0 -119
  46. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/thread_pthread.h +0 -75
  47. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/thread_win32.h +0 -36
  48. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/timev.h +0 -56
  49. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/transcode_data.h +0 -139
  50. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/transient_heap.h +0 -62
  51. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/version.h +0 -77
  52. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm.inc +0 -5269
  53. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_call_iseq_optimized.inc +0 -237
  54. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_core.h +0 -1955
  55. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_debug.h +0 -34
  56. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_exec.h +0 -193
  57. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_insnhelper.h +0 -255
  58. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_opts.h +0 -70
  59. data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vmtc.inc +0 -243
  60. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/addr2line.h +0 -21
  61. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/builtin.h +0 -68
  62. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/ccan/build_assert/build_assert.h +0 -40
  63. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/ccan/check_type/check_type.h +0 -63
  64. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/ccan/container_of/container_of.h +0 -142
  65. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/ccan/list/list.h +0 -788
  66. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/ccan/str/str.h +0 -16
  67. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/constant.h +0 -50
  68. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/debug_counter.h +0 -378
  69. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/dln.h +0 -51
  70. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/encindex.h +0 -69
  71. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/eval_intern.h +0 -311
  72. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/gc.h +0 -129
  73. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/hrtime.h +0 -168
  74. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/id.h +0 -290
  75. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/id_table.h +0 -34
  76. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/insns.inc +0 -253
  77. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/insns_info.inc +0 -9196
  78. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/internal.h +0 -2657
  79. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/iseq.h +0 -311
  80. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/known_errors.inc +0 -791
  81. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/method.h +0 -228
  82. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/mjit.h +0 -175
  83. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/mjit_compile.inc +0 -7782
  84. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/node.h +0 -476
  85. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/node_name.inc +0 -208
  86. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/opt_sc.inc +0 -109
  87. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/optinsn.inc +0 -128
  88. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/optunifs.inc +0 -43
  89. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/parse.h +0 -210
  90. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/probes_helper.h +0 -42
  91. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/regenc.h +0 -254
  92. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/regint.h +0 -938
  93. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/regparse.h +0 -370
  94. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/revision.h +0 -2
  95. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/ruby_assert.h +0 -15
  96. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/ruby_atomic.h +0 -244
  97. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/siphash.h +0 -48
  98. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/symbol.h +0 -119
  99. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/thread_pthread.h +0 -75
  100. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/thread_win32.h +0 -36
  101. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/timev.h +0 -56
  102. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/transcode_data.h +0 -139
  103. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/transient_heap.h +0 -62
  104. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/version.h +0 -77
  105. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/vm.inc +0 -5319
  106. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/vm_call_iseq_optimized.inc +0 -237
  107. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/vm_core.h +0 -1957
  108. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/vm_debug.h +0 -34
  109. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/vm_exec.h +0 -193
  110. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/vm_insnhelper.h +0 -255
  111. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/vm_opts.h +0 -72
  112. data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/vmtc.inc +0 -247
@@ -1,34 +0,0 @@
1
- /**********************************************************************
2
-
3
- vm_debug.h - YARV Debug function interface
4
-
5
- $Author$
6
- created at: 04/08/25 02:33:49 JST
7
-
8
- Copyright (C) 2004-2007 Koichi Sasada
9
-
10
- **********************************************************************/
11
-
12
- #ifndef RUBY_DEBUG_H
13
- #define RUBY_DEBUG_H
14
-
15
- #include "ruby/ruby.h"
16
- #include "node.h"
17
-
18
- RUBY_SYMBOL_EXPORT_BEGIN
19
-
20
- #define dpv(h,v) ruby_debug_print_value(-1, 0, (h), (v))
21
- #define dp(v) ruby_debug_print_value(-1, 0, "", (v))
22
- #define dpi(i) ruby_debug_print_id(-1, 0, "", (i))
23
- #define dpn(n) ruby_debug_print_node(-1, 0, "", (n))
24
-
25
- VALUE ruby_debug_print_value(int level, int debug_level, const char *header, VALUE v);
26
- ID ruby_debug_print_id(int level, int debug_level, const char *header, ID id);
27
- NODE *ruby_debug_print_node(int level, int debug_level, const char *header, const NODE *node);
28
- int ruby_debug_print_indent(int level, int debug_level, int indent_level);
29
- void ruby_debug_gc_check_func(void);
30
- void ruby_set_debug_option(const char *str);
31
-
32
- RUBY_SYMBOL_EXPORT_END
33
-
34
- #endif /* RUBY_DEBUG_H */
@@ -1,193 +0,0 @@
1
- /**********************************************************************
2
-
3
- vm.h -
4
-
5
- $Author$
6
- created at: 04/01/01 16:56:59 JST
7
-
8
- Copyright (C) 2004-2007 Koichi Sasada
9
-
10
- **********************************************************************/
11
-
12
- #ifndef RUBY_VM_EXEC_H
13
- #define RUBY_VM_EXEC_H
14
-
15
- typedef long OFFSET;
16
- typedef unsigned long lindex_t;
17
- typedef VALUE GENTRY;
18
- typedef rb_iseq_t *ISEQ;
19
-
20
- #if VMDEBUG > 0
21
- #define debugs printf
22
- #define DEBUG_ENTER_INSN(insn) \
23
- rb_vmdebug_debug_print_pre(ec, GET_CFP(), GET_PC());
24
-
25
- #if OPT_STACK_CACHING
26
- #define SC_REGS() , reg_a, reg_b
27
- #else
28
- #define SC_REGS()
29
- #endif
30
-
31
- #define DEBUG_END_INSN() \
32
- rb_vmdebug_debug_print_post(ec, GET_CFP() SC_REGS());
33
-
34
- #else
35
-
36
- #define debugs
37
- #define DEBUG_ENTER_INSN(insn)
38
- #define DEBUG_END_INSN()
39
- #endif
40
-
41
- #define throwdebug if(0)printf
42
- /* #define throwdebug printf */
43
-
44
- /************************************************/
45
- #if defined(DISPATCH_XXX)
46
- error !
47
- /************************************************/
48
- #elif OPT_CALL_THREADED_CODE
49
-
50
- #define LABEL(x) insn_func_##x
51
- #define ELABEL(x)
52
- #define LABEL_PTR(x) &LABEL(x)
53
-
54
- #define INSN_ENTRY(insn) \
55
- static rb_control_frame_t * \
56
- FUNC_FASTCALL(LABEL(insn))(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp) {
57
-
58
- #define END_INSN(insn) return reg_cfp;}
59
-
60
- #define NEXT_INSN() return reg_cfp;
61
-
62
- #define START_OF_ORIGINAL_INSN(x) /* ignore */
63
- #define DISPATCH_ORIGINAL_INSN(x) return LABEL(x)(ec, reg_cfp);
64
-
65
- /************************************************/
66
- #elif OPT_TOKEN_THREADED_CODE || OPT_DIRECT_THREADED_CODE
67
- /* threaded code with gcc */
68
-
69
- #define LABEL(x) INSN_LABEL_##x
70
- #define ELABEL(x) INSN_ELABEL_##x
71
- #define LABEL_PTR(x) RB_GNUC_EXTENSION(&&LABEL(x))
72
-
73
- #define INSN_ENTRY_SIG(insn) \
74
- if (0) fprintf(stderr, "exec: %s@(%"PRIdPTRDIFF", %"PRIdPTRDIFF")@%s:%u\n", #insn, \
75
- (reg_pc - reg_cfp->iseq->body->iseq_encoded), \
76
- (reg_cfp->pc - reg_cfp->iseq->body->iseq_encoded), \
77
- RSTRING_PTR(rb_iseq_path(reg_cfp->iseq)), \
78
- rb_iseq_line_no(reg_cfp->iseq, reg_pc - reg_cfp->iseq->body->iseq_encoded));
79
-
80
- #define INSN_DISPATCH_SIG(insn)
81
-
82
- #define INSN_ENTRY(insn) \
83
- LABEL(insn): \
84
- INSN_ENTRY_SIG(insn); \
85
-
86
- /**********************************/
87
- #if OPT_DIRECT_THREADED_CODE
88
-
89
- /* for GCC 3.4.x */
90
- #define TC_DISPATCH(insn) \
91
- INSN_DISPATCH_SIG(insn); \
92
- RB_GNUC_EXTENSION_BLOCK(goto *(void const *)GET_CURRENT_INSN()); \
93
- ;
94
-
95
- #else
96
- /* token threaded code */
97
-
98
- /* dispatcher */
99
- #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && __GNUC__ == 3
100
- #define DISPATCH_ARCH_DEPEND_WAY(addr) \
101
- __asm__ __volatile__("jmp *%0;\t# -- inserted by vm.h\t[length = 2]" : : "r" (addr))
102
-
103
- #else
104
- #define DISPATCH_ARCH_DEPEND_WAY(addr) \
105
- /* do nothing */
106
- #endif
107
- #define TC_DISPATCH(insn) \
108
- DISPATCH_ARCH_DEPEND_WAY(insns_address_table[GET_CURRENT_INSN()]); \
109
- INSN_DISPATCH_SIG(insn); \
110
- RB_GNUC_EXTENSION_BLOCK(goto *insns_address_table[GET_CURRENT_INSN()]); \
111
- rb_bug("tc error");
112
-
113
- #endif /* OPT_DIRECT_THREADED_CODE */
114
-
115
- #define END_INSN(insn) \
116
- DEBUG_END_INSN(); \
117
- TC_DISPATCH(insn);
118
-
119
- #define INSN_DISPATCH() \
120
- TC_DISPATCH(__START__) \
121
- {
122
-
123
- #define END_INSNS_DISPATCH() \
124
- rb_bug("unknown insn: %"PRIdVALUE, GET_CURRENT_INSN()); \
125
- } /* end of while loop */ \
126
-
127
- #define NEXT_INSN() TC_DISPATCH(__NEXT_INSN__)
128
-
129
- #define START_OF_ORIGINAL_INSN(x) start_of_##x:
130
- #define DISPATCH_ORIGINAL_INSN(x) goto start_of_##x;
131
-
132
- /************************************************/
133
- #else /* no threaded code */
134
- /* most common method */
135
-
136
- #define INSN_ENTRY(insn) \
137
- case BIN(insn):
138
-
139
- #define END_INSN(insn) \
140
- DEBUG_END_INSN(); \
141
- break;
142
-
143
- #define INSN_DISPATCH() \
144
- while (1) { \
145
- switch (GET_CURRENT_INSN()) {
146
-
147
- #define END_INSNS_DISPATCH() \
148
- default: \
149
- SDR(); \
150
- rb_bug("unknown insn: %ld", GET_CURRENT_INSN()); \
151
- } /* end of switch */ \
152
- } /* end of while loop */ \
153
-
154
- #define NEXT_INSN() goto first
155
-
156
- #define START_OF_ORIGINAL_INSN(x) start_of_##x:
157
- #define DISPATCH_ORIGINAL_INSN(x) goto start_of_##x;
158
-
159
- #endif
160
-
161
- #define VM_SP_CNT(ec, sp) ((sp) - (ec)->vm_stack)
162
-
163
- #ifdef MJIT_HEADER
164
- #define THROW_EXCEPTION(exc) do { \
165
- ec->errinfo = (VALUE)(exc); \
166
- EC_JUMP_TAG(ec, ec->tag->state); \
167
- } while (0)
168
- #else
169
- #if OPT_CALL_THREADED_CODE
170
- #define THROW_EXCEPTION(exc) do { \
171
- ec->errinfo = (VALUE)(exc); \
172
- return 0; \
173
- } while (0)
174
- #else
175
- #define THROW_EXCEPTION(exc) return (VALUE)(exc)
176
- #endif
177
- #endif
178
-
179
- #define SCREG(r) (reg_##r)
180
-
181
- #define VM_DEBUG_STACKOVERFLOW 0
182
-
183
- #if VM_DEBUG_STACKOVERFLOW
184
- #define CHECK_VM_STACK_OVERFLOW_FOR_INSN(cfp, margin) \
185
- WHEN_VM_STACK_OVERFLOWED(cfp, (cfp)->sp, margin) vm_stack_overflow_for_insn()
186
- #else
187
- #define CHECK_VM_STACK_OVERFLOW_FOR_INSN(cfp, margin)
188
- #endif
189
-
190
- #define INSN_LABEL2(insn, name) INSN_LABEL_ ## insn ## _ ## name
191
- #define INSN_LABEL(x) INSN_LABEL2(NAME_OF_CURRENT_INSN, x)
192
-
193
- #endif /* RUBY_VM_EXEC_H */
@@ -1,255 +0,0 @@
1
- /**********************************************************************
2
-
3
- insnhelper.h - helper macros to implement each instructions
4
-
5
- $Author$
6
- created at: 04/01/01 15:50:34 JST
7
-
8
- Copyright (C) 2004-2007 Koichi Sasada
9
-
10
- **********************************************************************/
11
-
12
- #ifndef RUBY_INSNHELPER_H
13
- #define RUBY_INSNHELPER_H
14
-
15
- RUBY_SYMBOL_EXPORT_BEGIN
16
-
17
- RUBY_EXTERN VALUE ruby_vm_const_missing_count;
18
- RUBY_EXTERN rb_serial_t ruby_vm_global_method_state;
19
- RUBY_EXTERN rb_serial_t ruby_vm_global_constant_state;
20
- RUBY_EXTERN rb_serial_t ruby_vm_class_serial;
21
-
22
- RUBY_SYMBOL_EXPORT_END
23
-
24
- #if VM_COLLECT_USAGE_DETAILS
25
- #define COLLECT_USAGE_INSN(insn) vm_collect_usage_insn(insn)
26
- #define COLLECT_USAGE_OPERAND(insn, n, op) vm_collect_usage_operand((insn), (n), ((VALUE)(op)))
27
-
28
- #define COLLECT_USAGE_REGISTER(reg, s) vm_collect_usage_register((reg), (s))
29
- #else
30
- #define COLLECT_USAGE_INSN(insn) /* none */
31
- #define COLLECT_USAGE_OPERAND(insn, n, op) /* none */
32
- #define COLLECT_USAGE_REGISTER(reg, s) /* none */
33
- #endif
34
-
35
- /**********************************************************/
36
- /* deal with stack */
37
- /**********************************************************/
38
-
39
- #define PUSH(x) (SET_SV(x), INC_SP(1))
40
- #define TOPN(n) (*(GET_SP()-(n)-1))
41
- #define POPN(n) (DEC_SP(n))
42
- #define POP() (DEC_SP(1))
43
- #define STACK_ADDR_FROM_TOP(n) (GET_SP()-(n))
44
-
45
- /**********************************************************/
46
- /* deal with registers */
47
- /**********************************************************/
48
-
49
- #define VM_REG_CFP (reg_cfp)
50
- #define VM_REG_PC (VM_REG_CFP->pc)
51
- #define VM_REG_SP (VM_REG_CFP->sp)
52
- #define VM_REG_EP (VM_REG_CFP->ep)
53
-
54
- #define RESTORE_REGS() do { \
55
- VM_REG_CFP = ec->cfp; \
56
- } while (0)
57
-
58
- #if VM_COLLECT_USAGE_DETAILS
59
- enum vm_regan_regtype {
60
- VM_REGAN_PC = 0,
61
- VM_REGAN_SP = 1,
62
- VM_REGAN_EP = 2,
63
- VM_REGAN_CFP = 3,
64
- VM_REGAN_SELF = 4,
65
- VM_REGAN_ISEQ = 5
66
- };
67
- enum vm_regan_acttype {
68
- VM_REGAN_ACT_GET = 0,
69
- VM_REGAN_ACT_SET = 1
70
- };
71
-
72
- #define COLLECT_USAGE_REGISTER_HELPER(a, b, v) \
73
- (COLLECT_USAGE_REGISTER((VM_REGAN_##a), (VM_REGAN_ACT_##b)), (v))
74
- #else
75
- #define COLLECT_USAGE_REGISTER_HELPER(a, b, v) (v)
76
- #endif
77
-
78
- /* PC */
79
- #define GET_PC() (COLLECT_USAGE_REGISTER_HELPER(PC, GET, VM_REG_PC))
80
- #define SET_PC(x) (VM_REG_PC = (COLLECT_USAGE_REGISTER_HELPER(PC, SET, (x))))
81
- #define GET_CURRENT_INSN() (*GET_PC())
82
- #define GET_OPERAND(n) (GET_PC()[(n)])
83
- #define ADD_PC(n) (SET_PC(VM_REG_PC + (n)))
84
- #define JUMP(dst) (SET_PC(VM_REG_PC + (dst)))
85
-
86
- /* frame pointer, environment pointer */
87
- #define GET_CFP() (COLLECT_USAGE_REGISTER_HELPER(CFP, GET, VM_REG_CFP))
88
- #define GET_EP() (COLLECT_USAGE_REGISTER_HELPER(EP, GET, VM_REG_EP))
89
- #define SET_EP(x) (VM_REG_EP = (COLLECT_USAGE_REGISTER_HELPER(EP, SET, (x))))
90
- #define GET_LEP() (VM_EP_LEP(GET_EP()))
91
-
92
- /* SP */
93
- #define GET_SP() (COLLECT_USAGE_REGISTER_HELPER(SP, GET, VM_REG_SP))
94
- #define SET_SP(x) (VM_REG_SP = (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
95
- #define INC_SP(x) (VM_REG_SP += (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
96
- #define DEC_SP(x) (VM_REG_SP -= (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
97
- #define SET_SV(x) (*GET_SP() = (x))
98
- /* set current stack value as x */
99
-
100
- /* instruction sequence C struct */
101
- #define GET_ISEQ() (GET_CFP()->iseq)
102
-
103
- /**********************************************************/
104
- /* deal with variables */
105
- /**********************************************************/
106
-
107
- #define GET_PREV_EP(ep) ((VALUE *)((ep)[VM_ENV_DATA_INDEX_SPECVAL] & ~0x03))
108
-
109
- /**********************************************************/
110
- /* deal with values */
111
- /**********************************************************/
112
-
113
- #define GET_SELF() (COLLECT_USAGE_REGISTER_HELPER(SELF, GET, GET_CFP()->self))
114
-
115
- /**********************************************************/
116
- /* deal with control flow 2: method/iterator */
117
- /**********************************************************/
118
-
119
- /* set fastpath when cached method is *NOT* protected
120
- * because inline method cache does not care about receiver.
121
- */
122
-
123
- #define CC_SET_FASTPATH(cc, func, enabled) do { \
124
- if (LIKELY(enabled)) ((cc)->call = (func)); \
125
- } while (0)
126
-
127
- #define GET_BLOCK_HANDLER() (GET_LEP()[VM_ENV_DATA_INDEX_SPECVAL])
128
-
129
- /**********************************************************/
130
- /* deal with control flow 3: exception */
131
- /**********************************************************/
132
-
133
-
134
- /**********************************************************/
135
- /* deal with stack canary */
136
- /**********************************************************/
137
-
138
- #if VM_CHECK_MODE > 0
139
- #define SETUP_CANARY() \
140
- VALUE *canary; \
141
- if (leaf) { \
142
- canary = GET_SP(); \
143
- SET_SV(vm_stack_canary); \
144
- } \
145
- else {\
146
- SET_SV(Qfalse); /* cleanup */ \
147
- }
148
- #define CHECK_CANARY() \
149
- if (leaf) { \
150
- if (*canary == vm_stack_canary) { \
151
- *canary = Qfalse; /* cleanup */ \
152
- } \
153
- else { \
154
- vm_canary_is_found_dead(INSN_ATTR(bin), *canary); \
155
- } \
156
- }
157
- #else
158
- #define SETUP_CANARY() /* void */
159
- #define CHECK_CANARY() /* void */
160
- #endif
161
-
162
- /**********************************************************/
163
- /* others */
164
- /**********************************************************/
165
-
166
- #ifndef MJIT_HEADER
167
- #define CALL_SIMPLE_METHOD() do { \
168
- rb_snum_t x = leaf ? INSN_ATTR(width) : 0; \
169
- rb_snum_t y = attr_width_opt_send_without_block(0, 0); \
170
- rb_snum_t z = x - y; \
171
- ADD_PC(z); \
172
- DISPATCH_ORIGINAL_INSN(opt_send_without_block); \
173
- } while (0)
174
- #endif
175
-
176
- #define NEXT_CLASS_SERIAL() (++ruby_vm_class_serial)
177
- #define GET_GLOBAL_METHOD_STATE() (ruby_vm_global_method_state)
178
- #define INC_GLOBAL_METHOD_STATE() (++ruby_vm_global_method_state)
179
- #define GET_GLOBAL_CONSTANT_STATE() (ruby_vm_global_constant_state)
180
- #define INC_GLOBAL_CONSTANT_STATE() (++ruby_vm_global_constant_state)
181
-
182
- static inline struct vm_throw_data *
183
- THROW_DATA_NEW(VALUE val, const rb_control_frame_t *cf, int st)
184
- {
185
- struct vm_throw_data *obj = (struct vm_throw_data *)rb_imemo_new(imemo_throw_data, val, (VALUE)cf, 0, 0);
186
- obj->throw_state = st;
187
- return obj;
188
- }
189
-
190
- static inline VALUE
191
- THROW_DATA_VAL(const struct vm_throw_data *obj)
192
- {
193
- VM_ASSERT(THROW_DATA_P(obj));
194
- return obj->throw_obj;
195
- }
196
-
197
- static inline const rb_control_frame_t *
198
- THROW_DATA_CATCH_FRAME(const struct vm_throw_data *obj)
199
- {
200
- VM_ASSERT(THROW_DATA_P(obj));
201
- return obj->catch_frame;
202
- }
203
-
204
- static inline int
205
- THROW_DATA_STATE(const struct vm_throw_data *obj)
206
- {
207
- VM_ASSERT(THROW_DATA_P(obj));
208
- return obj->throw_state;
209
- }
210
-
211
- static inline int
212
- THROW_DATA_CONSUMED_P(const struct vm_throw_data *obj)
213
- {
214
- VM_ASSERT(THROW_DATA_P(obj));
215
- return obj->flags & THROW_DATA_CONSUMED;
216
- }
217
-
218
- static inline void
219
- THROW_DATA_CATCH_FRAME_SET(struct vm_throw_data *obj, const rb_control_frame_t *cfp)
220
- {
221
- VM_ASSERT(THROW_DATA_P(obj));
222
- obj->catch_frame = cfp;
223
- }
224
-
225
- static inline void
226
- THROW_DATA_STATE_SET(struct vm_throw_data *obj, int st)
227
- {
228
- VM_ASSERT(THROW_DATA_P(obj));
229
- obj->throw_state = st;
230
- }
231
-
232
- static inline void
233
- THROW_DATA_CONSUMED_SET(struct vm_throw_data *obj)
234
- {
235
- if (THROW_DATA_P(obj) &&
236
- THROW_DATA_STATE(obj) == TAG_BREAK) {
237
- obj->flags |= THROW_DATA_CONSUMED;
238
- }
239
- }
240
-
241
- #define IS_ARGS_SPLAT(ci) ((ci)->flag & VM_CALL_ARGS_SPLAT)
242
- #define IS_ARGS_KEYWORD(ci) ((ci)->flag & VM_CALL_KWARG)
243
- #define IS_ARGS_KW_SPLAT(ci) ((ci)->flag & VM_CALL_KW_SPLAT)
244
- #define IS_ARGS_KW_OR_KW_SPLAT(ci) ((ci)->flag & (VM_CALL_KWARG | VM_CALL_KW_SPLAT))
245
-
246
- /* If this returns true, an optimized function returned by `vm_call_iseq_setup_func`
247
- can be used as a fastpath. */
248
- static bool
249
- vm_call_iseq_optimizable_p(const struct rb_call_info *ci, const struct rb_call_cache *cc)
250
- {
251
- return !IS_ARGS_SPLAT(ci) && !IS_ARGS_KEYWORD(ci) &&
252
- !(METHOD_ENTRY_VISI(cc->me) == METHOD_VISI_PROTECTED);
253
- }
254
-
255
- #endif /* RUBY_INSNHELPER_H */