debase-ruby_core_source 0.9.9 → 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/addr2line.h +0 -0
  4. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/ccan/build_assert/build_assert.h +0 -0
  5. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/ccan/check_type/check_type.h +0 -0
  6. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/ccan/container_of/container_of.h +0 -0
  7. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/ccan/list/list.h +28 -166
  8. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/ccan/str/str.h +0 -0
  9. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/constant.h +3 -10
  10. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/dln.h +0 -0
  11. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/eval_intern.h +49 -89
  12. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/gc.h +1 -8
  13. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/id.h +5 -15
  14. data/lib/debase/ruby_core_source/ruby-2.2.8-p477/insns.inc +107 -0
  15. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/insns_info.inc +45 -89
  16. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/internal.h +164 -666
  17. data/lib/debase/ruby_core_source/ruby-2.2.8-p477/iseq.h +158 -0
  18. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/known_errors.inc +0 -0
  19. data/lib/debase/ruby_core_source/ruby-2.2.8-p477/method.h +144 -0
  20. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/node.h +42 -18
  21. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/node_name.inc +6 -2
  22. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/opt_sc.inc +0 -40
  23. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/optinsn.inc +0 -0
  24. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/optunifs.inc +0 -5
  25. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/parse.h +8 -28
  26. data/lib/debase/ruby_core_source/ruby-2.2.8-p477/probes_helper.h +67 -0
  27. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/regenc.h +16 -16
  28. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/regint.h +10 -33
  29. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/regparse.h +1 -5
  30. data/lib/debase/ruby_core_source/ruby-2.2.8-p477/revision.h +1 -0
  31. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/ruby_atomic.h +5 -68
  32. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/siphash.h +0 -0
  33. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/symbol.h +13 -33
  34. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/thread_pthread.h +2 -2
  35. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/thread_win32.h +0 -0
  36. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/timev.h +0 -0
  37. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/transcode_data.h +7 -23
  38. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/version.h +10 -31
  39. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/vm.inc +497 -542
  40. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/vm_core.h +305 -784
  41. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/vm_debug.h +0 -0
  42. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/vm_exec.h +0 -0
  43. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/vm_insnhelper.h +56 -50
  44. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/vm_opts.h +7 -8
  45. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/vmtc.inc +0 -5
  46. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/addr2line.h +0 -0
  47. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/ccan/build_assert/build_assert.h +0 -0
  48. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/ccan/check_type/check_type.h +0 -0
  49. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/ccan/container_of/container_of.h +0 -0
  50. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/ccan/list/list.h +0 -0
  51. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/ccan/str/str.h +0 -0
  52. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/constant.h +1 -1
  53. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/dln.h +0 -0
  54. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/encindex.h +0 -0
  55. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/eval_intern.h +3 -4
  56. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/gc.h +0 -0
  57. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/id.h +0 -9
  58. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/id_table.h +0 -0
  59. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/insns.inc +46 -48
  60. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/insns_info.inc +0 -20
  61. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/internal.h +58 -290
  62. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/iseq.h +15 -18
  63. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/known_errors.inc +0 -0
  64. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/method.h +2 -2
  65. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/node.h +2 -2
  66. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/node_name.inc +0 -0
  67. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/opt_sc.inc +0 -16
  68. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/optinsn.inc +0 -0
  69. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/optunifs.inc +0 -2
  70. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/parse.h +8 -27
  71. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/probes_helper.h +0 -0
  72. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/regenc.h +14 -14
  73. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/regint.h +0 -8
  74. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/regparse.h +0 -0
  75. data/lib/debase/ruby_core_source/ruby-2.3.5-p376/revision.h +1 -0
  76. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/ruby_atomic.h +0 -0
  77. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/siphash.h +0 -0
  78. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/symbol.h +3 -3
  79. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/thread_pthread.h +0 -0
  80. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/thread_win32.h +0 -0
  81. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/timev.h +0 -0
  82. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/transcode_data.h +0 -0
  83. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/version.h +9 -27
  84. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm.inc +255 -264
  85. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm_call_iseq_optimized.inc +5 -5
  86. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm_core.h +37 -28
  87. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/vm_debug.h +0 -0
  88. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/vm_exec.h +0 -0
  89. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm_insnhelper.h +32 -16
  90. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm_opts.h +0 -0
  91. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/vmtc.inc +0 -2
  92. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/addr2line.h +0 -0
  93. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/ccan/build_assert/build_assert.h +0 -0
  94. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/ccan/check_type/check_type.h +0 -0
  95. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/ccan/container_of/container_of.h +0 -0
  96. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/ccan/list/list.h +0 -0
  97. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/ccan/str/str.h +0 -0
  98. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/constant.h +0 -0
  99. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/dln.h +0 -0
  100. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/encindex.h +0 -0
  101. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/eval_intern.h +0 -0
  102. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/gc.h +0 -0
  103. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/id.h +0 -0
  104. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/id_table.h +0 -0
  105. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/insns.inc +0 -0
  106. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/insns_info.inc +0 -0
  107. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/internal.h +116 -51
  108. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/iseq.h +0 -0
  109. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/known_errors.inc +0 -0
  110. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/method.h +0 -0
  111. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/node.h +2 -2
  112. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/node_name.inc +0 -0
  113. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/opt_sc.inc +0 -0
  114. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/optinsn.inc +0 -0
  115. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/optunifs.inc +0 -0
  116. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/parse.h +8 -27
  117. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/probes_helper.h +0 -0
  118. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/regenc.h +79 -67
  119. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/regint.h +187 -244
  120. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/regparse.h +30 -27
  121. data/lib/debase/ruby_core_source/ruby-2.4.2-p198/revision.h +1 -0
  122. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/ruby_assert.h +0 -0
  123. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/ruby_atomic.h +0 -0
  124. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/siphash.h +0 -0
  125. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/symbol.h +0 -0
  126. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/thread_pthread.h +0 -0
  127. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/thread_win32.h +0 -0
  128. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/timev.h +0 -0
  129. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/transcode_data.h +0 -0
  130. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/version.h +6 -6
  131. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm.inc +37 -34
  132. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/vm_call_iseq_optimized.inc +0 -0
  133. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm_core.h +9 -7
  134. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm_debug.h +0 -0
  135. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm_exec.h +0 -0
  136. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm_insnhelper.h +30 -14
  137. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/vm_opts.h +0 -0
  138. data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/vmtc.inc +0 -0
  139. data/lib/debase/ruby_core_source/version.rb +1 -1
  140. metadata +138 -143
  141. data/lib/debase/ruby_core_source/ruby-2.4.0-preview1/method.h +0 -213
  142. data/lib/debase/ruby_core_source/ruby-2.4.0-preview1/revision.h +0 -1
  143. data/lib/debase/ruby_core_source/ruby-2.4.0-preview2/revision.h +0 -1
  144. data/lib/debase/ruby_core_source/ruby-2.4.0-preview2/ruby_assert.h +0 -54
  145. data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/encindex.h +0 -67
  146. data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/id_table.h +0 -31
  147. data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/insns.inc +0 -112
  148. data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/iseq.h +0 -252
  149. data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/probes_helper.h +0 -43
  150. data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/revision.h +0 -1
  151. data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/ruby_assert.h +0 -54
  152. data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/vm_call_iseq_optimized.inc +0 -212
@@ -181,10 +181,10 @@ static inline vm_call_handler
181
181
  vm_call_iseq_setup_func(const struct rb_call_info *ci, const int param_size, const int local_size)
182
182
  {
183
183
  if (UNLIKELY(ci->flag & VM_CALL_TAILCALL)) {
184
- return &vm_call_iseq_setup_tailcall_0start;
184
+ return vm_call_iseq_setup_tailcall_0start;
185
185
  }
186
186
  else if (0) { /* to disable optimize */
187
- return &vm_call_iseq_setup_normal_0start;
187
+ return vm_call_iseq_setup_normal_0start;
188
188
  }
189
189
  else {
190
190
  if (param_size <= 3 &&
@@ -192,7 +192,7 @@ vm_call_iseq_setup_func(const struct rb_call_info *ci, const int param_size, con
192
192
  VM_ASSERT(local_size != 0);
193
193
  return vm_call_iseq_handlers[param_size][local_size-1];
194
194
  }
195
- return &vm_call_iseq_setup_normal_0start;
195
+ return vm_call_iseq_setup_normal_0start;
196
196
  }
197
197
  }
198
198
 
@@ -203,10 +203,10 @@ static inline vm_call_handler
203
203
  vm_call_iseq_setup_func(const struct rb_call_info *ci, struct rb_call_cache *cc)
204
204
  {
205
205
  if (UNLIKELY(ci->flag & VM_CALL_TAILCALL)) {
206
- return &vm_call_iseq_setup_tailcall_0start;
206
+ return vm_call_iseq_setup_tailcall_0start;
207
207
  }
208
208
  else {
209
- return &vm_call_iseq_setup_normal_0start;
209
+ return vm_call_iseq_setup_normal_0start;
210
210
  }
211
211
  }
212
212
  #endif
@@ -2,7 +2,7 @@
2
2
 
3
3
  vm_core.h -
4
4
 
5
- $Author: nobu $
5
+ $Author: usa $
6
6
  created at: 04/01/01 19:41:38 JST
7
7
 
8
8
  Copyright (C) 2004-2007 Koichi Sasada
@@ -42,11 +42,10 @@
42
42
  #define VMDEBUG 3
43
43
  #endif
44
44
 
45
- #include "ruby_assert.h"
46
-
47
45
  #if VM_CHECK_MODE > 0
48
46
  #define VM_ASSERT(expr) ( \
49
- RUBY_ASSERT_WHEN(VM_CHECK_MODE > 0, expr))
47
+ LIKELY(expr) ? (void)0 : \
48
+ rb_bug("%s:%d assertion violation - %s", __FILE__, __LINE__, #expr))
50
49
  #else
51
50
  #define VM_ASSERT(expr) ((void)0)
52
51
  #endif
@@ -200,11 +199,10 @@ enum method_missing_reason {
200
199
  MISSING_NOENTRY = 0x00,
201
200
  MISSING_PRIVATE = 0x01,
202
201
  MISSING_PROTECTED = 0x02,
203
- MISSING_FCALL = 0x04,
204
- MISSING_VCALL = 0x08,
205
- MISSING_SUPER = 0x10,
206
- MISSING_MISSING = 0x20,
207
- MISSING_NONE = 0x40
202
+ MISSING_VCALL = 0x04,
203
+ MISSING_SUPER = 0x08,
204
+ MISSING_MISSING = 0x10,
205
+ MISSING_NONE = 0x20
208
206
  };
209
207
 
210
208
  struct rb_call_info {
@@ -251,11 +249,12 @@ struct rb_call_cache {
251
249
  };
252
250
 
253
251
  #if 1
254
- #define CoreDataFromValue(obj, type) (type*)DATA_PTR(obj)
252
+ #define GetCoreDataFromValue(obj, type, ptr) do { \
253
+ (ptr) = (type*)DATA_PTR(obj); \
254
+ } while (0)
255
255
  #else
256
- #define CoreDataFromValue(obj, type) (type*)rb_data_object_get(obj)
256
+ #define GetCoreDataFromValue(obj, type, ptr) Data_Get_Struct((obj), type, (ptr))
257
257
  #endif
258
- #define GetCoreDataFromValue(obj, type, ptr) ((ptr) = CoreDataFromValue((obj), type))
259
258
 
260
259
  typedef struct rb_iseq_location_struct {
261
260
  VALUE path;
@@ -453,8 +452,6 @@ enum ruby_basic_operators {
453
452
  BOP_NEQ,
454
453
  BOP_MATCH,
455
454
  BOP_FREEZE,
456
- BOP_MAX,
457
- BOP_MIN,
458
455
 
459
456
  BOP_LAST_
460
457
  };
@@ -489,14 +486,14 @@ typedef struct rb_vm_struct {
489
486
  struct rb_thread_struct *main_thread;
490
487
  struct rb_thread_struct *running_thread;
491
488
 
489
+ struct list_head waiting_fds; /* <=> struct waiting_fd */
492
490
  struct list_head living_threads;
493
491
  size_t living_thread_num;
494
492
  VALUE thgroup_default;
495
493
 
496
- unsigned int running: 1;
497
- unsigned int thread_abort_on_exception: 1;
498
- unsigned int thread_report_on_exception: 1;
499
- unsigned int trace_running: 1;
494
+ int running;
495
+ int thread_abort_on_exception;
496
+ int trace_running;
500
497
  volatile int sleeper;
501
498
 
502
499
  /* object management */
@@ -570,12 +567,12 @@ typedef struct rb_vm_struct {
570
567
  #define RUBY_VM_FIBER_MACHINE_STACK_SIZE_MIN ( 16 * 1024 * sizeof(VALUE)) /* 64 KB or 128 KB */
571
568
 
572
569
  /* optimize insn */
573
- #define INTEGER_REDEFINED_OP_FLAG (1 << 0)
570
+ #define FIXNUM_REDEFINED_OP_FLAG (1 << 0)
574
571
  #define FLOAT_REDEFINED_OP_FLAG (1 << 1)
575
572
  #define STRING_REDEFINED_OP_FLAG (1 << 2)
576
573
  #define ARRAY_REDEFINED_OP_FLAG (1 << 3)
577
574
  #define HASH_REDEFINED_OP_FLAG (1 << 4)
578
- /* #define BIGNUM_REDEFINED_OP_FLAG (1 << 5) */
575
+ #define BIGNUM_REDEFINED_OP_FLAG (1 << 5)
579
576
  #define SYMBOL_REDEFINED_OP_FLAG (1 << 6)
580
577
  #define TIME_REDEFINED_OP_FLAG (1 << 7)
581
578
  #define REGEXP_REDEFINED_OP_FLAG (1 << 8)
@@ -687,8 +684,6 @@ typedef struct rb_thread_struct {
687
684
  /* passing state */
688
685
  int state;
689
686
 
690
- int waiting_fd;
691
-
692
687
  /* for rb_iterate */
693
688
  const rb_block_t *passed_block;
694
689
 
@@ -703,6 +698,8 @@ typedef struct rb_thread_struct {
703
698
  VALUE top_wrapper;
704
699
 
705
700
  /* eval env */
701
+ rb_block_t *base_block;
702
+
706
703
  VALUE *root_lep;
707
704
  VALUE root_svar;
708
705
 
@@ -745,6 +742,20 @@ typedef struct rb_thread_struct {
745
742
  struct rb_vm_tag *tag;
746
743
  struct rb_vm_protect_tag *protect_tag;
747
744
 
745
+ /*! Thread-local state of evaluation context.
746
+ *
747
+ * If negative, this thread is evaluating the main program.
748
+ * If positive, this thread is evaluating a program under Kernel::eval
749
+ * family.
750
+ */
751
+ int parse_in_eval;
752
+
753
+ /*! Thread-local state of compiling context.
754
+ *
755
+ * If non-zero, the parser does not automatically print error messages to
756
+ * stderr. */
757
+ int mild_compile_error;
758
+
748
759
  /* storage */
749
760
  st_table *local_storage;
750
761
  VALUE local_storage_recursive_hash;
@@ -785,9 +796,8 @@ typedef struct rb_thread_struct {
785
796
  rb_ensure_list_t *ensure_list;
786
797
 
787
798
  /* misc */
788
- enum method_missing_reason method_missing_reason: 8;
789
- unsigned int abort_on_exception: 1;
790
- unsigned int report_on_exception: 1;
799
+ enum method_missing_reason method_missing_reason;
800
+ int abort_on_exception;
791
801
  #ifdef USE_SIGALTSTACK
792
802
  void *altstack;
793
803
  #endif
@@ -816,7 +826,7 @@ RUBY_SYMBOL_EXPORT_BEGIN
816
826
  /* node -> iseq */
817
827
  rb_iseq_t *rb_iseq_new(NODE*, VALUE, VALUE, VALUE, const rb_iseq_t *parent, enum iseq_type);
818
828
  rb_iseq_t *rb_iseq_new_top(NODE *node, VALUE name, VALUE path, VALUE absolute_path, const rb_iseq_t *parent);
819
- rb_iseq_t *rb_iseq_new_main(NODE *node, VALUE path, VALUE absolute_path, const rb_iseq_t *parent);
829
+ rb_iseq_t *rb_iseq_new_main(NODE *node, VALUE path, VALUE absolute_path);
820
830
  rb_iseq_t *rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, enum iseq_type, VALUE);
821
831
  rb_iseq_t *rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, const rb_iseq_t *parent, enum iseq_type, const rb_compile_option_t*);
822
832
 
@@ -1032,6 +1042,7 @@ void rb_thread_wakeup_timer_thread(void);
1032
1042
  static inline void
1033
1043
  rb_vm_living_threads_init(rb_vm_t *vm)
1034
1044
  {
1045
+ list_head_init(&vm->waiting_fds);
1035
1046
  list_head_init(&vm->living_threads);
1036
1047
  vm->living_thread_num = 0;
1037
1048
  }
@@ -1139,7 +1150,6 @@ enum {
1139
1150
  #define RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & ~(th)->interrupt_mask & (PENDING_INTERRUPT_MASK|TRAP_INTERRUPT_MASK))
1140
1151
  #define RUBY_VM_INTERRUPTED_ANY(th) ((th)->interrupt_flag & ~(th)->interrupt_mask)
1141
1152
 
1142
- VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt);
1143
1153
  int rb_signal_buff_size(void);
1144
1154
  void rb_signal_exec(rb_thread_t *th, int sig);
1145
1155
  void rb_threadptr_check_signal(rb_thread_t *mth);
@@ -1151,7 +1161,6 @@ void rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th);
1151
1161
  void rb_threadptr_pending_interrupt_clear(rb_thread_t *th);
1152
1162
  void rb_threadptr_pending_interrupt_enque(rb_thread_t *th, VALUE v);
1153
1163
  int rb_threadptr_pending_interrupt_active_p(rb_thread_t *th);
1154
- void rb_threadptr_error_print(rb_thread_t *th, VALUE errinfo);
1155
1164
 
1156
1165
  #define RUBY_VM_CHECK_INTS(th) ruby_vm_check_ints(th)
1157
1166
  static inline void
@@ -2,7 +2,7 @@
2
2
 
3
3
  insnhelper.h - helper macros to implement each instructions
4
4
 
5
- $Author: nobu $
5
+ $Author: usa $
6
6
  created at: 04/01/01 15:50:34 JST
7
7
 
8
8
  Copyright (C) 2004-2007 Koichi Sasada
@@ -185,8 +185,8 @@ enum vm_regan_acttype {
185
185
  #define GET_GLOBAL_CONSTANT_STATE() (ruby_vm_global_constant_state)
186
186
  #define INC_GLOBAL_CONSTANT_STATE() (++ruby_vm_global_constant_state)
187
187
 
188
- static VALUE make_no_method_exception(VALUE exc, VALUE format, VALUE obj,
189
- int argc, const VALUE *argv, int priv);
188
+ static VALUE make_no_method_exception(VALUE exc, const char *format,
189
+ VALUE obj, int argc, const VALUE *argv);
190
190
 
191
191
  static inline struct vm_throw_data *
192
192
  THROW_DATA_NEW(VALUE val, rb_control_frame_t *cf, VALUE st)
@@ -194,18 +194,6 @@ THROW_DATA_NEW(VALUE val, rb_control_frame_t *cf, VALUE st)
194
194
  return (struct vm_throw_data *)rb_imemo_new(imemo_throw_data, val, (VALUE)cf, st, 0);
195
195
  }
196
196
 
197
- static inline void
198
- THROW_DATA_CATCH_FRAME_SET(struct vm_throw_data *obj, const rb_control_frame_t *cfp)
199
- {
200
- obj->catch_frame = cfp;
201
- }
202
-
203
- static inline void
204
- THROW_DATA_STATE_SET(struct vm_throw_data *obj, int st)
205
- {
206
- obj->throw_state = (VALUE)st;
207
- }
208
-
209
197
  static inline VALUE
210
198
  THROW_DATA_VAL(const struct vm_throw_data *obj)
211
199
  {
@@ -218,10 +206,38 @@ THROW_DATA_CATCH_FRAME(const struct vm_throw_data *obj)
218
206
  return obj->catch_frame;
219
207
  }
220
208
 
221
- static int
209
+ static inline int
222
210
  THROW_DATA_STATE(const struct vm_throw_data *obj)
223
211
  {
224
212
  return (int)obj->throw_state;
225
213
  }
226
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
+ obj->catch_frame = cfp;
226
+ }
227
+
228
+ static inline void
229
+ THROW_DATA_STATE_SET(struct vm_throw_data *obj, int st)
230
+ {
231
+ obj->throw_state = (VALUE)st;
232
+ }
233
+
234
+ static inline void
235
+ THROW_DATA_CONSUMED_SET(struct vm_throw_data *obj)
236
+ {
237
+ if (THROW_DATA_P(obj) &&
238
+ THROW_DATA_STATE(obj) == TAG_BREAK) {
239
+ obj->flags |= THROW_DATA_CONSUMED;
240
+ }
241
+ }
242
+
227
243
  #endif /* RUBY_INSNHELPER_H */
@@ -59,8 +59,6 @@ static const void *const insns_address_table[] = {
59
59
  LABEL_PTR(defineclass),
60
60
  LABEL_PTR(send),
61
61
  LABEL_PTR(opt_str_freeze),
62
- LABEL_PTR(opt_newarray_max),
63
- LABEL_PTR(opt_newarray_min),
64
62
  LABEL_PTR(opt_send_without_block),
65
63
  LABEL_PTR(invokesuper),
66
64
  LABEL_PTR(invokeblock),
@@ -133,20 +133,20 @@ extern "C" {
133
133
  # endif
134
134
  #endif
135
135
 
136
- static inline int
136
+ static inline unsigned int
137
137
  nlz_int(unsigned int x)
138
138
  {
139
139
  #if defined(HAVE_BUILTIN___BUILTIN_CLZ)
140
140
  if (x == 0) return SIZEOF_INT * CHAR_BIT;
141
- return __builtin_clz(x);
141
+ return (unsigned int)__builtin_clz(x);
142
142
  #else
143
143
  unsigned int y;
144
144
  # if 64 < SIZEOF_INT * CHAR_BIT
145
- int n = 128;
145
+ unsigned int n = 128;
146
146
  # elif 32 < SIZEOF_INT * CHAR_BIT
147
- int n = 64;
147
+ unsigned int n = 64;
148
148
  # else
149
- int n = 32;
149
+ unsigned int n = 32;
150
150
  # endif
151
151
  # if 64 < SIZEOF_INT * CHAR_BIT
152
152
  y = x >> 64; if (y) {n -= 64; x = y;}
@@ -159,24 +159,24 @@ nlz_int(unsigned int x)
159
159
  y = x >> 4; if (y) {n -= 4; x = y;}
160
160
  y = x >> 2; if (y) {n -= 2; x = y;}
161
161
  y = x >> 1; if (y) {return n - 2;}
162
- return (int)(n - x);
162
+ return (unsigned int)(n - x);
163
163
  #endif
164
164
  }
165
165
 
166
- static inline int
166
+ static inline unsigned int
167
167
  nlz_long(unsigned long x)
168
168
  {
169
169
  #if defined(HAVE_BUILTIN___BUILTIN_CLZL)
170
170
  if (x == 0) return SIZEOF_LONG * CHAR_BIT;
171
- return __builtin_clzl(x);
171
+ return (unsigned int)__builtin_clzl(x);
172
172
  #else
173
173
  unsigned long y;
174
174
  # if 64 < SIZEOF_LONG * CHAR_BIT
175
- int n = 128;
175
+ unsigned int n = 128;
176
176
  # elif 32 < SIZEOF_LONG * CHAR_BIT
177
- int n = 64;
177
+ unsigned int n = 64;
178
178
  # else
179
- int n = 32;
179
+ unsigned int n = 32;
180
180
  # endif
181
181
  # if 64 < SIZEOF_LONG * CHAR_BIT
182
182
  y = x >> 64; if (y) {n -= 64; x = y;}
@@ -189,25 +189,25 @@ nlz_long(unsigned long x)
189
189
  y = x >> 4; if (y) {n -= 4; x = y;}
190
190
  y = x >> 2; if (y) {n -= 2; x = y;}
191
191
  y = x >> 1; if (y) {return n - 2;}
192
- return (int)(n - x);
192
+ return (unsigned int)(n - x);
193
193
  #endif
194
194
  }
195
195
 
196
196
  #ifdef HAVE_LONG_LONG
197
- static inline int
197
+ static inline unsigned int
198
198
  nlz_long_long(unsigned LONG_LONG x)
199
199
  {
200
200
  #if defined(HAVE_BUILTIN___BUILTIN_CLZLL)
201
201
  if (x == 0) return SIZEOF_LONG_LONG * CHAR_BIT;
202
- return __builtin_clzll(x);
202
+ return (unsigned int)__builtin_clzll(x);
203
203
  #else
204
204
  unsigned LONG_LONG y;
205
205
  # if 64 < SIZEOF_LONG_LONG * CHAR_BIT
206
- int n = 128;
206
+ unsigned int n = 128;
207
207
  # elif 32 < SIZEOF_LONG_LONG * CHAR_BIT
208
- int n = 64;
208
+ unsigned int n = 64;
209
209
  # else
210
- int n = 32;
210
+ unsigned int n = 32;
211
211
  # endif
212
212
  # if 64 < SIZEOF_LONG_LONG * CHAR_BIT
213
213
  y = x >> 64; if (y) {n -= 64; x = y;}
@@ -220,17 +220,17 @@ nlz_long_long(unsigned LONG_LONG x)
220
220
  y = x >> 4; if (y) {n -= 4; x = y;}
221
221
  y = x >> 2; if (y) {n -= 2; x = y;}
222
222
  y = x >> 1; if (y) {return n - 2;}
223
- return (int)(n - x);
223
+ return (unsigned int)(n - x);
224
224
  #endif
225
225
  }
226
226
  #endif
227
227
 
228
228
  #ifdef HAVE_UINT128_T
229
- static inline int
229
+ static inline unsigned int
230
230
  nlz_int128(uint128_t x)
231
231
  {
232
232
  uint128_t y;
233
- int n = 128;
233
+ unsigned int n = 128;
234
234
  y = x >> 64; if (y) {n -= 64; x = y;}
235
235
  y = x >> 32; if (y) {n -= 32; x = y;}
236
236
  y = x >> 16; if (y) {n -= 16; x = y;}
@@ -238,12 +238,13 @@ nlz_int128(uint128_t x)
238
238
  y = x >> 4; if (y) {n -= 4; x = y;}
239
239
  y = x >> 2; if (y) {n -= 2; x = y;}
240
240
  y = x >> 1; if (y) {return n - 2;}
241
- return (int)(n - x);
241
+ return (unsigned int)(n - x);
242
242
  }
243
243
  #endif
244
244
 
245
- static inline int
246
- nlz_intptr(uintptr_t x) {
245
+ static inline unsigned int
246
+ nlz_intptr(uintptr_t x)
247
+ {
247
248
  #if SIZEOF_VOIDP == 8
248
249
  return nlz_long_long(x);
249
250
  #elif SIZEOF_VOIDP == 4
@@ -251,10 +252,11 @@ nlz_intptr(uintptr_t x) {
251
252
  #endif
252
253
  }
253
254
 
254
- static inline int
255
- rb_popcount32(uint32_t x) {
255
+ static inline unsigned int
256
+ rb_popcount32(uint32_t x)
257
+ {
256
258
  #ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT
257
- return __builtin_popcount(x);
259
+ return (unsigned int)__builtin_popcount(x);
258
260
  #else
259
261
  x = (x & 0x55555555) + (x >> 1 & 0x55555555);
260
262
  x = (x & 0x33333333) + (x >> 2 & 0x33333333);
@@ -265,7 +267,8 @@ rb_popcount32(uint32_t x) {
265
267
  }
266
268
 
267
269
  static inline int
268
- rb_popcount64(uint64_t x) {
270
+ rb_popcount64(uint64_t x)
271
+ {
269
272
  #ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT
270
273
  return __builtin_popcountll(x);
271
274
  #else
@@ -279,7 +282,8 @@ rb_popcount64(uint64_t x) {
279
282
  }
280
283
 
281
284
  static inline int
282
- rb_popcount_intptr(uintptr_t x) {
285
+ rb_popcount_intptr(uintptr_t x)
286
+ {
283
287
  #if SIZEOF_VOIDP == 8
284
288
  return rb_popcount64(x);
285
289
  #elif SIZEOF_VOIDP == 4
@@ -288,7 +292,8 @@ rb_popcount_intptr(uintptr_t x) {
288
292
  }
289
293
 
290
294
  static inline int
291
- ntz_int32(uint32_t x) {
295
+ ntz_int32(uint32_t x)
296
+ {
292
297
  #ifdef HAVE_BUILTIN___BUILTIN_CTZ
293
298
  return __builtin_ctz(x);
294
299
  #else
@@ -297,7 +302,8 @@ ntz_int32(uint32_t x) {
297
302
  }
298
303
 
299
304
  static inline int
300
- ntz_int64(uint64_t x) {
305
+ ntz_int64(uint64_t x)
306
+ {
301
307
  #ifdef HAVE_BUILTIN___BUILTIN_CTZLL
302
308
  return __builtin_ctzll(x);
303
309
  #else
@@ -306,7 +312,8 @@ ntz_int64(uint64_t x) {
306
312
  }
307
313
 
308
314
  static inline int
309
- ntz_intptr(uintptr_t x) {
315
+ ntz_intptr(uintptr_t x)
316
+ {
310
317
  #if SIZEOF_VOIDP == 8
311
318
  return ntz_int64(x);
312
319
  #elif SIZEOF_VOIDP == 4
@@ -323,8 +330,6 @@ ntz_intptr(uintptr_t x) {
323
330
  VALUE rb_int128t2big(int128_t n);
324
331
  #endif
325
332
 
326
- #define ST2FIX(h) LONG2FIX((long)(h))
327
-
328
333
 
329
334
  /* arguments must be Fixnum */
330
335
  static inline VALUE
@@ -397,17 +402,20 @@ rb_fix_mod_fix(VALUE x, VALUE y)
397
402
 
398
403
  #if defined(HAVE_UINT128_T)
399
404
  # define bit_length(x) \
405
+ (unsigned int) \
400
406
  (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
401
407
  sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
402
408
  sizeof(x) <= SIZEOF_LONG_LONG ? SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)) : \
403
409
  SIZEOF_INT128_T * CHAR_BIT - nlz_int128((uint128_t)(x)))
404
410
  #elif defined(HAVE_LONG_LONG)
405
411
  # define bit_length(x) \
412
+ (unsigned int) \
406
413
  (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
407
414
  sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
408
415
  SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)))
409
416
  #else
410
417
  # define bit_length(x) \
418
+ (unsigned int) \
411
419
  (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
412
420
  SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)))
413
421
  #endif
@@ -485,7 +493,7 @@ struct RBignum {
485
493
  BDIGIT ary[BIGNUM_EMBED_LEN_MAX];
486
494
  } as;
487
495
  };
488
- #define BIGNUM_SIGN_BIT FL_USER1
496
+ #define BIGNUM_SIGN_BIT ((VALUE)FL_USER1)
489
497
  /* sign: positive:1, negative:0 */
490
498
  #define BIGNUM_SIGN(b) ((RBASIC(b)->flags & BIGNUM_SIGN_BIT) != 0)
491
499
  #define BIGNUM_SET_SIGN(b,sign) \
@@ -495,13 +503,13 @@ struct RBignum {
495
503
  #define BIGNUM_NEGATIVE_P(b) (!BIGNUM_SIGN(b))
496
504
  #define BIGNUM_NEGATE(b) (RBASIC(b)->flags ^= BIGNUM_SIGN_BIT)
497
505
 
498
- #define BIGNUM_EMBED_FLAG FL_USER2
499
- #define BIGNUM_EMBED_LEN_MASK (FL_USER5|FL_USER4|FL_USER3)
506
+ #define BIGNUM_EMBED_FLAG ((VALUE)FL_USER2)
507
+ #define BIGNUM_EMBED_LEN_MASK ((VALUE)(FL_USER5|FL_USER4|FL_USER3))
500
508
  #define BIGNUM_EMBED_LEN_SHIFT (FL_USHIFT+BIGNUM_EMBED_LEN_NUMBITS)
501
509
  #define BIGNUM_LEN(b) \
502
510
  ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
503
- (long)((RBASIC(b)->flags >> BIGNUM_EMBED_LEN_SHIFT) & \
504
- (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT)) : \
511
+ (size_t)((RBASIC(b)->flags >> BIGNUM_EMBED_LEN_SHIFT) & \
512
+ (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT)) : \
505
513
  RBIGNUM(b)->as.heap.len)
506
514
  /* LSB:BIGNUM_DIGITS(b)[0], MSB:BIGNUM_DIGITS(b)[BIGNUM_LEN(b)-1] */
507
515
  #define BIGNUM_DIGITS(b) \
@@ -559,7 +567,7 @@ struct RHash {
559
567
  #undef RHASH_SIZE
560
568
  #define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev)
561
569
  #define RHASH_IFNONE(h) (RHASH(h)->ifnone)
562
- #define RHASH_SIZE(h) (RHASH(h)->ntbl ? (st_index_t)RHASH(h)->ntbl->num_entries : 0)
570
+ #define RHASH_SIZE(h) (RHASH(h)->ntbl ? RHASH(h)->ntbl->num_entries : (st_index_t)0)
563
571
  #endif
564
572
 
565
573
  /* missing/setproctitle.c */
@@ -766,6 +774,8 @@ struct vm_svar {
766
774
 
767
775
  /* THROW_DATA */
768
776
 
777
+ #define THROW_DATA_CONSUMED IMEMO_FL_USER0
778
+
769
779
  struct vm_throw_data {
770
780
  VALUE flags;
771
781
  VALUE reserved;
@@ -774,19 +784,34 @@ struct vm_throw_data {
774
784
  VALUE throw_state;
775
785
  };
776
786
 
777
- #define THROW_DATA_P(err) RB_TYPE_P((err), T_IMEMO)
787
+ #define THROW_DATA_P(err) RB_TYPE_P(((VALUE)err), T_IMEMO)
778
788
 
779
789
  /* IFUNC */
780
790
 
791
+ struct vm_ifunc_argc {
792
+ #if SIZEOF_INT * 2 > SIZEOF_VALUE
793
+ int min: (SIZEOF_VALUE * CHAR_BIT) / 2;
794
+ int max: (SIZEOF_VALUE * CHAR_BIT) / 2;
795
+ #else
796
+ int min, max;
797
+ #endif
798
+ };
799
+
781
800
  struct vm_ifunc {
782
801
  VALUE flags;
783
802
  VALUE reserved;
784
803
  VALUE (*func)(ANYARGS);
785
804
  const void *data;
786
- ID id;
805
+ struct vm_ifunc_argc argc;
787
806
  };
788
807
 
789
808
  #define IFUNC_NEW(a, b, c) ((struct vm_ifunc *)rb_imemo_new(imemo_ifunc, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
809
+ struct vm_ifunc *rb_vm_ifunc_new(VALUE (*func)(ANYARGS), const void *data, int min_argc, int max_argc);
810
+ static inline struct vm_ifunc *
811
+ rb_vm_ifunc_proc_new(VALUE (*func)(ANYARGS), const void *data)
812
+ {
813
+ return rb_vm_ifunc_new(func, data, 0, UNLIMITED_ARGUMENTS);
814
+ }
790
815
 
791
816
  /* MEMO */
792
817
 
@@ -834,8 +859,8 @@ enum {
834
859
  };
835
860
 
836
861
  struct cmp_opt_data {
837
- int opt_methods;
838
- int opt_inited;
862
+ unsigned int opt_methods;
863
+ unsigned int opt_inited;
839
864
  };
840
865
 
841
866
  #define NEW_CMP_OPT_MEMO(type, value) \
@@ -891,7 +916,7 @@ size_t rb_ary_memsize(VALUE);
891
916
 
892
917
  /* bignum.c */
893
918
  extern const char ruby_digitmap[];
894
- VALUE rb_big_fdiv(VALUE x, VALUE y);
919
+ double rb_big_fdiv_double(VALUE x, VALUE y);
895
920
  VALUE rb_big_uminus(VALUE x);
896
921
  VALUE rb_big_hash(VALUE);
897
922
  VALUE rb_big_odd_p(VALUE);
@@ -1088,6 +1113,7 @@ long rb_objid_hash(st_index_t index);
1088
1113
  long rb_dbl_long_hash(double d);
1089
1114
  st_table *rb_init_identtable(void);
1090
1115
  st_table *rb_init_identtable_with_size(st_index_t size);
1116
+ VALUE rb_hash_compare_by_id_p(VALUE hash);
1091
1117
 
1092
1118
  #define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
1093
1119
  VALUE rb_hash_keys(VALUE hash);
@@ -1136,16 +1162,30 @@ VALUE rb_math_sqrt(VALUE);
1136
1162
  void Init_newline(void);
1137
1163
 
1138
1164
  /* numeric.c */
1165
+
1166
+ #define FIXNUM_POSITIVE_P(num) ((SIGNED_VALUE)(num) > (SIGNED_VALUE)INT2FIX(0))
1167
+ #define FIXNUM_NEGATIVE_P(num) ((SIGNED_VALUE)(num) < 0)
1168
+ #define FIXNUM_ZERO_P(num) ((num) == INT2FIX(0))
1169
+
1170
+ #define INT_NEGATIVE_P(x) (FIXNUM_P(x) ? FIXNUM_NEGATIVE_P(x) : BIGNUM_NEGATIVE_P(x))
1171
+
1139
1172
  #ifndef ROUND_DEFAULT
1140
- # define ROUND_DEFAULT RUBY_NUM_ROUND_HALF_EVEN
1173
+ # define ROUND_DEFAULT RUBY_NUM_ROUND_HALF_UP
1141
1174
  #endif
1142
1175
  enum ruby_num_rounding_mode {
1143
1176
  RUBY_NUM_ROUND_HALF_UP,
1144
1177
  RUBY_NUM_ROUND_HALF_EVEN,
1178
+ RUBY_NUM_ROUND_HALF_DOWN,
1145
1179
  RUBY_NUM_ROUND_DEFAULT = ROUND_DEFAULT
1146
1180
  };
1147
- #define ROUND_TO(mode, up, even) \
1148
- ((mode) == RUBY_NUM_ROUND_HALF_EVEN ? even : up)
1181
+ #define ROUND_TO(mode, even, up, down) \
1182
+ ((mode) == RUBY_NUM_ROUND_HALF_EVEN ? even : \
1183
+ (mode) == RUBY_NUM_ROUND_HALF_UP ? up : down)
1184
+ #define ROUND_FUNC(mode, name) \
1185
+ ROUND_TO(mode, name##_half_even, name##_half_up, name##_half_down)
1186
+ #define ROUND_CALL(mode, name, args) \
1187
+ ROUND_TO(mode, name##_half_even args, \
1188
+ name##_half_up args, name##_half_down args)
1149
1189
 
1150
1190
  int rb_num_to_uint(VALUE val, unsigned int *ret);
1151
1191
  VALUE ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl);
@@ -1155,6 +1195,7 @@ int rb_num_negative_p(VALUE);
1155
1195
  VALUE rb_int_succ(VALUE num);
1156
1196
  VALUE rb_int_pred(VALUE num);
1157
1197
  VALUE rb_int_uminus(VALUE num);
1198
+ VALUE rb_float_uminus(VALUE num);
1158
1199
  VALUE rb_int_plus(VALUE x, VALUE y);
1159
1200
  VALUE rb_int_minus(VALUE x, VALUE y);
1160
1201
  VALUE rb_int_mul(VALUE x, VALUE y);
@@ -1164,8 +1205,21 @@ VALUE rb_int_round(VALUE num, int ndigits, enum ruby_num_rounding_mode mode);
1164
1205
  VALUE rb_int2str(VALUE num, int base);
1165
1206
  VALUE rb_dbl_hash(double d);
1166
1207
  VALUE rb_fix_plus(VALUE x, VALUE y);
1208
+ VALUE rb_int_gt(VALUE x, VALUE y);
1209
+ VALUE rb_float_gt(VALUE x, VALUE y);
1167
1210
  VALUE rb_int_ge(VALUE x, VALUE y);
1168
1211
  enum ruby_num_rounding_mode rb_num_get_rounding_option(VALUE opts);
1212
+ double rb_int_fdiv_double(VALUE x, VALUE y);
1213
+ VALUE rb_int_pow(VALUE x, VALUE y);
1214
+ VALUE rb_float_pow(VALUE x, VALUE y);
1215
+ VALUE rb_int_cmp(VALUE x, VALUE y);
1216
+ VALUE rb_int_equal(VALUE x, VALUE y);
1217
+ VALUE rb_int_divmod(VALUE x, VALUE y);
1218
+ VALUE rb_int_and(VALUE x, VALUE y);
1219
+ VALUE rb_int_lshift(VALUE x, VALUE y);
1220
+ VALUE rb_int_div(VALUE x, VALUE y);
1221
+ VALUE rb_int_abs(VALUE num);
1222
+ VALUE rb_float_abs(VALUE flt);
1169
1223
 
1170
1224
  #if USE_FLONUM
1171
1225
  #define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n)))
@@ -1186,7 +1240,7 @@ rb_float_flonum_value(VALUE v)
1186
1240
  /* e: xx1... -> 011... */
1187
1241
  /* xx0... -> 100... */
1188
1242
  /* ^b63 */
1189
- t.v = RUBY_BIT_ROTR((2 - b63) | (v & ~0x03), 3);
1243
+ t.v = RUBY_BIT_ROTR((2 - b63) | (v & ~(VALUE)0x03), 3);
1190
1244
  return t.d;
1191
1245
  }
1192
1246
  #endif
@@ -1294,8 +1348,9 @@ ID rb_id_attrget(ID id);
1294
1348
  VALUE rb_proc_location(VALUE self);
1295
1349
  st_index_t rb_hash_proc(st_index_t hash, VALUE proc);
1296
1350
  int rb_block_arity(void);
1351
+ int rb_block_min_max_arity(int *max);
1297
1352
  VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val);
1298
- VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val);
1353
+ VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val, int min_argc, int max_argc);
1299
1354
 
1300
1355
  /* process.c */
1301
1356
  #define RB_MAX_GROUPS (65536)
@@ -1354,15 +1409,19 @@ rb_pid_t rb_fork_ruby(int *status);
1354
1409
  void rb_last_status_clear(void);
1355
1410
 
1356
1411
  /* rational.c */
1412
+ VALUE rb_rational_uminus(VALUE self);
1357
1413
  VALUE rb_rational_plus(VALUE self, VALUE other);
1358
1414
  VALUE rb_lcm(VALUE x, VALUE y);
1359
1415
  VALUE rb_rational_reciprocal(VALUE x);
1360
1416
  VALUE rb_cstr_to_rat(const char *, int);
1417
+ VALUE rb_rational_abs(VALUE self);
1418
+ VALUE rb_rational_cmp(VALUE self, VALUE other);
1361
1419
 
1362
1420
  /* re.c */
1363
1421
  VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline);
1364
1422
  VALUE rb_reg_check_preprocess(VALUE);
1365
1423
  long rb_reg_search0(VALUE, VALUE, long, int, int);
1424
+ VALUE rb_reg_match_p(VALUE re, VALUE str, long pos);
1366
1425
  void rb_backref_set_string(VALUE string, long pos, long len);
1367
1426
  int rb_match_count(VALUE match);
1368
1427
  int rb_match_nth_defined(int nth, VALUE match);
@@ -1381,7 +1440,6 @@ VALUE rb_strftime(const char *format, size_t format_len, rb_encoding *enc,
1381
1440
  #endif
1382
1441
 
1383
1442
  /* string.c */
1384
- void Init_frozen_strings(void);
1385
1443
  VALUE rb_fstring(VALUE);
1386
1444
  VALUE rb_fstring_new(const char *ptr, long len);
1387
1445
  #define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str))
@@ -1416,6 +1474,8 @@ VALUE rb_id_quote_unprintable(ID);
1416
1474
  char *rb_str_fill_terminator(VALUE str, const int termlen);
1417
1475
  void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen);
1418
1476
  VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg);
1477
+ VALUE rb_str_tmp_frozen_acquire(VALUE str);
1478
+ void rb_str_tmp_frozen_release(VALUE str, VALUE tmp);
1419
1479
  VALUE rb_str_chomp_string(VALUE str, VALUE chomp);
1420
1480
  #ifdef RUBY_ENCODING_H
1421
1481
  VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc);
@@ -1531,7 +1591,7 @@ void rb_vm_pop_cfunc_frame(void);
1531
1591
  int rb_vm_add_root_module(ID id, VALUE module);
1532
1592
  void rb_vm_check_redefinition_by_prepend(VALUE klass);
1533
1593
  VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
1534
- VALUE ruby_vm_sysstack_error_copy(void);
1594
+ VALUE ruby_vm_special_exception_copy(VALUE);
1535
1595
  PUREFUNC(st_table *rb_vm_fstring_table(void));
1536
1596
 
1537
1597
 
@@ -1548,6 +1608,10 @@ VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv
1548
1608
  VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE);
1549
1609
  VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, int *stateptr);
1550
1610
  VALUE rb_yield_1(VALUE val);
1611
+ VALUE rb_yield_lambda(VALUE values);
1612
+ VALUE rb_lambda_call(VALUE obj, ID mid, int argc, const VALUE *argv,
1613
+ rb_block_call_func_t bl_proc, int min_argc, int max_argc,
1614
+ VALUE data2);
1551
1615
 
1552
1616
  /* vm_insnhelper.c */
1553
1617
  VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
@@ -1640,6 +1704,7 @@ VALUE rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash);
1640
1704
  void rb_execarg_setenv(VALUE execarg_obj, VALUE env);
1641
1705
 
1642
1706
  /* rational.c (export) */
1707
+ VALUE rb_gcd(VALUE x, VALUE y);
1643
1708
  VALUE rb_gcd_normal(VALUE self, VALUE other);
1644
1709
  #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
1645
1710
  VALUE rb_gcd_gmp(VALUE x, VALUE y);