ruby-internal 0.7.3 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. data/bin/ruby-internal-node-dump +1 -1
  2. data/bin/ruby-internal-obfuscate +1 -1
  3. data/ext/cached/ruby-1.8.4/internal/method/{method.h → internal_method.h} +12 -0
  4. data/ext/cached/ruby-1.8.4/internal/module/getcfp.h +13 -0
  5. data/ext/cached/ruby-1.8.4/internal/node/global_entry.h +94 -0
  6. data/ext/cached/ruby-1.8.4/internal/node/node_type_descrip.c +41 -41
  7. data/ext/cached/ruby-1.8.4/internal/node/nodeinfo.c +288 -273
  8. data/ext/cached/ruby-1.8.4/internal/vm/instruction/insns_info.c +3 -0
  9. data/ext/cached/ruby-1.8.4/internal/vm/iseq/iseq_load.inc +21 -2
  10. data/ext/cached/{ruby-1.8.3/internal/method/method.h → ruby-1.8.5/internal/method/internal_method.h} +12 -0
  11. data/ext/cached/ruby-1.8.5/internal/module/getcfp.h +13 -0
  12. data/ext/cached/ruby-1.8.5/internal/node/global_entry.h +94 -0
  13. data/ext/cached/ruby-1.8.5/internal/node/node_type_descrip.c +45 -45
  14. data/ext/cached/ruby-1.8.5/internal/node/nodeinfo.c +310 -295
  15. data/ext/cached/ruby-1.8.5/internal/vm/instruction/insns_info.c +3 -0
  16. data/ext/cached/ruby-1.8.5/internal/vm/iseq/iseq_load.inc +21 -2
  17. data/ext/cached/{ruby-1.8.5/internal/method/method.h → ruby-1.8.6/internal/method/internal_method.h} +12 -0
  18. data/ext/cached/ruby-1.8.6/internal/module/getcfp.h +13 -0
  19. data/ext/cached/ruby-1.8.6/internal/node/global_entry.h +94 -0
  20. data/ext/cached/ruby-1.8.6/internal/node/node_type_descrip.c +48 -48
  21. data/ext/cached/ruby-1.8.6/internal/node/nodeinfo.c +323 -308
  22. data/ext/cached/ruby-1.8.6/internal/vm/instruction/insns_info.c +3 -0
  23. data/ext/cached/ruby-1.8.6/internal/vm/iseq/iseq_load.inc +21 -2
  24. data/ext/cached/{ruby-1.8.6/internal/method/method.h → ruby-1.8.7/internal/method/internal_method.h} +12 -0
  25. data/ext/cached/ruby-1.8.7/internal/module/getcfp.h +13 -0
  26. data/ext/cached/ruby-1.8.7/internal/node/global_entry.h +98 -0
  27. data/ext/cached/ruby-1.8.7/internal/node/node_type_descrip.c +42 -42
  28. data/ext/cached/ruby-1.8.7/internal/node/nodeinfo.c +276 -261
  29. data/ext/cached/ruby-1.8.7/internal/vm/instruction/insns_info.c +3 -0
  30. data/ext/cached/ruby-1.8.7/internal/vm/iseq/iseq_load.inc +21 -2
  31. data/ext/cached/{ruby-1.9.0/internal/method/method.h → ruby-1.9.1/internal/method/internal_method.h} +12 -0
  32. data/ext/cached/ruby-1.9.1/internal/module/classpath.c +12 -14
  33. data/ext/cached/ruby-1.9.1/internal/module/getcfp.h +25 -0
  34. data/ext/cached/ruby-1.9.1/internal/node/global_entry.h +86 -0
  35. data/ext/cached/ruby-1.9.1/internal/node/node_type_descrip.c +46 -48
  36. data/ext/cached/ruby-1.9.1/internal/node/nodeinfo.c +311 -412
  37. data/ext/cached/ruby-1.9.1/internal/vm/instruction/insns_info.c +3 -0
  38. data/ext/cached/ruby-1.9.1/internal/vm/iseq/iseq_load.inc +28 -6
  39. data/ext/cached/ruby-1.9.1/internal/yarv-headers/iseq.h +1 -0
  40. data/ext/cached/ruby-1.9.1/internal/yarv-headers/parse.h +6 -6
  41. data/ext/cached/ruby-1.9.1/internal/yarv-headers/revision.h +1 -1
  42. data/ext/cached/ruby-1.9.1/internal/yarv-headers/version.h +6 -5
  43. data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_core.h +3 -2
  44. data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_insnhelper.h +1 -0
  45. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/binding/block.h +0 -0
  46. data/ext/cached/{ruby-1.9.1/internal/method/method.h → ruby-1.9.2/internal/method/internal_method.h} +16 -5
  47. data/ext/cached/ruby-1.9.2/internal/module/classpath.c +40 -0
  48. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/module/classpath.h +0 -0
  49. data/ext/cached/ruby-1.9.2/internal/module/getcfp.h +25 -0
  50. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/node/block.h +0 -0
  51. data/ext/cached/ruby-1.9.2/internal/node/global_entry.h +93 -0
  52. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/node/node_type_descrip.c +44 -48
  53. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/node/nodeinfo.c +291 -439
  54. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/node/nodeinfo.h +0 -0
  55. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/proc/block.h +0 -0
  56. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/tag/tag.h +0 -0
  57. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/vm/instruction/insns_info.c +141 -64
  58. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/vm/instruction/insns_info.h +88 -80
  59. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/vm/iseq/insns_info.inc +77 -70
  60. data/ext/cached/ruby-1.9.2/internal/vm/iseq/iseq_load.inc +426 -0
  61. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/debug.h +1 -1
  62. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/dln.h +3 -3
  63. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/encdb.h +18 -2
  64. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/eval_intern.h +39 -28
  65. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/gc.h +7 -5
  66. data/ext/cached/ruby-1.9.2/internal/yarv-headers/id.h +170 -0
  67. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/iseq.h +20 -10
  68. data/ext/cached/ruby-1.9.2/internal/yarv-headers/method.h +103 -0
  69. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/node.h +14 -47
  70. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/parse.h +31 -148
  71. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/regenc.h +7 -3
  72. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/regint.h +16 -17
  73. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/regparse.h +4 -1
  74. data/ext/cached/ruby-1.9.2/internal/yarv-headers/revision.h +1 -0
  75. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/thread_pthread.h +4 -1
  76. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/thread_win32.h +1 -1
  77. data/ext/cached/ruby-1.9.2/internal/yarv-headers/timev.h +21 -0
  78. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/transcode_data.h +20 -10
  79. data/ext/cached/ruby-1.9.2/internal/yarv-headers/transdb.h +179 -0
  80. data/ext/cached/ruby-1.9.2/internal/yarv-headers/version.h +55 -0
  81. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/vm_core.h +127 -84
  82. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/vm_exec.h +4 -7
  83. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/vm_insnhelper.h +53 -36
  84. data/ext/cached/{ruby-1.9.0 → ruby-1.9.2}/internal/yarv-headers/vm_opts.h +1 -1
  85. data/ext/cached/ruby-1.9.3/internal/binding/block.h +12 -0
  86. data/ext/cached/ruby-1.9.3/internal/method/internal_method.h +32 -0
  87. data/ext/cached/ruby-1.9.3/internal/module/classpath.c +40 -0
  88. data/ext/cached/{ruby-1.8.0 → ruby-1.9.3}/internal/module/classpath.h +5 -2
  89. data/ext/cached/ruby-1.9.3/internal/module/getcfp.h +25 -0
  90. data/ext/cached/ruby-1.9.3/internal/node/block.h +12 -0
  91. data/ext/cached/ruby-1.9.3/internal/node/global_entry.h +93 -0
  92. data/ext/cached/{ruby-1.8.3 → ruby-1.9.3}/internal/node/node_type_descrip.c +48 -57
  93. data/ext/cached/{ruby-1.6.8 → ruby-1.9.3}/internal/node/nodeinfo.c +589 -740
  94. data/ext/cached/{ruby-1.8.0 → ruby-1.9.3}/internal/node/nodeinfo.h +4 -3
  95. data/ext/cached/ruby-1.9.3/internal/proc/block.h +12 -0
  96. data/ext/cached/ruby-1.9.3/internal/tag/tag.h +6 -0
  97. data/ext/cached/ruby-1.9.3/internal/vm/instruction/insns_info.c +6013 -0
  98. data/ext/cached/ruby-1.9.3/internal/vm/instruction/insns_info.h +899 -0
  99. data/ext/cached/ruby-1.9.3/internal/vm/iseq/insns_info.inc +707 -0
  100. data/ext/cached/ruby-1.9.3/internal/vm/iseq/iseq_load.inc +423 -0
  101. data/ext/cached/ruby-1.9.3/internal/yarv-headers/addr2line.h +21 -0
  102. data/ext/cached/ruby-1.9.3/internal/yarv-headers/atomic.h +56 -0
  103. data/ext/cached/ruby-1.9.3/internal/yarv-headers/constant.h +34 -0
  104. data/ext/cached/ruby-1.9.3/internal/yarv-headers/debug.h +41 -0
  105. data/ext/cached/ruby-1.9.3/internal/yarv-headers/dln.h +50 -0
  106. data/ext/cached/ruby-1.9.3/internal/yarv-headers/encdb.h +167 -0
  107. data/ext/cached/ruby-1.9.3/internal/yarv-headers/eval_intern.h +234 -0
  108. data/ext/cached/ruby-1.9.3/internal/yarv-headers/gc.h +98 -0
  109. data/ext/cached/ruby-1.9.3/internal/yarv-headers/id.h +175 -0
  110. data/ext/cached/ruby-1.9.3/internal/yarv-headers/internal.h +232 -0
  111. data/ext/cached/ruby-1.9.3/internal/yarv-headers/iseq.h +125 -0
  112. data/ext/cached/ruby-1.9.3/internal/yarv-headers/method.h +105 -0
  113. data/ext/cached/ruby-1.9.3/internal/yarv-headers/node.h +503 -0
  114. data/ext/cached/ruby-1.9.3/internal/yarv-headers/parse.h +186 -0
  115. data/ext/cached/ruby-1.9.3/internal/yarv-headers/regenc.h +219 -0
  116. data/ext/cached/ruby-1.9.3/internal/yarv-headers/regint.h +850 -0
  117. data/ext/cached/ruby-1.9.3/internal/yarv-headers/regparse.h +362 -0
  118. data/ext/cached/ruby-1.9.3/internal/yarv-headers/revision.h +1 -0
  119. data/ext/cached/ruby-1.9.3/internal/yarv-headers/thread_pthread.h +51 -0
  120. data/ext/cached/ruby-1.9.3/internal/yarv-headers/thread_win32.h +40 -0
  121. data/ext/cached/ruby-1.9.3/internal/yarv-headers/timev.h +21 -0
  122. data/ext/cached/ruby-1.9.3/internal/yarv-headers/transcode_data.h +117 -0
  123. data/ext/cached/ruby-1.9.3/internal/yarv-headers/transdb.h +189 -0
  124. data/ext/cached/ruby-1.9.3/internal/yarv-headers/version.h +52 -0
  125. data/ext/cached/ruby-1.9.3/internal/yarv-headers/vm_core.h +756 -0
  126. data/ext/cached/ruby-1.9.3/internal/yarv-headers/vm_exec.h +184 -0
  127. data/ext/cached/ruby-1.9.3/internal/yarv-headers/vm_insnhelper.h +220 -0
  128. data/ext/cached/ruby-1.9.3/internal/yarv-headers/vm_opts.h +51 -0
  129. data/ext/internal/binding/block.h +20 -0
  130. data/ext/internal/method/internal_method.h +5 -38
  131. data/ext/internal/method/internal_method.h.rpp +0 -7
  132. data/ext/internal/method/method.c +52 -32
  133. data/ext/internal/module/classpath.c +18 -13
  134. data/ext/internal/module/classpath.h +3 -3
  135. data/ext/internal/module/extconf.rb +3 -2
  136. data/ext/internal/module/getcfp.h +13 -0
  137. data/ext/internal/module/getcfp.h.rpp +44 -0
  138. data/ext/internal/module/module.c +58 -21
  139. data/ext/internal/node/block.h +20 -0
  140. data/ext/internal/node/extconf.rb +2 -0
  141. data/ext/internal/node/global_entry.h +69 -13
  142. data/ext/internal/node/global_entry.h.rpp +11 -2
  143. data/ext/internal/node/node.c +30 -3
  144. data/ext/internal/node/node_type_descrip.c +47 -38
  145. data/ext/internal/node/nodeinfo.c +622 -306
  146. data/ext/internal/node/nodeinfo.h +1 -4
  147. data/ext/internal/proc/block.h +20 -0
  148. data/ext/internal/tag/tag.h +10 -0
  149. data/ext/internal/thread/thread.c +9 -3
  150. data/ext/internal/vm/extconf.rb +1 -0
  151. data/ext/internal/vm/instruction/insns_info.c +3 -5974
  152. data/ext/internal/vm/instruction/insns_info.h +0 -878
  153. data/ext/internal/vm/iseq/extconf.rb +1 -0
  154. data/ext/internal/vm/iseq/iseq.c +38 -4
  155. data/ext/internal/vm/iseq/iseq_load.inc.rpp +23 -5
  156. data/ext/internal/vm/vm.c +28 -0
  157. data/lib/internal/classtree.rb +28 -0
  158. data/lib/internal/debug.rb +10 -2
  159. data/lib/internal/method/as_code.rb +25 -0
  160. data/lib/internal/method/as_expression.rb +2 -3
  161. data/lib/internal/method/origin.rb +29 -0
  162. data/lib/internal/method/signature.rb +5 -300
  163. data/lib/internal/method/signature/argument.rb +102 -0
  164. data/lib/internal/method/signature/iseq.rb +52 -0
  165. data/lib/internal/method/signature/node.rb +160 -0
  166. data/lib/internal/method/signature/signature.rb +23 -0
  167. data/lib/internal/proc/as_code.rb +2 -0
  168. data/lib/internal/proc/as_expression.rb +2 -0
  169. data/lib/internal/vm/bytedecoder.rb +5 -5
  170. data/lib/internal/vm/iseq/as_code.rb +2 -2
  171. data/lib/internal/vm/iseq/as_expression.rb +2 -2
  172. data/test/test_dump_method.rb +1 -1
  173. data/test/test_method.rb +21 -3
  174. data/test/test_node.rb +20 -4
  175. metadata +152 -155
  176. data/ext/cached/ruby-1.6.8/internal/binding/block.h +0 -35
  177. data/ext/cached/ruby-1.6.8/internal/method/method.h +0 -19
  178. data/ext/cached/ruby-1.6.8/internal/module/classpath.c +0 -3
  179. data/ext/cached/ruby-1.6.8/internal/module/classpath.h +0 -8
  180. data/ext/cached/ruby-1.6.8/internal/node/block.h +0 -35
  181. data/ext/cached/ruby-1.6.8/internal/node/global_entry.h +0 -15
  182. data/ext/cached/ruby-1.6.8/internal/node/node_type_descrip.c +0 -149
  183. data/ext/cached/ruby-1.6.8/internal/node/nodeinfo.h +0 -69
  184. data/ext/cached/ruby-1.6.8/internal/proc/block.h +0 -35
  185. data/ext/cached/ruby-1.6.8/internal/tag/tag.h +0 -15
  186. data/ext/cached/ruby-1.6.8/internal/vm/instruction/insns_info.c +0 -39
  187. data/ext/cached/ruby-1.6.8/internal/vm/instruction/insns_info.h +0 -21
  188. data/ext/cached/ruby-1.6.8/internal/vm/iseq/insns_info.inc +0 -12
  189. data/ext/cached/ruby-1.6.8/internal/vm/iseq/iseq_load.inc +0 -9
  190. data/ext/cached/ruby-1.8.0/internal/binding/block.h +0 -37
  191. data/ext/cached/ruby-1.8.0/internal/method/method.h +0 -19
  192. data/ext/cached/ruby-1.8.0/internal/module/classpath.c +0 -27
  193. data/ext/cached/ruby-1.8.0/internal/node/block.h +0 -37
  194. data/ext/cached/ruby-1.8.0/internal/node/global_entry.h +0 -10
  195. data/ext/cached/ruby-1.8.0/internal/node/node_type_descrip.c +0 -155
  196. data/ext/cached/ruby-1.8.0/internal/node/nodeinfo.c +0 -5744
  197. data/ext/cached/ruby-1.8.0/internal/proc/block.h +0 -37
  198. data/ext/cached/ruby-1.8.0/internal/tag/tag.h +0 -15
  199. data/ext/cached/ruby-1.8.0/internal/vm/instruction/insns_info.c +0 -39
  200. data/ext/cached/ruby-1.8.0/internal/vm/instruction/insns_info.h +0 -21
  201. data/ext/cached/ruby-1.8.0/internal/vm/iseq/insns_info.inc +0 -12
  202. data/ext/cached/ruby-1.8.0/internal/vm/iseq/iseq_load.inc +0 -9
  203. data/ext/cached/ruby-1.8.1/internal/binding/block.h +0 -31
  204. data/ext/cached/ruby-1.8.1/internal/method/method.h +0 -19
  205. data/ext/cached/ruby-1.8.1/internal/module/classpath.c +0 -27
  206. data/ext/cached/ruby-1.8.1/internal/module/classpath.h +0 -14
  207. data/ext/cached/ruby-1.8.1/internal/node/block.h +0 -31
  208. data/ext/cached/ruby-1.8.1/internal/node/global_entry.h +0 -10
  209. data/ext/cached/ruby-1.8.1/internal/node/node_type_descrip.c +0 -154
  210. data/ext/cached/ruby-1.8.1/internal/node/nodeinfo.c +0 -5736
  211. data/ext/cached/ruby-1.8.1/internal/node/nodeinfo.h +0 -69
  212. data/ext/cached/ruby-1.8.1/internal/proc/block.h +0 -31
  213. data/ext/cached/ruby-1.8.1/internal/tag/tag.h +0 -16
  214. data/ext/cached/ruby-1.8.1/internal/vm/instruction/insns_info.c +0 -39
  215. data/ext/cached/ruby-1.8.1/internal/vm/instruction/insns_info.h +0 -21
  216. data/ext/cached/ruby-1.8.1/internal/vm/iseq/insns_info.inc +0 -12
  217. data/ext/cached/ruby-1.8.1/internal/vm/iseq/iseq_load.inc +0 -9
  218. data/ext/cached/ruby-1.8.2/internal/binding/block.h +0 -32
  219. data/ext/cached/ruby-1.8.2/internal/method/method.h +0 -19
  220. data/ext/cached/ruby-1.8.2/internal/module/classpath.c +0 -45
  221. data/ext/cached/ruby-1.8.2/internal/module/classpath.h +0 -17
  222. data/ext/cached/ruby-1.8.2/internal/node/block.h +0 -32
  223. data/ext/cached/ruby-1.8.2/internal/node/global_entry.h +0 -10
  224. data/ext/cached/ruby-1.8.2/internal/node/node_type_descrip.c +0 -154
  225. data/ext/cached/ruby-1.8.2/internal/node/nodeinfo.c +0 -5736
  226. data/ext/cached/ruby-1.8.2/internal/node/nodeinfo.h +0 -69
  227. data/ext/cached/ruby-1.8.2/internal/proc/block.h +0 -32
  228. data/ext/cached/ruby-1.8.2/internal/tag/tag.h +0 -16
  229. data/ext/cached/ruby-1.8.2/internal/vm/instruction/insns_info.c +0 -39
  230. data/ext/cached/ruby-1.8.2/internal/vm/instruction/insns_info.h +0 -21
  231. data/ext/cached/ruby-1.8.2/internal/vm/iseq/insns_info.inc +0 -12
  232. data/ext/cached/ruby-1.8.2/internal/vm/iseq/iseq_load.inc +0 -9
  233. data/ext/cached/ruby-1.8.3/internal/binding/block.h +0 -32
  234. data/ext/cached/ruby-1.8.3/internal/module/classpath.c +0 -45
  235. data/ext/cached/ruby-1.8.3/internal/module/classpath.h +0 -17
  236. data/ext/cached/ruby-1.8.3/internal/node/block.h +0 -32
  237. data/ext/cached/ruby-1.8.3/internal/node/global_entry.h +0 -10
  238. data/ext/cached/ruby-1.8.3/internal/node/nodeinfo.c +0 -5736
  239. data/ext/cached/ruby-1.8.3/internal/node/nodeinfo.h +0 -69
  240. data/ext/cached/ruby-1.8.3/internal/proc/block.h +0 -32
  241. data/ext/cached/ruby-1.8.3/internal/tag/tag.h +0 -16
  242. data/ext/cached/ruby-1.8.3/internal/vm/instruction/insns_info.c +0 -39
  243. data/ext/cached/ruby-1.8.3/internal/vm/instruction/insns_info.h +0 -21
  244. data/ext/cached/ruby-1.8.3/internal/vm/iseq/insns_info.inc +0 -12
  245. data/ext/cached/ruby-1.8.3/internal/vm/iseq/iseq_load.inc +0 -9
  246. data/ext/cached/ruby-1.8.7/internal/method/method.h +0 -20
  247. data/ext/cached/ruby-1.9.0/internal/module/classpath.c +0 -42
  248. data/ext/cached/ruby-1.9.0/internal/node/global_entry.h +0 -10
  249. data/ext/cached/ruby-1.9.0/internal/vm/iseq/iseq_load.inc +0 -13
  250. data/ext/cached/ruby-1.9.0/internal/yarv-headers/id.h +0 -83
  251. data/ext/cached/ruby-1.9.0/internal/yarv-headers/revision.h +0 -1
  252. data/ext/cached/ruby-1.9.0/internal/yarv-headers/transdb.h +0 -67
  253. data/ext/cached/ruby-1.9.0/internal/yarv-headers/version.h +0 -57
  254. data/ext/internal/module/cfp.h +0 -13
@@ -7,6 +7,26 @@
7
7
  #include "env.h"
8
8
  #endif
9
9
 
10
+ struct BLOCK {
11
+ NODE *var;
12
+ NODE *body;
13
+ VALUE self;
14
+ struct FRAME frame;
15
+ struct SCOPE *scope;
16
+ VALUE klass;
17
+ NODE *cref;
18
+ int iter;
19
+ int vmode;
20
+ int flags;
21
+ int uniq;
22
+ struct RVarmap *dyna_vars;
23
+ VALUE orig_thread;
24
+ VALUE wrapper;
25
+ VALUE block_obj;
26
+ struct BLOCK *outer;
27
+ struct BLOCK *prev;
28
+ };
29
+
10
30
 
11
31
  #endif
12
32
 
@@ -18,48 +18,15 @@
18
18
  #endif
19
19
 
20
20
  struct METHOD {
21
+ VALUE klass, rklass;
21
22
  VALUE recv;
22
- VALUE rclass;
23
- ID id;
24
- rb_method_entry_t me;
25
- };
26
-
27
- static void
28
- bm_mark(void *ptr)
29
- {
30
- struct METHOD *data = ptr;
31
- rb_gc_mark(data->rclass);
32
- rb_gc_mark(data->recv);
33
- rb_mark_method_entry(&data->me);
34
- }
35
-
36
- static void
37
- bm_free(void *ptr)
38
- {
39
- struct METHOD *data = ptr;
40
- rb_method_definition_t *def = data->me.def;
41
- if (def->alias_count == 0)
42
- xfree(def);
43
- else if (def->alias_count > 0)
44
- def->alias_count--;
45
- xfree(ptr);
46
- }
47
-
48
- static size_t
49
- bm_memsize(const void *ptr)
50
- {
51
- return ptr ? sizeof(struct METHOD) : 0;
52
- }
53
-
54
- static const rb_data_type_t method_data_type = {
55
- "method",
56
- bm_mark,
57
- bm_free,
58
- bm_memsize,
23
+ ID id, oid;
24
+ int safe_level;
25
+ NODE *body;
59
26
  };
60
27
 
61
28
  #define METHOD_OCLASS(m) m->klass
62
- #define METHOD_RCLASS(m) m->rclass
29
+ #define METHOD_RCLASS(m) m->rklass
63
30
 
64
31
  #endif
65
32
 
@@ -38,13 +38,6 @@
38
38
  when /^struct (METHOD)/
39
39
  write = true
40
40
  stopwrite = false
41
- when /rb_data_type_t method_data_type = {/
42
- write = true
43
- stopwrite = false
44
- when /^(bm_mark|bm_free|bm_memsize)/
45
- puts prev_line
46
- write = true
47
- stopwrite = false
48
41
  when /^\}/
49
42
  stopwrite = true
50
43
  when /VALUE oclass/
@@ -23,11 +23,33 @@ static VALUE rb_cUnboundMethod = Qnil;
23
23
  #endif
24
24
 
25
25
  #ifdef HAVE_TYPE_STRUCT_RTYPEDDATA
26
+
26
27
  # define UNWRAP_METHOD(method, m) \
27
- TypedData_Get_Struct(method, struct METHOD, &method_data_type, m);
28
+ TypedData_Get_Struct(method, struct METHOD, p_method_data_type, m);
29
+
30
+ static rb_data_type_t const * p_method_data_type;
31
+
32
+ static void init_method_data_type()
33
+ {
34
+ /* Create a METHOD object -- doesn't matter which method we use */
35
+ VALUE retval = rb_funcall(
36
+ rb_cObject, rb_intern("method"), 1, ID2SYM(rb_intern("__id__")));
37
+ p_method_data_type = RTYPEDDATA_TYPE(retval);
38
+ }
39
+
28
40
  #else
41
+
29
42
  # define UNWRAP_METHOD(method, m) \
30
43
  Data_Get_Struct(method, struct METHOD, m)
44
+
45
+ #endif
46
+
47
+ #if RUBY_VERSION_CODE >= 193
48
+ # define METHOD_DEF(method) method->me->def
49
+ # define METHOD_KLASS(method) method->me->klass
50
+ #elif RUBY_VERSION_CODE >= 192
51
+ # define METHOD_DEF(method) method->me.def
52
+ # define METHOD_KLASS(method) method->me.klass
31
53
  #endif
32
54
 
33
55
  static VALUE rb_mMarshal;
@@ -99,10 +121,8 @@ static VALUE method_oid(VALUE method)
99
121
  {
100
122
  struct METHOD * m;
101
123
  UNWRAP_METHOD(method, m);
102
- #if RUBY_VERSION_CODE >= 193
103
- return ID2SYM(m->me->def->original_id);
104
- #elif RUBY_VERSION_CODE >= 192
105
- return ID2SYM(m->me.def->original_id);
124
+ #if RUBY_VERSION_CODE >= 192
125
+ return ID2SYM(METHOD_DEF(m)->original_id);
106
126
  #else
107
127
  return ID2SYM(m->oid);
108
128
  #endif
@@ -160,10 +180,8 @@ static VALUE method_body(VALUE method)
160
180
  rb_raise(rb_eSecurityError, "Insecure: can't get method body");
161
181
  }
162
182
  UNWRAP_METHOD(method, m);
163
- #if RUBY_VERSION_CODE >= 193
164
- return m->me->def->body.iseq->self; /* TODO: body is a union; is this right? */
165
- #elif RUBY_VERSION_CODE >= 192
166
- return m->me.def->body.iseq->self; /* TODO: body is a union; is this right? */
183
+ #if RUBY_VERSION_CODE >= 192
184
+ return METHOD_DEF(m)->body.iseq->self; /* TODO: body is a union; is this right? */
167
185
  #else
168
186
  return wrap_node(m->body);
169
187
  #endif
@@ -193,32 +211,30 @@ static VALUE method_dump(VALUE self, VALUE limit)
193
211
  arr = rb_ary_new();
194
212
  UNWRAP_METHOD(self, method);
195
213
  #if RUBY_VERSION_CODE >= 193
196
- rb_ary_push(arr, rb_mod_name(method->me->klass));
197
- rb_ary_push(arr, Qnil); /* TODO */
214
+ rb_ary_push(arr, rb_mod_name(method->me->klass)); /* [0] */
215
+ rb_ary_push(arr, Qnil); /* TODO */ /* [1] */
198
216
  #elif RUBY_VERSION_CODE >= 192
199
- rb_ary_push(arr, rb_mod_name(method->me.klass));
200
- rb_ary_push(arr, Qnil); /* TODO */
217
+ rb_ary_push(arr, rb_mod_name(method->me.klass)); /* [0] */
218
+ rb_ary_push(arr, Qnil); /* TODO */ /* [1] */
201
219
  #else
202
- rb_ary_push(arr, rb_mod_name(METHOD_OCLASS(method)));
203
- rb_ary_push(arr, rb_mod_name(METHOD_RCLASS(method)));
220
+ rb_ary_push(arr, rb_mod_name(METHOD_OCLASS(method))); /* [2] */
221
+ rb_ary_push(arr, rb_mod_name(METHOD_RCLASS(method))); /* [3] */
204
222
  #endif
205
223
  if(rb_class_of(self) == rb_cUnboundMethod)
206
224
  {
207
- rb_ary_push(arr, Qnil);
225
+ rb_ary_push(arr, Qnil); /* [4] */
208
226
  }
209
227
  else
210
228
  {
211
- rb_ary_push(arr, method->recv);
229
+ rb_ary_push(arr, method->recv); /* [4] */
212
230
  }
213
231
  rb_ary_push(arr, ID2SYM(method->id));
214
- #if RUBY_VERSION_CODE >= 193
215
- rb_ary_push(arr, ID2SYM(method->me->def->original_id));
216
- #elif RUBY_VERSION_CODE >= 192
217
- rb_ary_push(arr, ID2SYM(method->me.def->original_id));
232
+ #if RUBY_VERSION_CODE >= 192
233
+ rb_ary_push(arr, ID2SYM(METHOD_DEF(method)->original_id)); /* [5] */
218
234
  #else
219
- rb_ary_push(arr, ID2SYM(method->oid));
235
+ rb_ary_push(arr, ID2SYM(method->oid)); /* [5] */
220
236
  #endif
221
- rb_ary_push(arr, method_body(self));
237
+ rb_ary_push(arr, method_body(self)); /* [6] */
222
238
 
223
239
  return marshal_dump(arr, limit);
224
240
  }
@@ -232,6 +248,7 @@ static VALUE method_dump(VALUE self, VALUE limit)
232
248
  static VALUE method_load(VALUE klass, VALUE str)
233
249
  {
234
250
  struct METHOD * method;
251
+
235
252
  VALUE rarr = marshal_load(str);
236
253
  VALUE * arr;
237
254
  VALUE retval;
@@ -253,17 +270,16 @@ static VALUE method_load(VALUE klass, VALUE str)
253
270
  retval = rb_funcall(
254
271
  rb_cObject, rb_intern("method"), 1, ID2SYM(rb_intern("__id__")));
255
272
  UNWRAP_METHOD(retval, method);
273
+
256
274
  arr = RARRAY_PTR(rarr);
257
- #if RUBY_VERSION_CODE >= 193
258
- method->me->klass =
259
- rb_funcall(lookup_module_proc, rb_intern("call"), 1, arr[0]);
260
- method->me->def->original_id = SYM2ID(arr[4]);
261
- GetISeqPtr(arr[5], method->me->def->body.iseq);
262
- #elif RUBY_VERSION_CODE >= 192
263
- method->me.klass =
275
+ #if RUBY_VERSION_CODE >= 192
276
+ METHOD_KLASS(method) =
264
277
  rb_funcall(lookup_module_proc, rb_intern("call"), 1, arr[0]);
265
- method->me.def->original_id = SYM2ID(arr[4]);
266
- GetISeqPtr(arr[5], method->me.def->body.iseq);
278
+ METHOD_DEF(method) = xmalloc(sizeof(*METHOD_DEF(method)));
279
+ METHOD_DEF(method)->type = VM_METHOD_TYPE_ISEQ;
280
+ METHOD_DEF(method)->original_id = SYM2ID(arr[4]);
281
+ METHOD_DEF(method)->alias_count = 0;
282
+ GetISeqPtr(arr[5], METHOD_DEF(method)->body.iseq);
267
283
  #else
268
284
  METHOD_OCLASS(method) =
269
285
  rb_funcall(lookup_module_proc, rb_intern("call"), 1, arr[0]);
@@ -321,5 +337,9 @@ void Init_method(void)
321
337
 
322
338
  lookup_module_proc = rb_eval_string(lookup_module_str);
323
339
  rb_global_variable(&lookup_module_proc);
340
+
341
+ #ifdef HAVE_TYPE_STRUCT_RTYPEDDATA
342
+ init_method_data_type();
343
+ #endif
324
344
  }
325
345
 
@@ -1,38 +1,43 @@
1
1
  #include "classpath.h"
2
2
 
3
3
  VALUE
4
- class2path(VALUE klass)
4
+ class2path(klass)
5
+ VALUE klass;
5
6
  {
6
7
  VALUE path = rb_class_path(klass);
7
- const char *n;
8
+ char *n = RSTRING(path)->ptr;
8
9
 
9
- n = must_not_be_anonymous((TYPE(klass) == T_CLASS ? "class" : "module"), path);
10
- if (rb_path_to_class(path) != rb_class_real(klass)) {
11
- rb_raise(rb_eTypeError, "%s can't be referred to", n);
10
+ if (n[0] == '#') {
11
+ rb_raise(rb_eTypeError, "can't dump anonymous %s %s",
12
+ (TYPE(klass) == T_CLASS ? "class" : "module"),
13
+ n);
14
+ }
15
+ if (rb_path2class(n) != rb_class_real(klass)) {
16
+ rb_raise(rb_eTypeError, "%s can't be referred", n);
12
17
  }
13
18
  return path;
14
19
  }
15
20
 
16
21
  VALUE
17
- path2class(VALUE path)
22
+ path2class(path)
23
+ const char *path;
18
24
  {
19
- VALUE v = rb_path_to_class(path);
25
+ VALUE v = rb_path2class(path);
20
26
 
21
27
  if (TYPE(v) != T_CLASS) {
22
- rb_raise(rb_eArgError, "%.*s does not refer to class",
23
- (int)RSTRING_LEN(path), RSTRING_PTR(path));
28
+ rb_raise(rb_eArgError, "%s does not refer class", path);
24
29
  }
25
30
  return v;
26
31
  }
27
32
 
28
33
  VALUE
29
- path2module(VALUE path)
34
+ path2module(path)
35
+ const char *path;
30
36
  {
31
- VALUE v = rb_path_to_class(path);
37
+ VALUE v = rb_path2class(path);
32
38
 
33
39
  if (TYPE(v) != T_MODULE) {
34
- rb_raise(rb_eArgError, "%.*s does not refer to module",
35
- (int)RSTRING_LEN(path), RSTRING_PTR(path));
40
+ rb_raise(rb_eArgError, "%s does not refer module", path);
36
41
  }
37
42
  return v;
38
43
  }
@@ -4,13 +4,13 @@
4
4
  #include "ruby.h"
5
5
 
6
6
  VALUE class2path(
7
-
7
+ VALUE klass
8
8
  );
9
9
  VALUE path2class(
10
-
10
+ const char *path
11
11
  );
12
12
  VALUE path2module(
13
-
13
+ const char *path
14
14
  );
15
15
 
16
16
  #endif
@@ -1,10 +1,11 @@
1
1
  $: << '../..'
2
2
  require 'mkmf-ruby-internal'
3
3
 
4
- have_func('vm_get_ruby_level_cfp', [ 'cfp.h', 'vm_core.h' ])
5
- have_func('rb_vm_get_ruby_level_next_cfp', [ 'cfp.h', 'vm_core.h' ])
6
4
  have_header('ruby/node.h') or have_header('node.h')
5
+ have_header('internal.h')
7
6
  have_struct_member('struct RClass', 'iv_index_tbl')
7
+ have_type('struct RTypedData')
8
+ have_func('rb_add_method')
8
9
 
9
10
  ruby_version_code = RUBY_VERSION.gsub(/\./, '').to_i
10
11
  $CPPFLAGS << " -DRUBY_VERSION_CODE=#{ruby_version_code}"
@@ -0,0 +1,13 @@
1
+ #ifndef getcfp__h
2
+ #define getcfp__h
3
+
4
+ #include "ruby.h"
5
+
6
+ #ifdef RUBY_VM
7
+
8
+ #include "vm_core.h"
9
+
10
+
11
+ #endif
12
+
13
+ #endif
@@ -0,0 +1,44 @@
1
+ #ifndef getcfp__h
2
+ #define getcfp__h
3
+
4
+ #include "ruby.h"
5
+
6
+ #ifdef RUBY_VM
7
+
8
+ #include "vm_core.h"
9
+
10
+ #ruby <<END
11
+ $: << '../..'
12
+ require 'ruby_source_dir'
13
+
14
+ vm_c_location = "#{RUBY_SOURCE_DIR}/vm.c"
15
+ if File.exists?(vm_c_location) then
16
+ File.open(vm_c_location) do |vm_c|
17
+ write = false
18
+ stopwrite = false
19
+ prev_line = nil
20
+ while (line = vm_c.gets) != nil do
21
+ case line
22
+ when /^(rb_vm_get_ruby_level_next_cfp|vm_get_ruby_level_cfp)/
23
+ puts "static #{prev_line}"
24
+ line.gsub!($1, 'getcfp')
25
+ write = true
26
+ stopwrite = false
27
+ when /^\}/
28
+ stopwrite = true if write
29
+ end
30
+ puts line if write
31
+ if stopwrite then
32
+ stopwrite = false
33
+ write = false
34
+ puts ''
35
+ end
36
+ prev_line = line
37
+ end
38
+ end
39
+ end
40
+ END
41
+
42
+ #endif
43
+
44
+ #endif
@@ -5,12 +5,16 @@
5
5
  #include <ruby/st.h>
6
6
  #include "vm_core.h"
7
7
  #include "eval_intern.h"
8
- #include "cfp.h"
8
+ #include "getcfp.h"
9
9
  #else
10
10
  #include <rubysig.h>
11
11
  #include <st.h>
12
12
  #endif
13
13
 
14
+ #ifdef HAVE_INTERNAL_H
15
+ #include "internal.h"
16
+ #endif
17
+
14
18
  #ifndef RCLASS_SUPER
15
19
  #define RCLASS_SUPER(c) RCLASS(c)->super
16
20
  #endif
@@ -35,6 +39,22 @@
35
39
  #define RARRAY_PTR(a) RARRAY(a)->ptr
36
40
  #endif
37
41
 
42
+ #ifdef HAVE_TYPE_STRUCT_RTYPEDDATA
43
+
44
+ # undef GetThreadPtr
45
+ # define GetThreadPtr(obj, ptr) \
46
+ TypedData_Get_Struct((obj), rb_thread_t, p_ruby_threadptr_data_type, (ptr))
47
+
48
+ static rb_data_type_t const * p_ruby_threadptr_data_type;
49
+
50
+ static void init_ruby_threadptr_data_type()
51
+ {
52
+ VALUE thread = rb_thread_current();
53
+ p_ruby_threadptr_data_type = RTYPEDDATA_TYPE(thread);
54
+ }
55
+
56
+ #endif
57
+
38
58
  static VALUE rb_cNode;
39
59
 
40
60
  static VALUE rb_mMarshal;
@@ -145,7 +165,7 @@ static VALUE class_restorer_dump(VALUE ruby_class_restorer, VALUE limit)
145
165
 
146
166
  /*
147
167
  * call-seq:
148
- * Nodewrap::ClassRestorer.load => ClassRestorer
168
+ * Internal::ClassRestorer.load => ClassRestorer
149
169
  *
150
170
  * Do not call this function.
151
171
  */
@@ -170,7 +190,7 @@ static VALUE ruby180_marshal_dump(int argc, VALUE * argv, VALUE klass)
170
190
  set_class_restore_state(argv[0]);
171
191
  }
172
192
 
173
- VALUE str = rb_funcall2(klass, rb_intern("_Nodewrap__orig_dump"), argc, argv);
193
+ VALUE str = rb_funcall2(klass, rb_intern("_Internal__orig_dump"), argc, argv);
174
194
 
175
195
  if(class_restorer != Qnil)
176
196
  {
@@ -342,14 +362,12 @@ static VALUE module_name_proc = Qnil;
342
362
 
343
363
  static void set_cref_stack(rb_iseq_t * iseqdat, VALUE klass, VALUE noex)
344
364
  {
345
- rb_thread_t * th = GET_THREAD();
346
- #if defined(HAVE_RB_VM_GET_RUBY_LEVEL_NEXT_CFP)
347
- rb_control_frame_t * cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
348
- #elif defined(HAVE_VM_GET_RUBY_LEVEL_CFP)
349
- rb_control_frame_t * cfp = vm_get_ruby_level_cfp(th, th->cfp);
350
- #else
351
- #error No function to get cfp
352
- #endif
365
+ VALUE thread = rb_thread_current();
366
+ rb_thread_t * th;
367
+ rb_control_frame_t * cfp;
368
+
369
+ GetThreadPtr(thread, th);
370
+ cfp = getcfp(th, th->cfp);
353
371
  iseqdat->cref_stack = NEW_BLOCK(klass);
354
372
  iseqdat->cref_stack->nd_visi = noex;
355
373
  iseqdat->cref_stack->nd_next = cfp->iseq->cref_stack; /* TODO: use lfp? */
@@ -396,13 +414,27 @@ static VALUE module_add_method(VALUE klass, VALUE id, VALUE node, VALUE noex)
396
414
  }
397
415
 
398
416
  #if RUBY_VERSION_CODE >= 192
399
- rb_raise(rb_eRuntimeError, "NOT SUPPORTED");
417
+ if(rb_obj_is_kind_of(node, rb_cISeq))
418
+ {
419
+ rb_iseq_t *iseqdat = iseq_check(node);
420
+ set_cref_stack(iseqdat, klass, noex);
421
+ iseqdat->klass = klass;
422
+ iseqdat->defined_method_id = SYM2ID(id);
423
+
424
+ #ifdef HAVE_RB_ADD_METHOD
425
+ rb_add_method(klass, SYM2ID(id), VM_METHOD_TYPE_ISEQ, iseqdat, NUM2INT(noex));
426
+ #else
427
+ rb_funcall(rb_mRubyVMFrozenCore, rb_intern("core#define_method"), 3, klass, id, node); /* TODO: noex */
428
+ #endif
429
+
430
+ return Qnil;
431
+ }
432
+
400
433
  #elif RUBY_VERSION_CODE >= 190
401
434
  if(rb_obj_is_kind_of(node, rb_cISeq))
402
435
  {
403
436
  rb_iseq_t *iseqdat = iseq_check(node);
404
- /* TODO: any restrictions on what kinds of iseqs we can add here?
405
- */
437
+ /* TODO: any restrictions on what kinds of iseqs we can add here? */
406
438
  set_cref_stack(iseqdat, klass, noex);
407
439
  iseqdat->klass = klass;
408
440
  iseqdat->defined_method_id = SYM2ID(id);
@@ -422,7 +454,7 @@ static VALUE module_add_method(VALUE klass, VALUE id, VALUE node, VALUE noex)
422
454
  Data_Get_Struct(node, NODE, n);
423
455
 
424
456
  #if RUBY_VERSION_CODE >= 192
425
- rb_raise(rb_eRuntimeError, "NOT SUPPORTED");
457
+ rb_raise(rb_eRuntimeError, "Unable to add node on this version of ruby");
426
458
  #elif RUBY_VERSION_CODE >= 190
427
459
  if(nd_type(n) != NODE_METHOD)
428
460
  {
@@ -441,10 +473,11 @@ static VALUE module_add_method(VALUE klass, VALUE id, VALUE node, VALUE noex)
441
473
  }
442
474
 
443
475
  add_node:
476
+
444
477
  #endif
445
478
 
446
479
  #if RUBY_VERSION_CODE >= 192
447
- rb_raise(rb_eRuntimeError, "NOT SUPPORTED");
480
+ rb_raise(rb_eRuntimeError, "Unable to add node on this version of ruby");
448
481
  #else
449
482
  /* TODO: if noex is NOEX_MODFUNC, add this method as a module function
450
483
  * (that is, both as an instance and singleton method)
@@ -477,7 +510,7 @@ static VALUE module_uninclude(int argc, VALUE * argv, VALUE module)
477
510
  * call-seq:
478
511
  * remove_features(mod) => mod
479
512
  *
480
- * When this module is unincluded from another, Nodewrap calls
513
+ * When this module is unincluded from another, Ruby Internal calls
481
514
  * remove_features in this module. The default behavior is to remove
482
515
  * the constants, methods, and module variables of this module from
483
516
  * _mod_. If this module has not been included by _mod_, an exception
@@ -653,7 +686,7 @@ static int add_method_iter(VALUE name, VALUE value, VALUE module)
653
686
  Data_Get_Struct(value, NODE, n);
654
687
  #if RUBY_VERSION_CODE >= 192
655
688
  rb_raise(rb_eRuntimeError, "NOT SUPPORTED");
656
- #elif RUBY_VERSION_CODE >= 190
689
+ #else
657
690
  rb_add_method(module, SYM2ID(name), n->nd_body, n->nd_noex);
658
691
  #endif
659
692
  return ST_CONTINUE;
@@ -795,19 +828,23 @@ void Init_module(void)
795
828
 
796
829
  #if RUBY_VERSION_CODE >= 180
797
830
  {
798
- VALUE rb_mNodewrap = rb_define_module("Nodewrap");
799
- rb_cClass_Restorer = rb_define_class_under(rb_mNodewrap, "ClassRestorer", rb_cObject);
831
+ VALUE rb_mInternal = rb_define_module("Internal");
832
+ rb_cClass_Restorer = rb_define_class_under(rb_mInternal, "ClassRestorer", rb_cObject);
800
833
  rb_define_method(rb_cClass_Restorer, "_dump", class_restorer_dump, 1);
801
834
  rb_define_singleton_method(rb_cClass_Restorer, "_load", class_restorer_load, 1);
802
835
  }
803
836
  #endif
804
837
 
805
838
  #if RUBY_VERSION_CODE == 180
806
- rb_alias(CLASS_OF(rb_mMarshal), rb_intern("_Nodewrap__orig_dump"), rb_intern("dump"));
839
+ rb_alias(CLASS_OF(rb_mMarshal), rb_intern("_Internal__orig_dump"), rb_intern("dump"));
807
840
  rb_define_singleton_method(rb_mMarshal, "dump", ruby180_marshal_dump, -1);
808
841
  #endif
809
842
 
810
843
  rb_define_method(rb_cModule, "_dump", module_dump, 1);
811
844
  rb_define_singleton_method(rb_cModule, "_load", module_load, 1);
845
+
846
+ #ifdef HAVE_TYPE_STRUCT_RTYPEDDATA
847
+ init_ruby_threadptr_data_type();
848
+ #endif
812
849
  }
813
850