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
@@ -0,0 +1,426 @@
1
+ #ifndef ruby_internal_iseq_load__inc_
2
+ #define ruby_internal_iseq_load__inc_
3
+
4
+ #ifdef HAVE_TYPE_STRUCT_RTYPEDDATA
5
+
6
+ static rb_data_type_t const * p_iseq_data_type;
7
+
8
+ static void init_iseq_data_type()
9
+ {
10
+ rb_proc_t * p;
11
+ VALUE body;
12
+
13
+ VALUE binding = rb_binding_new();
14
+ VALUE new_proc = rb_funcall(
15
+ rb_cObject, rb_intern("eval"), 2, rb_str_new2("proc { }"), binding);
16
+ GetProcPtr(new_proc, p);
17
+ body = p->block.iseq->self;
18
+
19
+ p_iseq_data_type = RTYPEDDATA_TYPE(body);
20
+ }
21
+
22
+ #else
23
+
24
+ #endif
25
+ #
26
+ static void
27
+ compile_data_free(struct iseq_compile_data *compile_data)
28
+ {
29
+ if (compile_data) {
30
+ struct iseq_compile_data_storage *cur, *next;
31
+ cur = compile_data->storage_head;
32
+ while (cur) {
33
+ next = cur->next;
34
+ ruby_xfree(cur);
35
+ cur = next;
36
+ }
37
+ ruby_xfree(compile_data);
38
+ }
39
+ }
40
+ static void
41
+ iseq_free(void *ptr)
42
+ {
43
+ rb_iseq_t *iseq;
44
+ RUBY_FREE_ENTER("iseq");
45
+
46
+ if (ptr) {
47
+ iseq = ptr;
48
+ if (!iseq->orig) {
49
+ /* It's possible that strings are freed */
50
+ if (0) {
51
+ RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->name),
52
+ RSTRING_PTR(iseq->filename));
53
+ }
54
+
55
+ if (iseq->iseq != iseq->iseq_encoded) {
56
+ RUBY_FREE_UNLESS_NULL(iseq->iseq_encoded);
57
+ }
58
+
59
+ RUBY_FREE_UNLESS_NULL(iseq->iseq);
60
+ RUBY_FREE_UNLESS_NULL(iseq->insn_info_table);
61
+ RUBY_FREE_UNLESS_NULL(iseq->local_table);
62
+ RUBY_FREE_UNLESS_NULL(iseq->ic_entries);
63
+ RUBY_FREE_UNLESS_NULL(iseq->catch_table);
64
+ RUBY_FREE_UNLESS_NULL(iseq->arg_opt_table);
65
+ compile_data_free(iseq->compile_data);
66
+ }
67
+ ruby_xfree(ptr);
68
+ }
69
+ RUBY_FREE_LEAVE("iseq");
70
+ }
71
+ static void
72
+ iseq_mark(void *ptr)
73
+ {
74
+ RUBY_MARK_ENTER("iseq");
75
+
76
+ if (ptr) {
77
+ rb_iseq_t *iseq = ptr;
78
+
79
+ RUBY_GC_INFO("%s @ %s\n", RSTRING_PTR(iseq->name), RSTRING_PTR(iseq->filename));
80
+ RUBY_MARK_UNLESS_NULL(iseq->mark_ary);
81
+ RUBY_MARK_UNLESS_NULL(iseq->name);
82
+ RUBY_MARK_UNLESS_NULL(iseq->filename);
83
+ RUBY_MARK_UNLESS_NULL(iseq->filepath);
84
+ RUBY_MARK_UNLESS_NULL((VALUE)iseq->cref_stack);
85
+ RUBY_MARK_UNLESS_NULL(iseq->klass);
86
+ RUBY_MARK_UNLESS_NULL(iseq->coverage);
87
+ #if 0
88
+ RUBY_MARK_UNLESS_NULL((VALUE)iseq->node);
89
+ RUBY_MARK_UNLESS_NULL(iseq->cached_special_block);
90
+ #endif
91
+ RUBY_MARK_UNLESS_NULL(iseq->orig);
92
+
93
+ if (iseq->compile_data != 0) {
94
+ struct iseq_compile_data *const compile_data = iseq->compile_data;
95
+ RUBY_MARK_UNLESS_NULL(compile_data->mark_ary);
96
+ RUBY_MARK_UNLESS_NULL(compile_data->err_info);
97
+ RUBY_MARK_UNLESS_NULL(compile_data->catch_table_ary);
98
+ }
99
+ }
100
+ RUBY_MARK_LEAVE("iseq");
101
+ }
102
+ static size_t
103
+ iseq_memsize(const void *ptr)
104
+ {
105
+ size_t size = sizeof(rb_iseq_t);
106
+ const rb_iseq_t *iseq;
107
+
108
+ if (ptr) {
109
+ iseq = ptr;
110
+ if (!iseq->orig) {
111
+ if (iseq->iseq != iseq->iseq_encoded) {
112
+ size += iseq->iseq_size * sizeof(VALUE);
113
+ }
114
+
115
+ size += iseq->iseq_size * sizeof(VALUE);
116
+ size += iseq->insn_info_size * sizeof(struct iseq_insn_info_entry);
117
+ size += iseq->local_table_size * sizeof(ID);
118
+ size += iseq->catch_table_size * sizeof(struct iseq_catch_table_entry);
119
+ size += iseq->arg_opts * sizeof(VALUE);
120
+ size += iseq->ic_size * sizeof(struct iseq_inline_cache_entry);
121
+
122
+ if (iseq->compile_data) {
123
+ struct iseq_compile_data_storage *cur;
124
+
125
+ cur = iseq->compile_data->storage_head;
126
+ while (cur) {
127
+ size += cur->size + sizeof(struct iseq_compile_data_storage);
128
+ cur = cur->next;
129
+ }
130
+ size += sizeof(struct iseq_compile_data);
131
+ }
132
+ }
133
+ }
134
+
135
+ return size;
136
+ }
137
+ static VALUE
138
+ iseq_alloc(VALUE klass)
139
+ {
140
+ rb_iseq_t *iseq;
141
+ return TypedData_Make_Struct(klass, rb_iseq_t, p_iseq_data_type, iseq);
142
+ }
143
+ static void
144
+ set_relation(rb_iseq_t *iseq, const VALUE parent)
145
+ {
146
+ const VALUE type = iseq->type;
147
+ rb_thread_t *th = GET_THREAD();
148
+
149
+ /* set class nest stack */
150
+ if (type == ISEQ_TYPE_TOP) {
151
+ /* toplevel is private */
152
+ iseq->cref_stack = NEW_BLOCK(rb_cObject);
153
+ iseq->cref_stack->nd_file = 0;
154
+ iseq->cref_stack->nd_visi = NOEX_PRIVATE;
155
+ if (th->top_wrapper) {
156
+ NODE *cref = NEW_BLOCK(th->top_wrapper);
157
+ cref->nd_file = 0;
158
+ cref->nd_visi = NOEX_PRIVATE;
159
+ cref->nd_next = iseq->cref_stack;
160
+ iseq->cref_stack = cref;
161
+ }
162
+ }
163
+ else if (type == ISEQ_TYPE_METHOD || type == ISEQ_TYPE_CLASS) {
164
+ iseq->cref_stack = NEW_BLOCK(0); /* place holder */
165
+ iseq->cref_stack->nd_file = 0;
166
+ }
167
+ else if (RTEST(parent)) {
168
+ rb_iseq_t *piseq;
169
+ GetISeqPtr(parent, piseq);
170
+ iseq->cref_stack = piseq->cref_stack;
171
+ }
172
+
173
+ if (type == ISEQ_TYPE_TOP ||
174
+ type == ISEQ_TYPE_METHOD || type == ISEQ_TYPE_CLASS) {
175
+ iseq->local_iseq = iseq;
176
+ }
177
+ else if (RTEST(parent)) {
178
+ rb_iseq_t *piseq;
179
+ GetISeqPtr(parent, piseq);
180
+ iseq->local_iseq = piseq->local_iseq;
181
+ }
182
+
183
+ if (RTEST(parent)) {
184
+ rb_iseq_t *piseq;
185
+ GetISeqPtr(parent, piseq);
186
+ iseq->parent_iseq = piseq;
187
+ }
188
+ }
189
+ static VALUE
190
+ prepare_iseq_build(rb_iseq_t *iseq,
191
+ VALUE name, VALUE filename, VALUE filepath, VALUE line_no,
192
+ VALUE parent, VALUE type, VALUE block_opt,
193
+ const rb_compile_option_t *option)
194
+ {
195
+ OBJ_FREEZE(name);
196
+ OBJ_FREEZE(filename);
197
+
198
+ iseq->name = name;
199
+ iseq->filename = filename;
200
+ iseq->filepath = filepath == Qnil ? Qnil : rb_realpath_internal(Qnil, filepath, 1);
201
+ iseq->line_no = line_no;
202
+ iseq->defined_method_id = 0;
203
+ iseq->mark_ary = rb_ary_tmp_new(3);
204
+ OBJ_UNTRUST(iseq->mark_ary);
205
+ RBASIC(iseq->mark_ary)->klass = 0;
206
+
207
+ iseq->type = type;
208
+ iseq->arg_rest = -1;
209
+ iseq->arg_block = -1;
210
+ iseq->klass = 0;
211
+
212
+ /*
213
+ * iseq->special_block_builder = GC_GUARDED_PTR_REF(block_opt);
214
+ * iseq->cached_special_block_builder = 0;
215
+ * iseq->cached_special_block = 0;
216
+ */
217
+
218
+ iseq->compile_data = ALLOC(struct iseq_compile_data);
219
+ MEMZERO(iseq->compile_data, struct iseq_compile_data, 1);
220
+ iseq->compile_data->mark_ary = rb_ary_tmp_new(3);
221
+
222
+ iseq->compile_data->storage_head = iseq->compile_data->storage_current =
223
+ (struct iseq_compile_data_storage *)
224
+ ALLOC_N(char, INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE +
225
+ sizeof(struct iseq_compile_data_storage));
226
+
227
+ iseq->compile_data->catch_table_ary = rb_ary_new();
228
+ iseq->compile_data->storage_head->pos = 0;
229
+ iseq->compile_data->storage_head->next = 0;
230
+ iseq->compile_data->storage_head->size =
231
+ INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE;
232
+ iseq->compile_data->storage_head->buff =
233
+ (char *)(&iseq->compile_data->storage_head->buff + 1);
234
+ iseq->compile_data->option = option;
235
+ iseq->compile_data->last_coverable_line = -1;
236
+
237
+ set_relation(iseq, parent);
238
+
239
+ iseq->coverage = Qfalse;
240
+ if (!GET_THREAD()->parse_in_eval) {
241
+ extern VALUE rb_get_coverages(void);
242
+ VALUE coverages = rb_get_coverages();
243
+ if (RTEST(coverages)) {
244
+ iseq->coverage = rb_hash_lookup(coverages, filename);
245
+ if (NIL_P(iseq->coverage)) iseq->coverage = Qfalse;
246
+ }
247
+ }
248
+
249
+ return Qtrue;
250
+ }
251
+ static VALUE
252
+ cleanup_iseq_build(rb_iseq_t *iseq)
253
+ {
254
+ struct iseq_compile_data *data = iseq->compile_data;
255
+ VALUE err = data->err_info;
256
+ iseq->compile_data = 0;
257
+ compile_data_free(data);
258
+
259
+ if (RTEST(err)) {
260
+ rb_funcall2(err, rb_intern("set_backtrace"), 1, &iseq->filename);
261
+ rb_exc_raise(err);
262
+ }
263
+ return Qtrue;
264
+ }
265
+ static rb_compile_option_t COMPILE_OPTION_DEFAULT = {
266
+ OPT_INLINE_CONST_CACHE, /* int inline_const_cache; */
267
+ OPT_PEEPHOLE_OPTIMIZATION, /* int peephole_optimization; */
268
+ OPT_TAILCALL_OPTIMIZATION, /* int tailcall_optimization */
269
+ OPT_SPECIALISED_INSTRUCTION, /* int specialized_instruction; */
270
+ OPT_OPERANDS_UNIFICATION, /* int operands_unification; */
271
+ OPT_INSTRUCTIONS_UNIFICATION, /* int instructions_unification; */
272
+ OPT_STACK_CACHING, /* int stack_caching; */
273
+ OPT_TRACE_INSTRUCTION, /* int trace_instruction */
274
+ };
275
+ static const rb_compile_option_t COMPILE_OPTION_FALSE = {0};
276
+ static void
277
+ make_compile_option(rb_compile_option_t *option, VALUE opt)
278
+ {
279
+ if (opt == Qnil) {
280
+ *option = COMPILE_OPTION_DEFAULT;
281
+ }
282
+ else if (opt == Qfalse) {
283
+ *option = COMPILE_OPTION_FALSE;
284
+ }
285
+ else if (opt == Qtrue) {
286
+ memset(option, 1, sizeof(rb_compile_option_t));
287
+ }
288
+ else if (CLASS_OF(opt) == rb_cHash) {
289
+ *option = COMPILE_OPTION_DEFAULT;
290
+
291
+ #define SET_COMPILE_OPTION(o, h, mem) \
292
+ { VALUE flag = rb_hash_aref(h, ID2SYM(rb_intern(#mem))); \
293
+ if (flag == Qtrue) { o->mem = 1; } \
294
+ else if (flag == Qfalse) { o->mem = 0; } \
295
+ }
296
+ #define SET_COMPILE_OPTION_NUM(o, h, mem) \
297
+ { VALUE num = rb_hash_aref(opt, ID2SYM(rb_intern(#mem))); \
298
+ if (!NIL_P(num)) o->mem = NUM2INT(num); \
299
+ }
300
+ SET_COMPILE_OPTION(option, opt, inline_const_cache);
301
+ SET_COMPILE_OPTION(option, opt, peephole_optimization);
302
+ SET_COMPILE_OPTION(option, opt, tailcall_optimization);
303
+ SET_COMPILE_OPTION(option, opt, specialized_instruction);
304
+ SET_COMPILE_OPTION(option, opt, operands_unification);
305
+ SET_COMPILE_OPTION(option, opt, instructions_unification);
306
+ SET_COMPILE_OPTION(option, opt, stack_caching);
307
+ SET_COMPILE_OPTION(option, opt, trace_instruction);
308
+ SET_COMPILE_OPTION_NUM(option, opt, debug_level);
309
+ #undef SET_COMPILE_OPTION
310
+ #undef SET_COMPILE_OPTION_NUM
311
+ }
312
+ else {
313
+ rb_raise(rb_eTypeError, "Compile option must be Hash/true/false/nil");
314
+ }
315
+ }
316
+ static VALUE
317
+ make_compile_option_value(rb_compile_option_t *option)
318
+ {
319
+ VALUE opt = rb_hash_new();
320
+ #define SET_COMPILE_OPTION(o, h, mem) \
321
+ rb_hash_aset(h, ID2SYM(rb_intern(#mem)), o->mem ? Qtrue : Qfalse)
322
+ #define SET_COMPILE_OPTION_NUM(o, h, mem) \
323
+ rb_hash_aset(h, ID2SYM(rb_intern(#mem)), INT2NUM(o->mem))
324
+ {
325
+ SET_COMPILE_OPTION(option, opt, inline_const_cache);
326
+ SET_COMPILE_OPTION(option, opt, peephole_optimization);
327
+ SET_COMPILE_OPTION(option, opt, tailcall_optimization);
328
+ SET_COMPILE_OPTION(option, opt, specialized_instruction);
329
+ SET_COMPILE_OPTION(option, opt, operands_unification);
330
+ SET_COMPILE_OPTION(option, opt, instructions_unification);
331
+ SET_COMPILE_OPTION(option, opt, stack_caching);
332
+ SET_COMPILE_OPTION_NUM(option, opt, debug_level);
333
+ }
334
+ #undef SET_COMPILE_OPTION
335
+ #undef SET_COMPILE_OPTION_NUM
336
+ return opt;
337
+ }
338
+ #define CHECK_ARRAY(v) rb_convert_type(v, T_ARRAY, "Array", "to_ary")
339
+ #define CHECK_STRING(v) rb_convert_type(v, T_STRING, "String", "to_str")
340
+ #define CHECK_SYMBOL(v) rb_convert_type(v, T_SYMBOL, "Symbol", "to_sym")
341
+ static inline VALUE CHECK_INTEGER(VALUE v) {NUM2LONG(v); return v;}
342
+ static VALUE
343
+ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
344
+ {
345
+ VALUE iseqval = iseq_alloc(self);
346
+
347
+ VALUE magic, version1, version2, format_type, misc;
348
+ VALUE name, filename, filepath, line_no;
349
+ VALUE type, body, locals, args, exception;
350
+
351
+ VALUE iseq_type;
352
+ struct st_table *type_map = 0;
353
+ rb_iseq_t *iseq;
354
+ rb_compile_option_t option;
355
+ int i = 0;
356
+
357
+ /* [magic, major_version, minor_version, format_type, misc,
358
+ * name, filename, line_no,
359
+ * type, locals, args, exception_table, body]
360
+ */
361
+
362
+ data = CHECK_ARRAY(data);
363
+
364
+ magic = CHECK_STRING(rb_ary_entry(data, i++));
365
+ version1 = CHECK_INTEGER(rb_ary_entry(data, i++));
366
+ version2 = CHECK_INTEGER(rb_ary_entry(data, i++));
367
+ format_type = CHECK_INTEGER(rb_ary_entry(data, i++));
368
+ misc = rb_ary_entry(data, i++); /* TODO */
369
+
370
+ name = CHECK_STRING(rb_ary_entry(data, i++));
371
+ filename = CHECK_STRING(rb_ary_entry(data, i++));
372
+ filepath = rb_ary_entry(data, i++);
373
+ filepath = NIL_P(filepath) ? Qnil : CHECK_STRING(filepath);
374
+ line_no = CHECK_INTEGER(rb_ary_entry(data, i++));
375
+
376
+ type = CHECK_SYMBOL(rb_ary_entry(data, i++));
377
+ locals = CHECK_ARRAY(rb_ary_entry(data, i++));
378
+
379
+ args = rb_ary_entry(data, i++);
380
+ if (FIXNUM_P(args) || (args = CHECK_ARRAY(args))) {
381
+ /* */
382
+ }
383
+
384
+ exception = CHECK_ARRAY(rb_ary_entry(data, i++));
385
+ body = CHECK_ARRAY(rb_ary_entry(data, i++));
386
+
387
+ GetISeqPtr(iseqval, iseq);
388
+ iseq->self = iseqval;
389
+
390
+ if (type_map == 0) {
391
+ type_map = st_init_numtable();
392
+ st_insert(type_map, ID2SYM(rb_intern("top")), ISEQ_TYPE_TOP);
393
+ st_insert(type_map, ID2SYM(rb_intern("method")), ISEQ_TYPE_METHOD);
394
+ st_insert(type_map, ID2SYM(rb_intern("block")), ISEQ_TYPE_BLOCK);
395
+ st_insert(type_map, ID2SYM(rb_intern("class")), ISEQ_TYPE_CLASS);
396
+ st_insert(type_map, ID2SYM(rb_intern("rescue")), ISEQ_TYPE_RESCUE);
397
+ st_insert(type_map, ID2SYM(rb_intern("ensure")), ISEQ_TYPE_ENSURE);
398
+ st_insert(type_map, ID2SYM(rb_intern("eval")), ISEQ_TYPE_EVAL);
399
+ st_insert(type_map, ID2SYM(rb_intern("main")), ISEQ_TYPE_MAIN);
400
+ st_insert(type_map, ID2SYM(rb_intern("defined_guard")), ISEQ_TYPE_DEFINED_GUARD);
401
+ }
402
+
403
+ if (st_lookup(type_map, type, &iseq_type) == 0) {
404
+ const char *typename = rb_id2name(type);
405
+ if (typename)
406
+ rb_raise(rb_eTypeError, "unsupport type: :%s", typename);
407
+ else
408
+ rb_raise(rb_eTypeError, "unsupport type: %p", (void *)type);
409
+ }
410
+
411
+ if (parent == Qnil) {
412
+ parent = 0;
413
+ }
414
+
415
+ make_compile_option(&option, opt);
416
+ prepare_iseq_build(iseq, name, filename, filepath, line_no,
417
+ parent, iseq_type, 0, &option);
418
+
419
+ rb_iseq_build_from_ary(iseq, locals, args, exception, body);
420
+
421
+ cleanup_iseq_build(iseq);
422
+ return iseqval;
423
+ }
424
+
425
+ #endif
426
+
@@ -2,7 +2,7 @@
2
2
 
3
3
  debug.h - YARV Debug function interface
4
4
 
5
- $Author: ko1 $
5
+ $Author: akr $
6
6
  created at: 04/08/25 02:33:49 JST
7
7
 
8
8
  Copyright (C) 2004-2007 Koichi Sasada
@@ -2,7 +2,7 @@
2
2
 
3
3
  dln.h -
4
4
 
5
- $Author: nobu $
5
+ $Author: akr $
6
6
  created at: Wed Jan 19 16:53:09 JST 1994
7
7
 
8
8
  Copyright (C) 1993-2007 Yukihiro Matsumoto
@@ -30,8 +30,8 @@
30
30
 
31
31
  DEPRECATED(char *dln_find_exe(const char*,const char*));
32
32
  DEPRECATED(char *dln_find_file(const char*,const char*));
33
- char *dln_find_exe_r(const char*,const char*,char*,int);
34
- char *dln_find_file_r(const char*,const char*,char*,int);
33
+ char *dln_find_exe_r(const char*,const char*,char*,size_t);
34
+ char *dln_find_file_r(const char*,const char*,char*,size_t);
35
35
 
36
36
  #ifdef USE_DLN_A_OUT
37
37
  extern char *dln_argv0;