debase-ruby_core_source 0.10.6 → 0.10.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +1 -1
  4. data/Rakefile +6 -3
  5. data/debase-ruby_core_source.gemspec +2 -1
  6. data/lib/debase/ruby_core_source.rb +1 -1
  7. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/addr2line.h +21 -0
  8. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/builtin.h +78 -0
  9. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/build_assert/build_assert.h +40 -0
  10. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/check_type/check_type.h +63 -0
  11. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/container_of/container_of.h +142 -0
  12. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/list/list.h +788 -0
  13. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/str/str.h +16 -0
  14. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/constant.h +50 -0
  15. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/debug_counter.h +390 -0
  16. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/dln.h +51 -0
  17. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/encindex.h +69 -0
  18. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/eval_intern.h +312 -0
  19. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/gc.h +131 -0
  20. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/hrtime.h +168 -0
  21. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/id.h +290 -0
  22. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/id_table.h +34 -0
  23. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/insns.inc +253 -0
  24. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/insns_info.inc +9197 -0
  25. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/internal.h +2697 -0
  26. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/iseq.h +312 -0
  27. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/known_errors.inc +791 -0
  28. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/method.h +229 -0
  29. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/mjit.h +177 -0
  30. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/mjit_compile.inc +7779 -0
  31. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/node.h +476 -0
  32. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/node_name.inc +208 -0
  33. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/opt_sc.inc +109 -0
  34. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/optinsn.inc +128 -0
  35. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/optunifs.inc +43 -0
  36. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/parse.h +210 -0
  37. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/probes_helper.h +42 -0
  38. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/regenc.h +254 -0
  39. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/regint.h +938 -0
  40. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/regparse.h +370 -0
  41. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/revision.h +2 -0
  42. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ruby_assert.h +15 -0
  43. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ruby_atomic.h +244 -0
  44. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/siphash.h +48 -0
  45. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/symbol.h +119 -0
  46. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/thread_pthread.h +75 -0
  47. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/thread_win32.h +36 -0
  48. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/timev.h +56 -0
  49. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/transcode_data.h +139 -0
  50. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/transient_heap.h +62 -0
  51. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/variable.h +9 -0
  52. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/version.h +77 -0
  53. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm.inc +5466 -0
  54. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_call_iseq_optimized.inc +237 -0
  55. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_core.h +1968 -0
  56. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_debug.h +34 -0
  57. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_exec.h +193 -0
  58. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_insnhelper.h +267 -0
  59. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_opts.h +72 -0
  60. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vmtc.inc +247 -0
  61. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/addr2line.h +20 -0
  62. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/builtin.h +83 -0
  63. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/build_assert/build_assert.h +40 -0
  64. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/check_type/check_type.h +63 -0
  65. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/container_of/container_of.h +142 -0
  66. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/list/list.h +788 -0
  67. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/str/str.h +16 -0
  68. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/constant.h +55 -0
  69. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/debug_counter.h +423 -0
  70. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/dln.h +36 -0
  71. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/encindex.h +70 -0
  72. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/eval_intern.h +312 -0
  73. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/gc.h +140 -0
  74. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/hrtime.h +168 -0
  75. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/id.h +290 -0
  76. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/id_table.h +36 -0
  77. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/insns.inc +249 -0
  78. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/insns_info.inc +8979 -0
  79. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal.h +107 -0
  80. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/array.h +114 -0
  81. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/bignum.h +246 -0
  82. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/bits.h +566 -0
  83. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/class.h +168 -0
  84. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/compar.h +50 -0
  85. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/compile.h +32 -0
  86. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/compilers.h +108 -0
  87. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/complex.h +29 -0
  88. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/cont.h +25 -0
  89. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/dir.h +17 -0
  90. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/enc.h +20 -0
  91. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/encoding.h +28 -0
  92. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/enum.h +19 -0
  93. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/enumerator.h +22 -0
  94. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/error.h +131 -0
  95. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/eval.h +33 -0
  96. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/file.h +39 -0
  97. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/fixnum.h +185 -0
  98. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/gc.h +154 -0
  99. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/hash.h +240 -0
  100. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/imemo.h +243 -0
  101. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/inits.h +51 -0
  102. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/io.h +35 -0
  103. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/load.h +19 -0
  104. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/loadpath.h +17 -0
  105. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/math.h +24 -0
  106. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/missing.h +19 -0
  107. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/mjit.h +29 -0
  108. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/numeric.h +252 -0
  109. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/object.h +83 -0
  110. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/parse.h +23 -0
  111. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/proc.h +32 -0
  112. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/process.h +136 -0
  113. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/random.h +17 -0
  114. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/range.h +37 -0
  115. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/rational.h +69 -0
  116. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/re.h +29 -0
  117. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/sanitizers.h +191 -0
  118. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/scheduler.h +35 -0
  119. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/serial.h +24 -0
  120. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/signal.h +22 -0
  121. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/static_assert.h +17 -0
  122. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/string.h +135 -0
  123. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/struct.h +154 -0
  124. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/symbol.h +41 -0
  125. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/thread.h +60 -0
  126. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/time.h +35 -0
  127. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/transcode.h +21 -0
  128. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/util.h +31 -0
  129. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/variable.h +83 -0
  130. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/vm.h +135 -0
  131. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/warnings.h +17 -0
  132. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/iseq.h +304 -0
  133. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/known_errors.inc +791 -0
  134. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/method.h +245 -0
  135. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/mjit.h +197 -0
  136. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/mjit_compile.inc +8082 -0
  137. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/node.h +484 -0
  138. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/node_name.inc +210 -0
  139. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/opt_sc.inc +109 -0
  140. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/optinsn.inc +128 -0
  141. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/optunifs.inc +43 -0
  142. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/parse.h +211 -0
  143. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/probes_helper.h +44 -0
  144. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ractor.h +271 -0
  145. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ractor_pub.h +50 -0
  146. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/regenc.h +254 -0
  147. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/regint.h +938 -0
  148. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/regparse.h +370 -0
  149. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/revision.h +2 -0
  150. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ruby_assert.h +15 -0
  151. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ruby_atomic.h +236 -0
  152. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/siphash.h +48 -0
  153. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/symbol.h +119 -0
  154. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/thread_pthread.h +106 -0
  155. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/thread_win32.h +66 -0
  156. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/timev.h +57 -0
  157. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/transcode_data.h +138 -0
  158. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/transient_heap.h +61 -0
  159. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/variable.h +21 -0
  160. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/version.h +89 -0
  161. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm.inc +5360 -0
  162. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_call_iseq_optimized.inc +244 -0
  163. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_callinfo.h +457 -0
  164. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_core.h +1952 -0
  165. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_debug.h +116 -0
  166. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_exec.h +196 -0
  167. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_insnhelper.h +260 -0
  168. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_opts.h +73 -0
  169. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_sync.h +97 -0
  170. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vmtc.inc +243 -0
  171. data/lib/debase/ruby_core_source/version.rb +1 -1
  172. metadata +183 -5
@@ -0,0 +1,116 @@
1
+ #ifndef RUBY_DEBUG_H
2
+ #define RUBY_DEBUG_H
3
+ /**********************************************************************
4
+
5
+ vm_debug.h - YARV Debug function interface
6
+
7
+ $Author$
8
+ created at: 04/08/25 02:33:49 JST
9
+
10
+ Copyright (C) 2004-2007 Koichi Sasada
11
+
12
+ **********************************************************************/
13
+
14
+ #include "ruby/ruby.h"
15
+ #include "node.h"
16
+
17
+ RUBY_SYMBOL_EXPORT_BEGIN
18
+
19
+ #define dpv(h,v) ruby_debug_print_value(-1, 0, (h), (v))
20
+ #define dp(v) ruby_debug_print_value(-1, 0, "", (v))
21
+ #define dpi(i) ruby_debug_print_id(-1, 0, "", (i))
22
+ #define dpn(n) ruby_debug_print_node(-1, 0, "", (n))
23
+
24
+ VALUE ruby_debug_print_value(int level, int debug_level, const char *header, VALUE v);
25
+ ID ruby_debug_print_id(int level, int debug_level, const char *header, ID id);
26
+ NODE *ruby_debug_print_node(int level, int debug_level, const char *header, const NODE *node);
27
+ int ruby_debug_print_indent(int level, int debug_level, int indent_level);
28
+ void ruby_debug_gc_check_func(void);
29
+ void ruby_set_debug_option(const char *str);
30
+
31
+ RUBY_SYMBOL_EXPORT_END
32
+
33
+ #if RUBY_DEVEL
34
+ #ifndef USE_RUBY_DEBUG_LOG
35
+ #define USE_RUBY_DEBUG_LOG 0
36
+ #endif
37
+ #else
38
+ // disable on !RUBY_DEVEL
39
+ #ifdef USE_RUBY_DEBUG_LOG
40
+ #undef USE_RUBY_DEBUG_LOG
41
+ #endif
42
+ #endif
43
+
44
+ /* RUBY_DEBUG_LOG: Logging debug information mechanism
45
+ *
46
+ * This feature provides a mechanism to store logging information
47
+ * to a file, stderr or memory space with simple macros.
48
+ *
49
+ * The following information will be stored.
50
+ * * (1) __FILE__, __LINE__ in C
51
+ * * (2) __FILE__, __LINE__ in Ruby
52
+ * * (3) __func__ in C (message title)
53
+ * * (4) given string with sprintf format
54
+ * * (5) Thread number (if multiple threads are running)
55
+ *
56
+ * This feature is enabled only USE_RUBY_DEBUG_LOG is enabled.
57
+ * Release version should not enable it.
58
+ *
59
+ * Running with the `RUBY_DEBUG_LOG` environment variable enables
60
+ * this feature.
61
+ *
62
+ * # logging into a file
63
+ * RUBY_DEBUG_LOG=/path/to/file STDERR
64
+ *
65
+ * # logging into STDERR
66
+ * RUBY_DEBUG_LOG=stderr
67
+ *
68
+ * # logging into memory space (check with a debugger)
69
+ * # It will help if the timing is important.
70
+ * RUBY_DEBUG_LOG=mem
71
+ *
72
+ * RUBY_DEBUG_LOG_FILTER environment variable can specify the filter string.
73
+ * If "(3) __func__ in C (message title)" contains the specified string, the
74
+ * information will be stored (example: RUBY_DEBUG_LOG_FILTER=str will enable
75
+ * only on str related information).
76
+ *
77
+ * In a MRI source code, you can use the following macros:
78
+ * * RUBY_DEBUG_LOG(fmt, ...): Above (1) to (4) will be logged.
79
+ * * RUBY_DEBUG_LOG2(file, line, fmt, ...):
80
+ * Same as RUBY_DEBUG_LOG(), but (1) will be replaced with given file, line.
81
+ */
82
+
83
+ extern enum ruby_debug_log_mode {
84
+ ruby_debug_log_disabled = 0x00,
85
+ ruby_debug_log_memory = 0x01,
86
+ ruby_debug_log_stderr = 0x02,
87
+ ruby_debug_log_file = 0x04,
88
+ } ruby_debug_log_mode;
89
+
90
+ void ruby_debug_log(const char *file, int line, const char *func_name, const char *fmt, ...);
91
+ void ruby_debug_log_print(unsigned int n);
92
+ bool ruby_debug_log_filter(const char *func_name);
93
+
94
+ // convenient macro to log even if the USE_RUBY_DEBUG_LOG macro is not specified.
95
+ // You can use this macro for temporary usage (you should not commit it).
96
+ #define _RUBY_DEBUG_LOG(fmt, ...) ruby_debug_log(__FILE__, __LINE__, __func__, fmt, __VA_ARGS__)
97
+
98
+ #if USE_RUBY_DEBUG_LOG
99
+
100
+ #define RUBY_DEBUG_LOG(fmt, ...) do { \
101
+ if (ruby_debug_log_mode && ruby_debug_log_filter(__func__)) \
102
+ ruby_debug_log(__FILE__, __LINE__, __func__, fmt, __VA_ARGS__); \
103
+ } while (0)
104
+
105
+ #define RUBY_DEBUG_LOG2(file, line, fmt, ...) do { \
106
+ if (ruby_debug_log_mode && ruby_debug_log_filter(__func__)) \
107
+ ruby_debug_log(file, line, __func__, fmt, __VA_ARGS__); \
108
+ } while (0)
109
+
110
+ #else
111
+ // do nothing
112
+ #define RUBY_DEBUG_LOG(fmt, ...)
113
+ #define RUBY_DEBUG_LOG2(file, line, fmt, ...)
114
+ #endif // USE_RUBY_DEBUG_LOG
115
+
116
+ #endif /* RUBY_DEBUG_H */
@@ -0,0 +1,196 @@
1
+ #ifndef RUBY_VM_EXEC_H
2
+ #define RUBY_VM_EXEC_H
3
+ /**********************************************************************
4
+
5
+ vm.h -
6
+
7
+ $Author$
8
+ created at: 04/01/01 16:56:59 JST
9
+
10
+ Copyright (C) 2004-2007 Koichi Sasada
11
+
12
+ **********************************************************************/
13
+
14
+ typedef long OFFSET;
15
+ typedef unsigned long lindex_t;
16
+ typedef VALUE GENTRY;
17
+ typedef rb_iseq_t *ISEQ;
18
+
19
+ #if VMDEBUG > 0
20
+ #define debugs printf
21
+ #define DEBUG_ENTER_INSN(insn) \
22
+ rb_vmdebug_debug_print_pre(ec, GET_CFP(), GET_PC());
23
+
24
+ #if OPT_STACK_CACHING
25
+ #define SC_REGS() , reg_a, reg_b
26
+ #else
27
+ #define SC_REGS()
28
+ #endif
29
+
30
+ #define DEBUG_END_INSN() \
31
+ rb_vmdebug_debug_print_post(ec, GET_CFP() SC_REGS());
32
+
33
+ #else
34
+
35
+ #define debugs
36
+ #define DEBUG_ENTER_INSN(insn)
37
+ #define DEBUG_END_INSN()
38
+ #endif
39
+
40
+ #define throwdebug if(0)printf
41
+ /* #define throwdebug printf */
42
+
43
+ #ifndef USE_INSNS_COUNTER
44
+ #define USE_INSNS_COUNTER 0
45
+ #endif
46
+
47
+ /************************************************/
48
+ #if defined(DISPATCH_XXX)
49
+ error !
50
+ /************************************************/
51
+ #elif OPT_CALL_THREADED_CODE
52
+
53
+ #define LABEL(x) insn_func_##x
54
+ #define ELABEL(x)
55
+ #define LABEL_PTR(x) &LABEL(x)
56
+
57
+ #define INSN_ENTRY(insn) \
58
+ static rb_control_frame_t * \
59
+ FUNC_FASTCALL(LABEL(insn))(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp) {
60
+
61
+ #define END_INSN(insn) return reg_cfp;}
62
+
63
+ #define NEXT_INSN() return reg_cfp;
64
+
65
+ #define START_OF_ORIGINAL_INSN(x) /* ignore */
66
+ #define DISPATCH_ORIGINAL_INSN(x) return LABEL(x)(ec, reg_cfp);
67
+
68
+ /************************************************/
69
+ #elif OPT_TOKEN_THREADED_CODE || OPT_DIRECT_THREADED_CODE
70
+ /* threaded code with gcc */
71
+
72
+ #define LABEL(x) INSN_LABEL_##x
73
+ #define ELABEL(x) INSN_ELABEL_##x
74
+ #define LABEL_PTR(x) RB_GNUC_EXTENSION(&&LABEL(x))
75
+
76
+ #define INSN_ENTRY_SIG(insn) \
77
+ if (0) fprintf(stderr, "exec: %s@(%"PRIdPTRDIFF", %"PRIdPTRDIFF")@%s:%u\n", #insn, \
78
+ (reg_pc - reg_cfp->iseq->body->iseq_encoded), \
79
+ (reg_cfp->pc - reg_cfp->iseq->body->iseq_encoded), \
80
+ RSTRING_PTR(rb_iseq_path(reg_cfp->iseq)), \
81
+ rb_iseq_line_no(reg_cfp->iseq, reg_pc - reg_cfp->iseq->body->iseq_encoded)); \
82
+ if (USE_INSNS_COUNTER) vm_insns_counter_count_insn(BIN(insn));
83
+
84
+ #define INSN_DISPATCH_SIG(insn)
85
+
86
+ #define INSN_ENTRY(insn) \
87
+ LABEL(insn): \
88
+ INSN_ENTRY_SIG(insn); \
89
+
90
+ /**********************************/
91
+ #if OPT_DIRECT_THREADED_CODE
92
+
93
+ /* for GCC 3.4.x */
94
+ #define TC_DISPATCH(insn) \
95
+ INSN_DISPATCH_SIG(insn); \
96
+ RB_GNUC_EXTENSION_BLOCK(goto *(void const *)GET_CURRENT_INSN()); \
97
+ ;
98
+
99
+ #else
100
+ /* token threaded code */
101
+
102
+ /* dispatcher */
103
+ #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && __GNUC__ == 3
104
+ #define DISPATCH_ARCH_DEPEND_WAY(addr) \
105
+ __asm__ __volatile__("jmp *%0;\t# -- inserted by vm.h\t[length = 2]" : : "r" (addr))
106
+
107
+ #else
108
+ #define DISPATCH_ARCH_DEPEND_WAY(addr) \
109
+ /* do nothing */
110
+ #endif
111
+ #define TC_DISPATCH(insn) \
112
+ DISPATCH_ARCH_DEPEND_WAY(insns_address_table[GET_CURRENT_INSN()]); \
113
+ INSN_DISPATCH_SIG(insn); \
114
+ RB_GNUC_EXTENSION_BLOCK(goto *insns_address_table[GET_CURRENT_INSN()]); \
115
+ rb_bug("tc error");
116
+
117
+ #endif /* OPT_DIRECT_THREADED_CODE */
118
+
119
+ #define END_INSN(insn) \
120
+ DEBUG_END_INSN(); \
121
+ TC_DISPATCH(insn);
122
+
123
+ #define INSN_DISPATCH() \
124
+ TC_DISPATCH(__START__) \
125
+ {
126
+
127
+ #define END_INSNS_DISPATCH() \
128
+ rb_bug("unknown insn: %"PRIdVALUE, GET_CURRENT_INSN()); \
129
+ } /* end of while loop */ \
130
+
131
+ #define NEXT_INSN() TC_DISPATCH(__NEXT_INSN__)
132
+
133
+ #define START_OF_ORIGINAL_INSN(x) start_of_##x:
134
+ #define DISPATCH_ORIGINAL_INSN(x) goto start_of_##x;
135
+
136
+ /************************************************/
137
+ #else /* no threaded code */
138
+ /* most common method */
139
+
140
+ #define INSN_ENTRY(insn) \
141
+ case BIN(insn):
142
+
143
+ #define END_INSN(insn) \
144
+ DEBUG_END_INSN(); \
145
+ break;
146
+
147
+ #define INSN_DISPATCH() \
148
+ while (1) { \
149
+ switch (GET_CURRENT_INSN()) {
150
+
151
+ #define END_INSNS_DISPATCH() \
152
+ default: \
153
+ SDR(); \
154
+ rb_bug("unknown insn: %ld", GET_CURRENT_INSN()); \
155
+ } /* end of switch */ \
156
+ } /* end of while loop */ \
157
+
158
+ #define NEXT_INSN() goto first
159
+
160
+ #define START_OF_ORIGINAL_INSN(x) start_of_##x:
161
+ #define DISPATCH_ORIGINAL_INSN(x) goto start_of_##x;
162
+
163
+ #endif
164
+
165
+ #define VM_SP_CNT(ec, sp) ((sp) - (ec)->vm_stack)
166
+
167
+ #ifdef MJIT_HEADER
168
+ #define THROW_EXCEPTION(exc) do { \
169
+ ec->errinfo = (VALUE)(exc); \
170
+ EC_JUMP_TAG(ec, ec->tag->state); \
171
+ } while (0)
172
+ #else
173
+ #if OPT_CALL_THREADED_CODE
174
+ #define THROW_EXCEPTION(exc) do { \
175
+ ec->errinfo = (VALUE)(exc); \
176
+ return 0; \
177
+ } while (0)
178
+ #else
179
+ #define THROW_EXCEPTION(exc) return (VALUE)(exc)
180
+ #endif
181
+ #endif
182
+
183
+ #define SCREG(r) (reg_##r)
184
+
185
+ #define VM_DEBUG_STACKOVERFLOW 0
186
+
187
+ #if VM_DEBUG_STACKOVERFLOW
188
+ #define CHECK_VM_STACK_OVERFLOW_FOR_INSN CHECK_VM_STACK_OVERFLOW
189
+ #else
190
+ #define CHECK_VM_STACK_OVERFLOW_FOR_INSN(cfp, margin)
191
+ #endif
192
+
193
+ #define INSN_LABEL2(insn, name) INSN_LABEL_ ## insn ## _ ## name
194
+ #define INSN_LABEL(x) INSN_LABEL2(NAME_OF_CURRENT_INSN, x)
195
+
196
+ #endif /* RUBY_VM_EXEC_H */
@@ -0,0 +1,260 @@
1
+ #ifndef RUBY_INSNHELPER_H
2
+ #define RUBY_INSNHELPER_H
3
+ /**********************************************************************
4
+
5
+ insnhelper.h - helper macros to implement each instructions
6
+
7
+ $Author$
8
+ created at: 04/01/01 15:50:34 JST
9
+
10
+ Copyright (C) 2004-2007 Koichi Sasada
11
+
12
+ **********************************************************************/
13
+
14
+ RUBY_SYMBOL_EXPORT_BEGIN
15
+
16
+ RUBY_EXTERN VALUE ruby_vm_const_missing_count;
17
+ RUBY_EXTERN rb_serial_t ruby_vm_global_method_state;
18
+ RUBY_EXTERN rb_serial_t ruby_vm_global_constant_state;
19
+ RUBY_EXTERN rb_serial_t ruby_vm_class_serial;
20
+
21
+ RUBY_SYMBOL_EXPORT_END
22
+
23
+ #if VM_COLLECT_USAGE_DETAILS
24
+ #define COLLECT_USAGE_INSN(insn) vm_collect_usage_insn(insn)
25
+ #define COLLECT_USAGE_OPERAND(insn, n, op) vm_collect_usage_operand((insn), (n), ((VALUE)(op)))
26
+
27
+ #define COLLECT_USAGE_REGISTER(reg, s) vm_collect_usage_register((reg), (s))
28
+ #else
29
+ #define COLLECT_USAGE_INSN(insn) /* none */
30
+ #define COLLECT_USAGE_OPERAND(insn, n, op) /* none */
31
+ #define COLLECT_USAGE_REGISTER(reg, s) /* none */
32
+ #endif
33
+
34
+ /**********************************************************/
35
+ /* deal with stack */
36
+ /**********************************************************/
37
+
38
+ #define PUSH(x) (SET_SV(x), INC_SP(1))
39
+ #define TOPN(n) (*(GET_SP()-(n)-1))
40
+ #define POPN(n) (DEC_SP(n))
41
+ #define POP() (DEC_SP(1))
42
+ #define STACK_ADDR_FROM_TOP(n) (GET_SP()-(n))
43
+
44
+ /**********************************************************/
45
+ /* deal with registers */
46
+ /**********************************************************/
47
+
48
+ #define VM_REG_CFP (reg_cfp)
49
+ #define VM_REG_PC (VM_REG_CFP->pc)
50
+ #define VM_REG_SP (VM_REG_CFP->sp)
51
+ #define VM_REG_EP (VM_REG_CFP->ep)
52
+
53
+ #define RESTORE_REGS() do { \
54
+ VM_REG_CFP = ec->cfp; \
55
+ } while (0)
56
+
57
+ #if VM_COLLECT_USAGE_DETAILS
58
+ enum vm_regan_regtype {
59
+ VM_REGAN_PC = 0,
60
+ VM_REGAN_SP = 1,
61
+ VM_REGAN_EP = 2,
62
+ VM_REGAN_CFP = 3,
63
+ VM_REGAN_SELF = 4,
64
+ VM_REGAN_ISEQ = 5
65
+ };
66
+ enum vm_regan_acttype {
67
+ VM_REGAN_ACT_GET = 0,
68
+ VM_REGAN_ACT_SET = 1
69
+ };
70
+
71
+ #define COLLECT_USAGE_REGISTER_HELPER(a, b, v) \
72
+ (COLLECT_USAGE_REGISTER((VM_REGAN_##a), (VM_REGAN_ACT_##b)), (v))
73
+ #else
74
+ #define COLLECT_USAGE_REGISTER_HELPER(a, b, v) (v)
75
+ #endif
76
+
77
+ /* PC */
78
+ #define GET_PC() (COLLECT_USAGE_REGISTER_HELPER(PC, GET, VM_REG_PC))
79
+ #define SET_PC(x) (VM_REG_PC = (COLLECT_USAGE_REGISTER_HELPER(PC, SET, (x))))
80
+ #define GET_CURRENT_INSN() (*GET_PC())
81
+ #define GET_OPERAND(n) (GET_PC()[(n)])
82
+ #define ADD_PC(n) (SET_PC(VM_REG_PC + (n)))
83
+ #define JUMP(dst) (SET_PC(VM_REG_PC + (dst)))
84
+
85
+ /* frame pointer, environment pointer */
86
+ #define GET_CFP() (COLLECT_USAGE_REGISTER_HELPER(CFP, GET, VM_REG_CFP))
87
+ #define GET_EP() (COLLECT_USAGE_REGISTER_HELPER(EP, GET, VM_REG_EP))
88
+ #define SET_EP(x) (VM_REG_EP = (COLLECT_USAGE_REGISTER_HELPER(EP, SET, (x))))
89
+ #define GET_LEP() (VM_EP_LEP(GET_EP()))
90
+
91
+ /* SP */
92
+ #define GET_SP() (COLLECT_USAGE_REGISTER_HELPER(SP, GET, VM_REG_SP))
93
+ #define SET_SP(x) (VM_REG_SP = (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
94
+ #define INC_SP(x) (VM_REG_SP += (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
95
+ #define DEC_SP(x) (VM_REG_SP -= (COLLECT_USAGE_REGISTER_HELPER(SP, SET, (x))))
96
+ #define SET_SV(x) (*GET_SP() = rb_ractor_confirm_belonging(x))
97
+ /* set current stack value as x */
98
+
99
+ /* instruction sequence C struct */
100
+ #define GET_ISEQ() (GET_CFP()->iseq)
101
+
102
+ /**********************************************************/
103
+ /* deal with variables */
104
+ /**********************************************************/
105
+
106
+ #define GET_PREV_EP(ep) ((VALUE *)((ep)[VM_ENV_DATA_INDEX_SPECVAL] & ~0x03))
107
+
108
+ /**********************************************************/
109
+ /* deal with values */
110
+ /**********************************************************/
111
+
112
+ #define GET_SELF() (COLLECT_USAGE_REGISTER_HELPER(SELF, GET, GET_CFP()->self))
113
+
114
+ /**********************************************************/
115
+ /* deal with control flow 2: method/iterator */
116
+ /**********************************************************/
117
+
118
+ /* set fastpath when cached method is *NOT* protected
119
+ * because inline method cache does not care about receiver.
120
+ */
121
+
122
+ static inline void
123
+ CC_SET_FASTPATH(const struct rb_callcache *cc, vm_call_handler func, bool enabled)
124
+ {
125
+ if (LIKELY(enabled)) {
126
+ vm_cc_call_set(cc, func);
127
+ }
128
+ }
129
+
130
+ #define GET_BLOCK_HANDLER() (GET_LEP()[VM_ENV_DATA_INDEX_SPECVAL])
131
+
132
+ /**********************************************************/
133
+ /* deal with control flow 3: exception */
134
+ /**********************************************************/
135
+
136
+
137
+ /**********************************************************/
138
+ /* deal with stack canary */
139
+ /**********************************************************/
140
+
141
+ #if VM_CHECK_MODE > 0
142
+ #define SETUP_CANARY(cond) \
143
+ VALUE *canary = 0; \
144
+ if (cond) { \
145
+ canary = GET_SP(); \
146
+ SET_SV(vm_stack_canary); \
147
+ } \
148
+ else {\
149
+ SET_SV(Qfalse); /* cleanup */ \
150
+ }
151
+ #define CHECK_CANARY(cond, insn) \
152
+ if (cond) { \
153
+ if (*canary == vm_stack_canary) { \
154
+ *canary = Qfalse; /* cleanup */ \
155
+ } \
156
+ else { \
157
+ vm_canary_is_found_dead(insn, *canary); \
158
+ } \
159
+ }
160
+ #else
161
+ #define SETUP_CANARY(cond) if (cond) {} else {}
162
+ #define CHECK_CANARY(cond, insn) if (cond) {(void)(insn);}
163
+ #endif
164
+
165
+ /**********************************************************/
166
+ /* others */
167
+ /**********************************************************/
168
+
169
+ #ifndef MJIT_HEADER
170
+ #define CALL_SIMPLE_METHOD() do { \
171
+ rb_snum_t x = leaf ? INSN_ATTR(width) : 0; \
172
+ rb_snum_t y = attr_width_opt_send_without_block(0); \
173
+ rb_snum_t z = x - y; \
174
+ ADD_PC(z); \
175
+ DISPATCH_ORIGINAL_INSN(opt_send_without_block); \
176
+ } while (0)
177
+ #endif
178
+
179
+ #define PREV_CLASS_SERIAL() (ruby_vm_class_serial)
180
+ #define NEXT_CLASS_SERIAL() (++ruby_vm_class_serial)
181
+ #define GET_GLOBAL_METHOD_STATE() (ruby_vm_global_method_state)
182
+ #define INC_GLOBAL_METHOD_STATE() (++ruby_vm_global_method_state)
183
+ #define GET_GLOBAL_CONSTANT_STATE() (ruby_vm_global_constant_state)
184
+ #define INC_GLOBAL_CONSTANT_STATE() (++ruby_vm_global_constant_state)
185
+
186
+ static inline struct vm_throw_data *
187
+ THROW_DATA_NEW(VALUE val, const rb_control_frame_t *cf, int st)
188
+ {
189
+ struct vm_throw_data *obj = (struct vm_throw_data *)rb_imemo_new(imemo_throw_data, val, (VALUE)cf, 0, 0);
190
+ obj->throw_state = st;
191
+ return obj;
192
+ }
193
+
194
+ static inline VALUE
195
+ THROW_DATA_VAL(const struct vm_throw_data *obj)
196
+ {
197
+ VM_ASSERT(THROW_DATA_P(obj));
198
+ return obj->throw_obj;
199
+ }
200
+
201
+ static inline const rb_control_frame_t *
202
+ THROW_DATA_CATCH_FRAME(const struct vm_throw_data *obj)
203
+ {
204
+ VM_ASSERT(THROW_DATA_P(obj));
205
+ return obj->catch_frame;
206
+ }
207
+
208
+ static inline int
209
+ THROW_DATA_STATE(const struct vm_throw_data *obj)
210
+ {
211
+ VM_ASSERT(THROW_DATA_P(obj));
212
+ return obj->throw_state;
213
+ }
214
+
215
+ static inline int
216
+ THROW_DATA_CONSUMED_P(const struct vm_throw_data *obj)
217
+ {
218
+ VM_ASSERT(THROW_DATA_P(obj));
219
+ return obj->flags & THROW_DATA_CONSUMED;
220
+ }
221
+
222
+ static inline void
223
+ THROW_DATA_CATCH_FRAME_SET(struct vm_throw_data *obj, const rb_control_frame_t *cfp)
224
+ {
225
+ VM_ASSERT(THROW_DATA_P(obj));
226
+ obj->catch_frame = cfp;
227
+ }
228
+
229
+ static inline void
230
+ THROW_DATA_STATE_SET(struct vm_throw_data *obj, int st)
231
+ {
232
+ VM_ASSERT(THROW_DATA_P(obj));
233
+ obj->throw_state = st;
234
+ }
235
+
236
+ static inline void
237
+ THROW_DATA_CONSUMED_SET(struct vm_throw_data *obj)
238
+ {
239
+ if (THROW_DATA_P(obj) &&
240
+ THROW_DATA_STATE(obj) == TAG_BREAK) {
241
+ obj->flags |= THROW_DATA_CONSUMED;
242
+ }
243
+ }
244
+
245
+ #define IS_ARGS_SPLAT(ci) (vm_ci_flag(ci) & VM_CALL_ARGS_SPLAT)
246
+ #define IS_ARGS_KEYWORD(ci) (vm_ci_flag(ci) & VM_CALL_KWARG)
247
+ #define IS_ARGS_KW_SPLAT(ci) (vm_ci_flag(ci) & VM_CALL_KW_SPLAT)
248
+ #define IS_ARGS_KW_OR_KW_SPLAT(ci) (vm_ci_flag(ci) & (VM_CALL_KWARG | VM_CALL_KW_SPLAT))
249
+ #define IS_ARGS_KW_SPLAT_MUT(ci) (vm_ci_flag(ci) & VM_CALL_KW_SPLAT_MUT)
250
+
251
+ /* If this returns true, an optimized function returned by `vm_call_iseq_setup_func`
252
+ can be used as a fastpath. */
253
+ static bool
254
+ vm_call_iseq_optimizable_p(const struct rb_callinfo *ci, const struct rb_callcache *cc)
255
+ {
256
+ return !IS_ARGS_SPLAT(ci) && !IS_ARGS_KEYWORD(ci) &&
257
+ METHOD_ENTRY_CACHEABLE(vm_cc_cme(cc));
258
+ }
259
+
260
+ #endif /* RUBY_INSNHELPER_H */