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,36 @@
1
+ #ifndef DLN_H
2
+ #define DLN_H
3
+ /**********************************************************************
4
+
5
+ dln.h -
6
+
7
+ $Author$
8
+ created at: Wed Jan 19 16:53:09 JST 1994
9
+
10
+ Copyright (C) 1993-2007 Yukihiro Matsumoto
11
+
12
+ **********************************************************************/
13
+
14
+ #include "ruby/defines.h" /* for RUBY_SYMBOL_EXPORT_BEGIN */
15
+
16
+ RUBY_SYMBOL_EXPORT_BEGIN
17
+
18
+ #ifndef DLN_FIND_EXTRA_ARG
19
+ #define DLN_FIND_EXTRA_ARG
20
+ #endif
21
+ #ifndef DLN_FIND_EXTRA_ARG_DECL
22
+ #define DLN_FIND_EXTRA_ARG_DECL
23
+ #endif
24
+
25
+ char *dln_find_exe_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL);
26
+ char *dln_find_file_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL);
27
+
28
+ #ifdef USE_DLN_A_OUT
29
+ extern char *dln_argv0;
30
+ #endif
31
+
32
+ void *dln_load(const char*);
33
+
34
+ RUBY_SYMBOL_EXPORT_END
35
+
36
+ #endif
@@ -0,0 +1,70 @@
1
+ #ifndef RUBY_ENCINDEX_H
2
+ #define RUBY_ENCINDEX_H 1
3
+ /**********************************************************************
4
+
5
+ encindex.h -
6
+
7
+ $Author$
8
+ created at: Tue Sep 15 13:21:14 JST 2015
9
+
10
+ Copyright (C) 2015 Yukihiro Matsumoto
11
+
12
+ **********************************************************************/
13
+
14
+ #include "ruby/encoding.h" /* rb_ascii8bit_encindex etc. */
15
+ #if defined(__cplusplus)
16
+ extern "C" {
17
+ #if 0
18
+ } /* satisfy cc-mode */
19
+ #endif
20
+ #endif
21
+
22
+ enum ruby_preserved_encindex {
23
+ RUBY_ENCINDEX_ASCII,
24
+ RUBY_ENCINDEX_UTF_8,
25
+ RUBY_ENCINDEX_US_ASCII,
26
+
27
+ /* preserved indexes */
28
+ RUBY_ENCINDEX_UTF_16BE,
29
+ RUBY_ENCINDEX_UTF_16LE,
30
+ RUBY_ENCINDEX_UTF_32BE,
31
+ RUBY_ENCINDEX_UTF_32LE,
32
+ RUBY_ENCINDEX_UTF_16,
33
+ RUBY_ENCINDEX_UTF_32,
34
+ RUBY_ENCINDEX_UTF8_MAC,
35
+
36
+ /* for old options of regexp */
37
+ RUBY_ENCINDEX_EUC_JP,
38
+ RUBY_ENCINDEX_Windows_31J,
39
+
40
+ RUBY_ENCINDEX_BUILTIN_MAX
41
+ };
42
+
43
+ #define ENCINDEX_ASCII RUBY_ENCINDEX_ASCII
44
+ #define ENCINDEX_UTF_8 RUBY_ENCINDEX_UTF_8
45
+ #define ENCINDEX_US_ASCII RUBY_ENCINDEX_US_ASCII
46
+ #define ENCINDEX_UTF_16BE RUBY_ENCINDEX_UTF_16BE
47
+ #define ENCINDEX_UTF_16LE RUBY_ENCINDEX_UTF_16LE
48
+ #define ENCINDEX_UTF_32BE RUBY_ENCINDEX_UTF_32BE
49
+ #define ENCINDEX_UTF_32LE RUBY_ENCINDEX_UTF_32LE
50
+ #define ENCINDEX_UTF_16 RUBY_ENCINDEX_UTF_16
51
+ #define ENCINDEX_UTF_32 RUBY_ENCINDEX_UTF_32
52
+ #define ENCINDEX_UTF8_MAC RUBY_ENCINDEX_UTF8_MAC
53
+ #define ENCINDEX_EUC_JP RUBY_ENCINDEX_EUC_JP
54
+ #define ENCINDEX_Windows_31J RUBY_ENCINDEX_Windows_31J
55
+ #define ENCINDEX_BUILTIN_MAX RUBY_ENCINDEX_BUILTIN_MAX
56
+
57
+ #define rb_ascii8bit_encindex() RUBY_ENCINDEX_ASCII
58
+ #define rb_utf8_encindex() RUBY_ENCINDEX_UTF_8
59
+ #define rb_usascii_encindex() RUBY_ENCINDEX_US_ASCII
60
+
61
+ int rb_enc_find_index2(const char *name, long len);
62
+
63
+ #if defined(__cplusplus)
64
+ #if 0
65
+ { /* satisfy cc-mode */
66
+ #endif
67
+ } /* extern "C" { */
68
+ #endif
69
+
70
+ #endif /* RUBY_ENCINDEX_H */
@@ -0,0 +1,312 @@
1
+ #ifndef RUBY_EVAL_INTERN_H
2
+ #define RUBY_EVAL_INTERN_H
3
+
4
+ #include "ruby/ruby.h"
5
+ #include "vm_core.h"
6
+
7
+ static inline void
8
+ vm_passed_block_handler_set(rb_execution_context_t *ec, VALUE block_handler)
9
+ {
10
+ vm_block_handler_verify(block_handler);
11
+ ec->passed_block_handler = block_handler;
12
+ }
13
+
14
+ static inline void
15
+ pass_passed_block_handler(rb_execution_context_t *ec)
16
+ {
17
+ VALUE block_handler = rb_vm_frame_block_handler(ec->cfp);
18
+ vm_passed_block_handler_set(ec, block_handler);
19
+ VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_PASSED);
20
+ }
21
+
22
+ #define PASS_PASSED_BLOCK_HANDLER_EC(ec) pass_passed_block_handler(ec)
23
+ #define PASS_PASSED_BLOCK_HANDLER() pass_passed_block_handler(GET_EC())
24
+
25
+ #ifdef HAVE_STDLIB_H
26
+ #include <stdlib.h>
27
+ #endif
28
+ #ifndef EXIT_SUCCESS
29
+ #define EXIT_SUCCESS 0
30
+ #endif
31
+ #ifndef EXIT_FAILURE
32
+ #define EXIT_FAILURE 1
33
+ #endif
34
+
35
+ #include <stdio.h>
36
+ #include <setjmp.h>
37
+
38
+ #ifdef __APPLE__
39
+ # ifdef HAVE_CRT_EXTERNS_H
40
+ # include <crt_externs.h>
41
+ # else
42
+ # include "missing/crt_externs.h"
43
+ # endif
44
+ #endif
45
+
46
+ #ifndef HAVE_STRING_H
47
+ char *strrchr(const char *, const char);
48
+ #endif
49
+
50
+ #ifdef HAVE_UNISTD_H
51
+ #include <unistd.h>
52
+ #endif
53
+
54
+ #ifdef HAVE_NET_SOCKET_H
55
+ #include <net/socket.h>
56
+ #endif
57
+
58
+ #define ruby_setjmp(env) RUBY_SETJMP(env)
59
+ #define ruby_longjmp(env,val) RUBY_LONGJMP((env),(val))
60
+ #ifdef __CYGWIN__
61
+ # ifndef _setjmp
62
+ int _setjmp(jmp_buf);
63
+ # endif
64
+ # ifndef _longjmp
65
+ NORETURN(void _longjmp(jmp_buf, int));
66
+ # endif
67
+ #endif
68
+
69
+ #include <sys/types.h>
70
+ #include <signal.h>
71
+ #include <errno.h>
72
+
73
+ #ifdef HAVE_SYS_SELECT_H
74
+ #include <sys/select.h>
75
+ #endif
76
+
77
+ /*
78
+ Solaris sys/select.h switches select to select_large_fdset to support larger
79
+ file descriptors if FD_SETSIZE is larger than 1024 on 32bit environment.
80
+ But Ruby doesn't change FD_SETSIZE because fd_set is allocated dynamically.
81
+ So following definition is required to use select_large_fdset.
82
+ */
83
+ #ifdef HAVE_SELECT_LARGE_FDSET
84
+ #define select(n, r, w, e, t) select_large_fdset((n), (r), (w), (e), (t))
85
+ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval *);
86
+ #endif
87
+
88
+ #ifdef HAVE_SYS_PARAM_H
89
+ #include <sys/param.h>
90
+ #endif
91
+
92
+ #include <sys/stat.h>
93
+
94
+ #ifdef _MSC_VER
95
+ #define SAVE_ROOT_JMPBUF_BEFORE_STMT \
96
+ __try {
97
+ #define SAVE_ROOT_JMPBUF_AFTER_STMT \
98
+ } \
99
+ __except (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW ? \
100
+ (rb_ec_raised_set(GET_EC(), RAISED_STACKOVERFLOW), \
101
+ raise(SIGSEGV), \
102
+ EXCEPTION_EXECUTE_HANDLER) : \
103
+ EXCEPTION_CONTINUE_SEARCH) { \
104
+ /* never reaches here */ \
105
+ }
106
+ #elif defined(__MINGW32__)
107
+ LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
108
+ #define SAVE_ROOT_JMPBUF_BEFORE_STMT \
109
+ do { \
110
+ PVOID _handler = AddVectoredExceptionHandler(1, rb_w32_stack_overflow_handler);
111
+
112
+ #define SAVE_ROOT_JMPBUF_AFTER_STMT \
113
+ RemoveVectoredExceptionHandler(_handler); \
114
+ } while (0);
115
+ #else
116
+ #define SAVE_ROOT_JMPBUF_BEFORE_STMT
117
+ #define SAVE_ROOT_JMPBUF_AFTER_STMT
118
+ #endif
119
+
120
+ #define SAVE_ROOT_JMPBUF(th, stmt) do \
121
+ if (ruby_setjmp((th)->root_jmpbuf) == 0) { \
122
+ SAVE_ROOT_JMPBUF_BEFORE_STMT \
123
+ stmt; \
124
+ SAVE_ROOT_JMPBUF_AFTER_STMT \
125
+ } \
126
+ else { \
127
+ rb_fiber_start(); \
128
+ } while (0)
129
+
130
+ #define EC_PUSH_TAG(ec) do { \
131
+ rb_execution_context_t * const _ec = (ec); \
132
+ struct rb_vm_tag _tag; \
133
+ _tag.state = TAG_NONE; \
134
+ _tag.tag = Qundef; \
135
+ _tag.prev = _ec->tag;
136
+
137
+ #define EC_POP_TAG() \
138
+ _ec->tag = _tag.prev; \
139
+ } while (0)
140
+
141
+ #define EC_TMPPOP_TAG() \
142
+ _ec->tag = _tag.prev
143
+
144
+ #define EC_REPUSH_TAG() (void)(_ec->tag = &_tag)
145
+
146
+ #if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8) || __clang__
147
+ /* This macro prevents GCC 4.6--4.8 from emitting maybe-uninitialized warnings.
148
+ * This macro also prevents Clang from dumping core in EC_EXEC_TAG().
149
+ * (I confirmed Clang 4.0.1 and 5.0.0.)
150
+ */
151
+ # define VAR_FROM_MEMORY(var) __extension__(*(__typeof__(var) volatile *)&(var))
152
+ # define VAR_INITIALIZED(var) ((var) = VAR_FROM_MEMORY(var))
153
+ # define VAR_NOCLOBBERED(var) volatile var
154
+ #else
155
+ # define VAR_FROM_MEMORY(var) (var)
156
+ # define VAR_INITIALIZED(var) ((void)&(var))
157
+ # define VAR_NOCLOBBERED(var) var
158
+ #endif
159
+
160
+ /* clear ec->tag->state, and return the value */
161
+ static inline int
162
+ rb_ec_tag_state(const rb_execution_context_t *ec)
163
+ {
164
+ enum ruby_tag_type state = ec->tag->state;
165
+ ec->tag->state = TAG_NONE;
166
+ return state;
167
+ }
168
+
169
+ NORETURN(static inline void rb_ec_tag_jump(const rb_execution_context_t *ec, enum ruby_tag_type st));
170
+ static inline void
171
+ rb_ec_tag_jump(const rb_execution_context_t *ec, enum ruby_tag_type st)
172
+ {
173
+ ec->tag->state = st;
174
+ ruby_longjmp(ec->tag->buf, 1);
175
+ }
176
+
177
+ /*
178
+ setjmp() in assignment expression rhs is undefined behavior
179
+ [ISO/IEC 9899:1999] 7.13.1.1
180
+ */
181
+ #define EC_EXEC_TAG() \
182
+ (ruby_setjmp(_tag.buf) ? rb_ec_tag_state(VAR_FROM_MEMORY(_ec)) : (EC_REPUSH_TAG(), 0))
183
+
184
+ #define EC_JUMP_TAG(ec, st) rb_ec_tag_jump(ec, st)
185
+
186
+ #define INTERNAL_EXCEPTION_P(exc) FIXNUM_P(exc)
187
+
188
+ /* CREF operators */
189
+
190
+ #define CREF_FL_PUSHED_BY_EVAL IMEMO_FL_USER1
191
+ #define CREF_FL_OMOD_SHARED IMEMO_FL_USER2
192
+
193
+ static inline VALUE
194
+ CREF_CLASS(const rb_cref_t *cref)
195
+ {
196
+ return cref->klass;
197
+ }
198
+
199
+ static inline rb_cref_t *
200
+ CREF_NEXT(const rb_cref_t *cref)
201
+ {
202
+ return cref->next;
203
+ }
204
+
205
+ static inline const rb_scope_visibility_t *
206
+ CREF_SCOPE_VISI(const rb_cref_t *cref)
207
+ {
208
+ return &cref->scope_visi;
209
+ }
210
+
211
+ static inline VALUE
212
+ CREF_REFINEMENTS(const rb_cref_t *cref)
213
+ {
214
+ return cref->refinements;
215
+ }
216
+
217
+ static inline void
218
+ CREF_REFINEMENTS_SET(rb_cref_t *cref, VALUE refs)
219
+ {
220
+ RB_OBJ_WRITE(cref, &cref->refinements, refs);
221
+ }
222
+
223
+ static inline int
224
+ CREF_PUSHED_BY_EVAL(const rb_cref_t *cref)
225
+ {
226
+ return cref->flags & CREF_FL_PUSHED_BY_EVAL;
227
+ }
228
+
229
+ static inline void
230
+ CREF_PUSHED_BY_EVAL_SET(rb_cref_t *cref)
231
+ {
232
+ cref->flags |= CREF_FL_PUSHED_BY_EVAL;
233
+ }
234
+
235
+ static inline int
236
+ CREF_OMOD_SHARED(const rb_cref_t *cref)
237
+ {
238
+ return cref->flags & CREF_FL_OMOD_SHARED;
239
+ }
240
+
241
+ static inline void
242
+ CREF_OMOD_SHARED_SET(rb_cref_t *cref)
243
+ {
244
+ cref->flags |= CREF_FL_OMOD_SHARED;
245
+ }
246
+
247
+ static inline void
248
+ CREF_OMOD_SHARED_UNSET(rb_cref_t *cref)
249
+ {
250
+ cref->flags &= ~CREF_FL_OMOD_SHARED;
251
+ }
252
+
253
+ enum {
254
+ RAISED_EXCEPTION = 1,
255
+ RAISED_STACKOVERFLOW = 2,
256
+ RAISED_NOMEMORY = 4
257
+ };
258
+ #define rb_ec_raised_set(ec, f) ((ec)->raised_flag |= (f))
259
+ #define rb_ec_raised_reset(ec, f) ((ec)->raised_flag &= ~(f))
260
+ #define rb_ec_raised_p(ec, f) (((ec)->raised_flag & (f)) != 0)
261
+ #define rb_ec_raised_clear(ec) ((ec)->raised_flag = 0)
262
+ int rb_ec_set_raised(rb_execution_context_t *ec);
263
+ int rb_ec_reset_raised(rb_execution_context_t *ec);
264
+ int rb_ec_stack_check(rb_execution_context_t *ec);
265
+
266
+ VALUE rb_f_eval(int argc, const VALUE *argv, VALUE self);
267
+ VALUE rb_make_exception(int argc, const VALUE *argv);
268
+
269
+ NORETURN(void rb_method_name_error(VALUE, VALUE));
270
+
271
+ NORETURN(void rb_fiber_start(void));
272
+
273
+ NORETURN(void rb_print_undef(VALUE, ID, rb_method_visibility_t));
274
+ NORETURN(void rb_print_undef_str(VALUE, VALUE));
275
+ NORETURN(void rb_print_inaccessible(VALUE, ID, rb_method_visibility_t));
276
+ NORETURN(void rb_vm_localjump_error(const char *,VALUE, int));
277
+ NORETURN(void rb_vm_jump_tag_but_local_jump(int));
278
+
279
+ VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);
280
+ rb_cref_t *rb_vm_cref(void);
281
+ rb_cref_t *rb_vm_cref_replace_with_duplicated_cref(void);
282
+ VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, VALUE block_handler, VALUE filename);
283
+ void rb_vm_set_progname(VALUE filename);
284
+ void rb_thread_terminate_all(void);
285
+ VALUE rb_vm_cbase(void);
286
+
287
+ /* vm_backtrace.c */
288
+ VALUE rb_ec_backtrace_object(const rb_execution_context_t *ec);
289
+ VALUE rb_ec_backtrace_str_ary(const rb_execution_context_t *ec, long lev, long n);
290
+ VALUE rb_ec_backtrace_location_ary(const rb_execution_context_t *ec, long lev, long n);
291
+
292
+ #ifndef CharNext /* defined as CharNext[AW] on Windows. */
293
+ # ifdef HAVE_MBLEN
294
+ # define CharNext(p) ((p) + mblen((p), RUBY_MBCHAR_MAXSIZE))
295
+ # else
296
+ # define CharNext(p) ((p) + 1)
297
+ # endif
298
+ #endif
299
+
300
+ #if defined DOSISH || defined __CYGWIN__
301
+ static inline void
302
+ translit_char(char *p, int from, int to)
303
+ {
304
+ while (*p) {
305
+ if ((unsigned char)*p == from)
306
+ *p = to;
307
+ p = CharNext(p);
308
+ }
309
+ }
310
+ #endif
311
+
312
+ #endif /* RUBY_EVAL_INTERN_H */
@@ -0,0 +1,140 @@
1
+ #ifndef RUBY_GC_H
2
+ #define RUBY_GC_H 1
3
+ #include "ruby/ruby.h"
4
+
5
+ #if defined(__x86_64__) && !defined(_ILP32) && defined(__GNUC__)
6
+ #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p)))
7
+ #elif defined(__i386) && defined(__GNUC__)
8
+ #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p)))
9
+ #elif defined(__powerpc64__) && defined(__GNUC__)
10
+ #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("mr\t%0, %%r1" : "=r" (*(p)))
11
+ #elif defined(__aarch64__) && defined(__GNUC__)
12
+ #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("mov\t%0, sp" : "=r" (*(p)))
13
+ #else
14
+ NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
15
+ #define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p)
16
+ #define USE_CONSERVATIVE_STACK_END
17
+ #endif
18
+
19
+ #define RB_GC_SAVE_MACHINE_CONTEXT(th) \
20
+ do { \
21
+ FLUSH_REGISTER_WINDOWS; \
22
+ setjmp((th)->ec->machine.regs); \
23
+ SET_MACHINE_STACK_END(&(th)->ec->machine.stack_end); \
24
+ } while (0)
25
+
26
+ /* for GC debug */
27
+
28
+ #ifndef RUBY_MARK_FREE_DEBUG
29
+ #define RUBY_MARK_FREE_DEBUG 0
30
+ #endif
31
+
32
+ #if RUBY_MARK_FREE_DEBUG
33
+ extern int ruby_gc_debug_indent;
34
+
35
+ static inline void
36
+ rb_gc_debug_indent(void)
37
+ {
38
+ printf("%*s", ruby_gc_debug_indent, "");
39
+ }
40
+
41
+ static inline void
42
+ rb_gc_debug_body(const char *mode, const char *msg, int st, void *ptr)
43
+ {
44
+ if (st == 0) {
45
+ ruby_gc_debug_indent--;
46
+ }
47
+ rb_gc_debug_indent();
48
+ printf("%s: %s %s (%p)\n", mode, st ? "->" : "<-", msg, ptr);
49
+
50
+ if (st) {
51
+ ruby_gc_debug_indent++;
52
+ }
53
+
54
+ fflush(stdout);
55
+ }
56
+
57
+ #define RUBY_MARK_ENTER(msg) rb_gc_debug_body("mark", (msg), 1, ptr)
58
+ #define RUBY_MARK_LEAVE(msg) rb_gc_debug_body("mark", (msg), 0, ptr)
59
+ #define RUBY_FREE_ENTER(msg) rb_gc_debug_body("free", (msg), 1, ptr)
60
+ #define RUBY_FREE_LEAVE(msg) rb_gc_debug_body("free", (msg), 0, ptr)
61
+ #define RUBY_GC_INFO rb_gc_debug_indent(); printf
62
+
63
+ #else
64
+ #define RUBY_MARK_ENTER(msg)
65
+ #define RUBY_MARK_LEAVE(msg)
66
+ #define RUBY_FREE_ENTER(msg)
67
+ #define RUBY_FREE_LEAVE(msg)
68
+ #define RUBY_GC_INFO if(0)printf
69
+ #endif
70
+
71
+ #define RUBY_MARK_MOVABLE_UNLESS_NULL(ptr) do { \
72
+ VALUE markobj = (ptr); \
73
+ if (RTEST(markobj)) {rb_gc_mark_movable(markobj);} \
74
+ } while (0)
75
+ #define RUBY_MARK_UNLESS_NULL(ptr) do { \
76
+ VALUE markobj = (ptr); \
77
+ if (RTEST(markobj)) {rb_gc_mark(markobj);} \
78
+ } while (0)
79
+ #define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);(ptr)=NULL;}
80
+
81
+ #if STACK_GROW_DIRECTION > 0
82
+ # define STACK_UPPER(x, a, b) (a)
83
+ #elif STACK_GROW_DIRECTION < 0
84
+ # define STACK_UPPER(x, a, b) (b)
85
+ #else
86
+ RUBY_EXTERN int ruby_stack_grow_direction;
87
+ int ruby_get_stack_grow_direction(volatile VALUE *addr);
88
+ # define stack_growup_p(x) ( \
89
+ (ruby_stack_grow_direction ? \
90
+ ruby_stack_grow_direction : \
91
+ ruby_get_stack_grow_direction(x)) > 0)
92
+ # define STACK_UPPER(x, a, b) (stack_growup_p(x) ? (a) : (b))
93
+ #endif
94
+
95
+ /*
96
+ STACK_GROW_DIR_DETECTION is used with STACK_DIR_UPPER.
97
+
98
+ On most normal systems, stacks grow from high address to lower address. In
99
+ this case, STACK_DIR_UPPER(a, b) will return (b), but on exotic systems where
100
+ the stack grows UP (from low address to high address), it will return (a).
101
+ */
102
+
103
+ #if STACK_GROW_DIRECTION
104
+ #define STACK_GROW_DIR_DETECTION
105
+ #define STACK_DIR_UPPER(a,b) STACK_UPPER(0, (a), (b))
106
+ #else
107
+ #define STACK_GROW_DIR_DETECTION VALUE stack_grow_dir_detection
108
+ #define STACK_DIR_UPPER(a,b) STACK_UPPER(&stack_grow_dir_detection, (a), (b))
109
+ #endif
110
+ #define IS_STACK_DIR_UPPER() STACK_DIR_UPPER(1,0)
111
+
112
+ const char *rb_obj_info(VALUE obj);
113
+ const char *rb_raw_obj_info(char *buff, const int buff_size, VALUE obj);
114
+
115
+ VALUE rb_gc_disable_no_rest(void);
116
+
117
+ struct rb_thread_struct;
118
+
119
+ RUBY_SYMBOL_EXPORT_BEGIN
120
+
121
+ /* exports for objspace module */
122
+ size_t rb_objspace_data_type_memsize(VALUE obj);
123
+ void rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *data);
124
+ void rb_objspace_reachable_objects_from_root(void (func)(const char *category, VALUE, void *), void *data);
125
+ int rb_objspace_markable_object_p(VALUE obj);
126
+ int rb_objspace_internal_object_p(VALUE obj);
127
+ int rb_objspace_marked_object_p(VALUE obj);
128
+ int rb_objspace_garbage_object_p(VALUE obj);
129
+
130
+ void rb_objspace_each_objects(
131
+ int (*callback)(void *start, void *end, size_t stride, void *data),
132
+ void *data);
133
+
134
+ void rb_objspace_each_objects_without_setup(
135
+ int (*callback)(void *, void *, size_t, void *),
136
+ void *data);
137
+
138
+ RUBY_SYMBOL_EXPORT_END
139
+
140
+ #endif /* RUBY_GC_H */