ruby-internal 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (310) hide show
  1. data/COPYING +59 -0
  2. data/LGPL +515 -0
  3. data/LICENSE +9 -0
  4. data/README +31 -0
  5. data/Rakefile +20 -0
  6. data/TODO +9 -0
  7. data/example/README +5 -0
  8. data/example/simple_client.rb +12 -0
  9. data/example/simple_server.rb +11 -0
  10. data/example/triangle_client.rb +7 -0
  11. data/example/triangle_server.rb +24 -0
  12. data/ext/cached/ruby-1.8.0/internal/binding/block.h +37 -0
  13. data/ext/cached/ruby-1.8.0/internal/method/method.h +19 -0
  14. data/ext/cached/ruby-1.8.0/internal/module/classpath.c +27 -0
  15. data/ext/cached/ruby-1.8.0/internal/module/classpath.h +14 -0
  16. data/ext/cached/ruby-1.8.0/internal/node/block.h +37 -0
  17. data/ext/cached/ruby-1.8.0/internal/node/global_entry.h +10 -0
  18. data/ext/cached/ruby-1.8.0/internal/node/node_type_descrip.c +155 -0
  19. data/ext/cached/ruby-1.8.0/internal/node/nodeinfo.c +5741 -0
  20. data/ext/cached/ruby-1.8.0/internal/node/nodeinfo.h +69 -0
  21. data/ext/cached/ruby-1.8.0/internal/proc/block.h +37 -0
  22. data/ext/cached/ruby-1.8.0/internal/tag/tag.h +15 -0
  23. data/ext/cached/ruby-1.8.0/internal/vm/instruction/insns_info.c +39 -0
  24. data/ext/cached/ruby-1.8.0/internal/vm/instruction/insns_info.h +21 -0
  25. data/ext/cached/ruby-1.8.0/internal/vm/iseq/insns_info.inc +12 -0
  26. data/ext/cached/ruby-1.8.1/internal/binding/block.h +31 -0
  27. data/ext/cached/ruby-1.8.1/internal/method/method.h +19 -0
  28. data/ext/cached/ruby-1.8.1/internal/module/classpath.c +27 -0
  29. data/ext/cached/ruby-1.8.1/internal/module/classpath.h +14 -0
  30. data/ext/cached/ruby-1.8.1/internal/node/block.h +31 -0
  31. data/ext/cached/ruby-1.8.1/internal/node/global_entry.h +10 -0
  32. data/ext/cached/ruby-1.8.1/internal/node/node_type_descrip.c +154 -0
  33. data/ext/cached/ruby-1.8.1/internal/node/nodeinfo.c +5733 -0
  34. data/ext/cached/ruby-1.8.1/internal/node/nodeinfo.h +69 -0
  35. data/ext/cached/ruby-1.8.1/internal/proc/block.h +31 -0
  36. data/ext/cached/ruby-1.8.1/internal/tag/tag.h +16 -0
  37. data/ext/cached/ruby-1.8.1/internal/vm/instruction/insns_info.c +39 -0
  38. data/ext/cached/ruby-1.8.1/internal/vm/instruction/insns_info.h +21 -0
  39. data/ext/cached/ruby-1.8.1/internal/vm/iseq/insns_info.inc +12 -0
  40. data/ext/cached/ruby-1.8.2/internal/binding/block.h +32 -0
  41. data/ext/cached/ruby-1.8.2/internal/method/method.h +19 -0
  42. data/ext/cached/ruby-1.8.2/internal/module/classpath.c +45 -0
  43. data/ext/cached/ruby-1.8.2/internal/module/classpath.h +17 -0
  44. data/ext/cached/ruby-1.8.2/internal/node/block.h +32 -0
  45. data/ext/cached/ruby-1.8.2/internal/node/global_entry.h +10 -0
  46. data/ext/cached/ruby-1.8.2/internal/node/node_type_descrip.c +154 -0
  47. data/ext/cached/ruby-1.8.2/internal/node/nodeinfo.c +5733 -0
  48. data/ext/cached/ruby-1.8.2/internal/node/nodeinfo.h +69 -0
  49. data/ext/cached/ruby-1.8.2/internal/proc/block.h +32 -0
  50. data/ext/cached/ruby-1.8.2/internal/tag/tag.h +16 -0
  51. data/ext/cached/ruby-1.8.2/internal/vm/instruction/insns_info.c +39 -0
  52. data/ext/cached/ruby-1.8.2/internal/vm/instruction/insns_info.h +21 -0
  53. data/ext/cached/ruby-1.8.2/internal/vm/iseq/insns_info.inc +12 -0
  54. data/ext/cached/ruby-1.8.3/internal/binding/block.h +32 -0
  55. data/ext/cached/ruby-1.8.3/internal/method/method.h +20 -0
  56. data/ext/cached/ruby-1.8.3/internal/module/classpath.c +45 -0
  57. data/ext/cached/ruby-1.8.3/internal/module/classpath.h +17 -0
  58. data/ext/cached/ruby-1.8.3/internal/node/block.h +32 -0
  59. data/ext/cached/ruby-1.8.3/internal/node/global_entry.h +10 -0
  60. data/ext/cached/ruby-1.8.3/internal/node/node_type_descrip.c +154 -0
  61. data/ext/cached/ruby-1.8.3/internal/node/nodeinfo.c +5733 -0
  62. data/ext/cached/ruby-1.8.3/internal/node/nodeinfo.h +69 -0
  63. data/ext/cached/ruby-1.8.3/internal/proc/block.h +32 -0
  64. data/ext/cached/ruby-1.8.3/internal/tag/tag.h +16 -0
  65. data/ext/cached/ruby-1.8.3/internal/vm/instruction/insns_info.c +39 -0
  66. data/ext/cached/ruby-1.8.3/internal/vm/instruction/insns_info.h +21 -0
  67. data/ext/cached/ruby-1.8.3/internal/vm/iseq/insns_info.inc +12 -0
  68. data/ext/cached/ruby-1.8.4/internal/binding/block.h +32 -0
  69. data/ext/cached/ruby-1.8.4/internal/method/method.h +20 -0
  70. data/ext/cached/ruby-1.8.4/internal/module/classpath.c +45 -0
  71. data/ext/cached/ruby-1.8.4/internal/module/classpath.h +17 -0
  72. data/ext/cached/ruby-1.8.4/internal/node/block.h +32 -0
  73. data/ext/cached/ruby-1.8.4/internal/node/global_entry.h +10 -0
  74. data/ext/cached/ruby-1.8.4/internal/node/node_type_descrip.c +154 -0
  75. data/ext/cached/ruby-1.8.4/internal/node/nodeinfo.c +5733 -0
  76. data/ext/cached/ruby-1.8.4/internal/node/nodeinfo.h +69 -0
  77. data/ext/cached/ruby-1.8.4/internal/proc/block.h +32 -0
  78. data/ext/cached/ruby-1.8.4/internal/tag/tag.h +16 -0
  79. data/ext/cached/ruby-1.8.4/internal/vm/instruction/insns_info.c +39 -0
  80. data/ext/cached/ruby-1.8.4/internal/vm/instruction/insns_info.h +21 -0
  81. data/ext/cached/ruby-1.8.4/internal/vm/iseq/insns_info.inc +12 -0
  82. data/ext/cached/ruby-1.8.5/internal/binding/block.h +32 -0
  83. data/ext/cached/ruby-1.8.5/internal/method/method.h +20 -0
  84. data/ext/cached/ruby-1.8.5/internal/module/classpath.c +45 -0
  85. data/ext/cached/ruby-1.8.5/internal/module/classpath.h +17 -0
  86. data/ext/cached/ruby-1.8.5/internal/node/block.h +32 -0
  87. data/ext/cached/ruby-1.8.5/internal/node/global_entry.h +10 -0
  88. data/ext/cached/ruby-1.8.5/internal/node/node_type_descrip.c +154 -0
  89. data/ext/cached/ruby-1.8.5/internal/node/nodeinfo.c +5732 -0
  90. data/ext/cached/ruby-1.8.5/internal/node/nodeinfo.h +67 -0
  91. data/ext/cached/ruby-1.8.5/internal/proc/block.h +32 -0
  92. data/ext/cached/ruby-1.8.5/internal/tag/tag.h +16 -0
  93. data/ext/cached/ruby-1.8.5/internal/vm/instruction/insns_info.c +39 -0
  94. data/ext/cached/ruby-1.8.5/internal/vm/instruction/insns_info.h +21 -0
  95. data/ext/cached/ruby-1.8.5/internal/vm/iseq/insns_info.inc +12 -0
  96. data/ext/cached/ruby-1.8.6/internal/binding/block.h +32 -0
  97. data/ext/cached/ruby-1.8.6/internal/method/method.h +20 -0
  98. data/ext/cached/ruby-1.8.6/internal/module/classpath.c +45 -0
  99. data/ext/cached/ruby-1.8.6/internal/module/classpath.h +17 -0
  100. data/ext/cached/ruby-1.8.6/internal/node/block.h +32 -0
  101. data/ext/cached/ruby-1.8.6/internal/node/global_entry.h +10 -0
  102. data/ext/cached/ruby-1.8.6/internal/node/node_type_descrip.c +154 -0
  103. data/ext/cached/ruby-1.8.6/internal/node/nodeinfo.c +5732 -0
  104. data/ext/cached/ruby-1.8.6/internal/node/nodeinfo.h +67 -0
  105. data/ext/cached/ruby-1.8.6/internal/proc/block.h +32 -0
  106. data/ext/cached/ruby-1.8.6/internal/tag/tag.h +16 -0
  107. data/ext/cached/ruby-1.8.6/internal/vm/instruction/insns_info.c +39 -0
  108. data/ext/cached/ruby-1.8.6/internal/vm/instruction/insns_info.h +21 -0
  109. data/ext/cached/ruby-1.8.6/internal/vm/iseq/insns_info.inc +12 -0
  110. data/ext/cached/ruby-1.8.7/internal/binding/block.h +32 -0
  111. data/ext/cached/ruby-1.8.7/internal/method/method.h +20 -0
  112. data/ext/cached/ruby-1.8.7/internal/module/classpath.c +45 -0
  113. data/ext/cached/ruby-1.8.7/internal/module/classpath.h +17 -0
  114. data/ext/cached/ruby-1.8.7/internal/node/block.h +32 -0
  115. data/ext/cached/ruby-1.8.7/internal/node/global_entry.h +10 -0
  116. data/ext/cached/ruby-1.8.7/internal/node/node_type_descrip.c +154 -0
  117. data/ext/cached/ruby-1.8.7/internal/node/nodeinfo.c +5732 -0
  118. data/ext/cached/ruby-1.8.7/internal/node/nodeinfo.h +67 -0
  119. data/ext/cached/ruby-1.8.7/internal/proc/block.h +32 -0
  120. data/ext/cached/ruby-1.8.7/internal/tag/tag.h +16 -0
  121. data/ext/cached/ruby-1.8.7/internal/vm/instruction/insns_info.c +39 -0
  122. data/ext/cached/ruby-1.8.7/internal/vm/instruction/insns_info.h +21 -0
  123. data/ext/cached/ruby-1.8.7/internal/vm/iseq/insns_info.inc +12 -0
  124. data/ext/cached/ruby-1.9.0/internal/binding/block.h +12 -0
  125. data/ext/cached/ruby-1.9.0/internal/method/method.h +20 -0
  126. data/ext/cached/ruby-1.9.0/internal/module/classpath.c +42 -0
  127. data/ext/cached/ruby-1.9.0/internal/module/classpath.h +17 -0
  128. data/ext/cached/ruby-1.9.0/internal/node/block.h +12 -0
  129. data/ext/cached/ruby-1.9.0/internal/node/global_entry.h +10 -0
  130. data/ext/cached/ruby-1.9.0/internal/node/node_type_descrip.c +149 -0
  131. data/ext/cached/ruby-1.9.0/internal/node/nodeinfo.c +5579 -0
  132. data/ext/cached/ruby-1.9.0/internal/node/nodeinfo.h +70 -0
  133. data/ext/cached/ruby-1.9.0/internal/proc/block.h +12 -0
  134. data/ext/cached/ruby-1.9.0/internal/tag/tag.h +6 -0
  135. data/ext/cached/ruby-1.9.0/internal/vm/instruction/insns_info.c +5936 -0
  136. data/ext/cached/ruby-1.9.0/internal/vm/instruction/insns_info.h +891 -0
  137. data/ext/cached/ruby-1.9.0/internal/vm/iseq/insns_info.inc +700 -0
  138. data/ext/cached/ruby-1.9.0/internal/yarv-headers/debug.h +36 -0
  139. data/ext/cached/ruby-1.9.0/internal/yarv-headers/dln.h +41 -0
  140. data/ext/cached/ruby-1.9.0/internal/yarv-headers/encdb.h +147 -0
  141. data/ext/cached/ruby-1.9.0/internal/yarv-headers/eval_intern.h +221 -0
  142. data/ext/cached/ruby-1.9.0/internal/yarv-headers/gc.h +75 -0
  143. data/ext/cached/ruby-1.9.0/internal/yarv-headers/id.h +83 -0
  144. data/ext/cached/ruby-1.9.0/internal/yarv-headers/iseq.h +94 -0
  145. data/ext/cached/ruby-1.9.0/internal/yarv-headers/node.h +516 -0
  146. data/ext/cached/ruby-1.9.0/internal/yarv-headers/parse.h +303 -0
  147. data/ext/cached/ruby-1.9.0/internal/yarv-headers/regenc.h +207 -0
  148. data/ext/cached/ruby-1.9.0/internal/yarv-headers/regint.h +842 -0
  149. data/ext/cached/ruby-1.9.0/internal/yarv-headers/regparse.h +351 -0
  150. data/ext/cached/ruby-1.9.0/internal/yarv-headers/revision.h +1 -0
  151. data/ext/cached/ruby-1.9.0/internal/yarv-headers/thread_pthread.h +24 -0
  152. data/ext/cached/ruby-1.9.0/internal/yarv-headers/thread_win32.h +33 -0
  153. data/ext/cached/ruby-1.9.0/internal/yarv-headers/transcode_data.h +99 -0
  154. data/ext/cached/ruby-1.9.0/internal/yarv-headers/transdb.h +67 -0
  155. data/ext/cached/ruby-1.9.0/internal/yarv-headers/version.h +57 -0
  156. data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_core.h +663 -0
  157. data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_exec.h +187 -0
  158. data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_insnhelper.h +191 -0
  159. data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_opts.h +51 -0
  160. data/ext/cached/ruby-1.9.1/internal/binding/block.h +12 -0
  161. data/ext/cached/ruby-1.9.1/internal/method/method.h +20 -0
  162. data/ext/cached/ruby-1.9.1/internal/module/classpath.c +42 -0
  163. data/ext/cached/ruby-1.9.1/internal/module/classpath.h +17 -0
  164. data/ext/cached/ruby-1.9.1/internal/node/block.h +12 -0
  165. data/ext/cached/ruby-1.9.1/internal/node/global_entry.h +10 -0
  166. data/ext/cached/ruby-1.9.1/internal/node/node_type_descrip.c +149 -0
  167. data/ext/cached/ruby-1.9.1/internal/node/nodeinfo.c +5579 -0
  168. data/ext/cached/ruby-1.9.1/internal/node/nodeinfo.h +70 -0
  169. data/ext/cached/ruby-1.9.1/internal/proc/block.h +12 -0
  170. data/ext/cached/ruby-1.9.1/internal/tag/tag.h +6 -0
  171. data/ext/cached/ruby-1.9.1/internal/vm/instruction/insns_info.c +5936 -0
  172. data/ext/cached/ruby-1.9.1/internal/vm/instruction/insns_info.h +891 -0
  173. data/ext/cached/ruby-1.9.1/internal/vm/iseq/insns_info.inc +700 -0
  174. data/ext/cached/ruby-1.9.1/internal/yarv-headers/debug.h +36 -0
  175. data/ext/cached/ruby-1.9.1/internal/yarv-headers/dln.h +41 -0
  176. data/ext/cached/ruby-1.9.1/internal/yarv-headers/encdb.h +147 -0
  177. data/ext/cached/ruby-1.9.1/internal/yarv-headers/eval_intern.h +209 -0
  178. data/ext/cached/ruby-1.9.1/internal/yarv-headers/gc.h +75 -0
  179. data/ext/cached/ruby-1.9.1/internal/yarv-headers/id.h +184 -0
  180. data/ext/cached/ruby-1.9.1/internal/yarv-headers/iseq.h +94 -0
  181. data/ext/cached/ruby-1.9.1/internal/yarv-headers/node.h +516 -0
  182. data/ext/cached/ruby-1.9.1/internal/yarv-headers/parse.h +303 -0
  183. data/ext/cached/ruby-1.9.1/internal/yarv-headers/regenc.h +207 -0
  184. data/ext/cached/ruby-1.9.1/internal/yarv-headers/regint.h +842 -0
  185. data/ext/cached/ruby-1.9.1/internal/yarv-headers/regparse.h +351 -0
  186. data/ext/cached/ruby-1.9.1/internal/yarv-headers/revision.h +1 -0
  187. data/ext/cached/ruby-1.9.1/internal/yarv-headers/thread_pthread.h +24 -0
  188. data/ext/cached/ruby-1.9.1/internal/yarv-headers/thread_win32.h +33 -0
  189. data/ext/cached/ruby-1.9.1/internal/yarv-headers/transcode_data.h +99 -0
  190. data/ext/cached/ruby-1.9.1/internal/yarv-headers/transdb.h +85 -0
  191. data/ext/cached/ruby-1.9.1/internal/yarv-headers/version.h +60 -0
  192. data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_core.h +655 -0
  193. data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_exec.h +187 -0
  194. data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_insnhelper.h +194 -0
  195. data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_opts.h +51 -0
  196. data/ext/internal/binding/binding.c +45 -0
  197. data/ext/internal/binding/block.h.rpp +44 -0
  198. data/ext/internal/binding/extconf.rb +6 -0
  199. data/ext/internal/method/extconf.rb +8 -0
  200. data/ext/internal/method/method.c +269 -0
  201. data/ext/internal/method/method.h.rpp +58 -0
  202. data/ext/internal/module/classpath.c.rpp +29 -0
  203. data/ext/internal/module/classpath.h.rpp +36 -0
  204. data/ext/internal/module/extconf.rb +11 -0
  205. data/ext/internal/module/module.c +797 -0
  206. data/ext/internal/module/module.h +7 -0
  207. data/ext/internal/node/block.h.rpp +44 -0
  208. data/ext/internal/node/builtins.h +41 -0
  209. data/ext/internal/node/extconf.rb +66 -0
  210. data/ext/internal/node/global_entry.h.rpp +26 -0
  211. data/ext/internal/node/node.c +1147 -0
  212. data/ext/internal/node/node_type_descrip.c.rpp +72 -0
  213. data/ext/internal/node/node_type_descrip.h +17 -0
  214. data/ext/internal/node/node_type_descrip.rb +39 -0
  215. data/ext/internal/node/nodeinfo.c.rpp +587 -0
  216. data/ext/internal/node/nodeinfo.h.rpp +30 -0
  217. data/ext/internal/node/nodes.rb +78 -0
  218. data/ext/internal/node/read_node_h.rb +34 -0
  219. data/ext/internal/node/ruby_internal_node.h +31 -0
  220. data/ext/internal/noex/extconf.rb +6 -0
  221. data/ext/internal/noex/noex.c +44 -0
  222. data/ext/internal/object/extconf.rb +4 -0
  223. data/ext/internal/object/object.c +75 -0
  224. data/ext/internal/proc/block.h.rpp +44 -0
  225. data/ext/internal/proc/extconf.rb +9 -0
  226. data/ext/internal/proc/proc.c +331 -0
  227. data/ext/internal/tag/extconf.rb +3 -0
  228. data/ext/internal/tag/tag.c +17 -0
  229. data/ext/internal/tag/tag.h.rpp +22 -0
  230. data/ext/internal/thread/extconf.rb +3 -0
  231. data/ext/internal/thread/thread.c +107 -0
  232. data/ext/internal/vm/constants/constants.c +33 -0
  233. data/ext/internal/vm/constants/extconf.rb +3 -0
  234. data/ext/internal/vm/control_frame/control_frame.c +185 -0
  235. data/ext/internal/vm/control_frame/control_frame.h +18 -0
  236. data/ext/internal/vm/control_frame/extconf.rb +3 -0
  237. data/ext/internal/vm/extconf.rb +3 -0
  238. data/ext/internal/vm/inline_cache/extconf.rb +6 -0
  239. data/ext/internal/vm/inline_cache/inline_cache.c +79 -0
  240. data/ext/internal/vm/instruction/extconf.rb +6 -0
  241. data/ext/internal/vm/instruction/insns_info.c.rpp +213 -0
  242. data/ext/internal/vm/instruction/insns_info.h.rpp +53 -0
  243. data/ext/internal/vm/instruction/instruction.c +78 -0
  244. data/ext/internal/vm/instruction/instruction.h +10 -0
  245. data/ext/internal/vm/iseq/extconf.rb +7 -0
  246. data/ext/internal/vm/iseq/insns_info.inc.rpp +30 -0
  247. data/ext/internal/vm/iseq/internal_iseq.h +9 -0
  248. data/ext/internal/vm/iseq/iseq.c +555 -0
  249. data/ext/internal/vm/vm.c +55 -0
  250. data/ext/mkmf-ruby-internal.rb +111 -0
  251. data/ext/ruby_source_dir.rb +24 -0
  252. data/ext/rubypp.rb +97 -0
  253. data/generate_rdoc.rb +33 -0
  254. data/lib/internal/binding.rb +1 -0
  255. data/lib/internal/classtree.rb +55 -0
  256. data/lib/internal/debug.rb +16 -0
  257. data/lib/internal/method.rb +1 -0
  258. data/lib/internal/method/as_code.rb +33 -0
  259. data/lib/internal/method/as_expression.rb +34 -0
  260. data/lib/internal/method/signature.rb +442 -0
  261. data/lib/internal/module.rb +1 -0
  262. data/lib/internal/module/as_code.rb +45 -0
  263. data/lib/internal/node.rb +3 -0
  264. data/lib/internal/node/as_code.rb +233 -0
  265. data/lib/internal/node/as_expression.rb +619 -0
  266. data/lib/internal/node/dump.rb +53 -0
  267. data/lib/internal/node/pp.rb +72 -0
  268. data/lib/internal/node/to_a.rb +52 -0
  269. data/lib/internal/noex.rb +1 -0
  270. data/lib/internal/obfusc.rb +57 -0
  271. data/lib/internal/object.rb +1 -0
  272. data/lib/internal/object/as_code.rb +10 -0
  273. data/lib/internal/proc.rb +1 -0
  274. data/lib/internal/proc/as_code.rb +21 -0
  275. data/lib/internal/proc/as_expression.rb +14 -0
  276. data/lib/internal/proc/signature.rb +184 -0
  277. data/lib/internal/tag.rb +1 -0
  278. data/lib/internal/thread.rb +1 -0
  279. data/lib/internal/vm.rb +1 -0
  280. data/lib/internal/vm/bytedecoder.rb +866 -0
  281. data/lib/internal/vm/constants.rb +1 -0
  282. data/lib/internal/vm/control_frame.rb +1 -0
  283. data/lib/internal/vm/inline_cache.rb +1 -0
  284. data/lib/internal/vm/instruction.rb +1 -0
  285. data/lib/internal/vm/iseq.rb +1 -0
  286. data/lib/internal/vm/iseq/as_code.rb +27 -0
  287. data/lib/internal/vm/iseq/as_expression.rb +26 -0
  288. data/metaconfig +19 -0
  289. data/post-config.rb +1 -0
  290. data/post-install.rb +4 -0
  291. data/post-setup.rb +7 -0
  292. data/pre-config.rb +96 -0
  293. data/pre-install.rb +13 -0
  294. data/pre-setup.rb +8 -0
  295. data/run_tests.rb +26 -0
  296. data/setup.rb +1599 -0
  297. data/test/expression_samples.rb +160 -0
  298. data/test/node_samples.rb +122 -0
  299. data/test/test_as_code.rb +261 -0
  300. data/test/test_as_expression.rb +229 -0
  301. data/test/test_dump_class.rb +187 -0
  302. data/test/test_dump_method.rb +144 -0
  303. data/test/test_dump_proc.rb +118 -0
  304. data/test/test_helpers.rb +61 -0
  305. data/test/test_method.rb +72 -0
  306. data/test/test_methodsig.rb +267 -0
  307. data/test/test_module.rb +49 -0
  308. data/test/test_node.rb +77 -0
  309. data/test/test_proc.rb +47 -0
  310. metadata +377 -0
@@ -0,0 +1,891 @@
1
+ #ifndef insns_info__h_
2
+ #define insns_info__h_
3
+
4
+ #include "ruby.h"
5
+
6
+ #ifdef RUBY_VM
7
+
8
+ #include "vm_core.h"
9
+
10
+ #ifdef HAVE_VM_H
11
+ #include "vm.h"
12
+ #endif
13
+
14
+ /** -*-c-*-
15
+ This file contains YARV instructions list.
16
+
17
+ ----
18
+ This file is auto generated by insns2vm.rb
19
+ DO NOT TOUCH!
20
+
21
+ If you want to fix something, you must edit 'template/insns.inc.tmpl'
22
+ or insns2vm.rb
23
+ */
24
+
25
+
26
+ /* BIN : Basic Instruction Name */
27
+ #define BIN(n) YARVINSN_##n
28
+
29
+ enum ruby_vminsn_type {
30
+ BIN(nop) = 0,
31
+
32
+ BIN(getlocal) = 1,
33
+
34
+ BIN(setlocal) = 2,
35
+
36
+ BIN(getspecial) = 3,
37
+
38
+ BIN(setspecial) = 4,
39
+
40
+ BIN(getdynamic) = 5,
41
+
42
+ BIN(setdynamic) = 6,
43
+
44
+ BIN(getinstancevariable) = 7,
45
+
46
+ BIN(setinstancevariable) = 8,
47
+
48
+ BIN(getclassvariable) = 9,
49
+
50
+ BIN(setclassvariable) = 10,
51
+
52
+ BIN(getconstant) = 11,
53
+
54
+ BIN(setconstant) = 12,
55
+
56
+ BIN(getglobal) = 13,
57
+
58
+ BIN(setglobal) = 14,
59
+
60
+ BIN(putnil) = 15,
61
+
62
+ BIN(putself) = 16,
63
+
64
+ BIN(putobject) = 17,
65
+
66
+ BIN(putspecialobject) = 18,
67
+
68
+ BIN(putiseq) = 19,
69
+
70
+ BIN(putstring) = 20,
71
+
72
+ BIN(concatstrings) = 21,
73
+
74
+ BIN(tostring) = 22,
75
+
76
+ BIN(toregexp) = 23,
77
+
78
+ BIN(newarray) = 24,
79
+
80
+ BIN(duparray) = 25,
81
+
82
+ BIN(expandarray) = 26,
83
+
84
+ BIN(concatarray) = 27,
85
+
86
+ BIN(splatarray) = 28,
87
+
88
+ BIN(checkincludearray) = 29,
89
+
90
+ BIN(newhash) = 30,
91
+
92
+ BIN(newrange) = 31,
93
+
94
+ BIN(pop) = 32,
95
+
96
+ BIN(dup) = 33,
97
+
98
+ BIN(dupn) = 34,
99
+
100
+ BIN(swap) = 35,
101
+
102
+ BIN(reput) = 36,
103
+
104
+ BIN(topn) = 37,
105
+
106
+ BIN(setn) = 38,
107
+
108
+ BIN(adjuststack) = 39,
109
+
110
+ BIN(defined) = 40,
111
+
112
+ BIN(trace) = 41,
113
+
114
+ BIN(defineclass) = 42,
115
+
116
+ BIN(send) = 43,
117
+
118
+ BIN(invokesuper) = 44,
119
+
120
+ BIN(invokeblock) = 45,
121
+
122
+ BIN(leave) = 46,
123
+
124
+ BIN(finish) = 47,
125
+
126
+ BIN(throw) = 48,
127
+
128
+ BIN(jump) = 49,
129
+
130
+ BIN(branchif) = 50,
131
+
132
+ BIN(branchunless) = 51,
133
+
134
+ BIN(getinlinecache) = 52,
135
+
136
+ BIN(onceinlinecache) = 53,
137
+
138
+ BIN(setinlinecache) = 54,
139
+
140
+ BIN(opt_case_dispatch) = 55,
141
+
142
+ BIN(opt_checkenv) = 56,
143
+
144
+ BIN(opt_plus) = 57,
145
+
146
+ BIN(opt_minus) = 58,
147
+
148
+ BIN(opt_mult) = 59,
149
+
150
+ BIN(opt_div) = 60,
151
+
152
+ BIN(opt_mod) = 61,
153
+
154
+ BIN(opt_eq) = 62,
155
+
156
+ BIN(opt_neq) = 63,
157
+
158
+ BIN(opt_lt) = 64,
159
+
160
+ BIN(opt_le) = 65,
161
+
162
+ BIN(opt_gt) = 66,
163
+
164
+ BIN(opt_ge) = 67,
165
+
166
+ BIN(opt_ltlt) = 68,
167
+
168
+ BIN(opt_aref) = 69,
169
+
170
+ BIN(opt_aset) = 70,
171
+
172
+ BIN(opt_length) = 71,
173
+
174
+ BIN(opt_succ) = 72,
175
+
176
+ BIN(opt_not) = 73,
177
+
178
+ BIN(opt_regexpmatch1) = 74,
179
+
180
+ BIN(opt_regexpmatch2) = 75,
181
+
182
+ BIN(opt_call_c_function) = 76,
183
+
184
+ BIN(bitblt) = 77,
185
+
186
+ BIN(answer) = 78,
187
+
188
+ };
189
+
190
+ #define VM_INSTRUCTION_SIZE 79
191
+
192
+ /** -*-c-*-
193
+ This file contains instruction information for yarv instruction sequence.
194
+
195
+ ----
196
+ This file is auto generated by insns2vm.rb
197
+ DO NOT TOUCH!
198
+
199
+ If you want to fix something, you must edit 'template/insns_info.inc.tmpl'
200
+ or insns2vm.rb
201
+ */
202
+
203
+ #define TS_OFFSET 'O'
204
+ #define TS_NUM 'N'
205
+ #define TS_LINDEX 'L'
206
+ #define TS_DINDEX 'D'
207
+ #define TS_VALUE 'V'
208
+ #define TS_ID 'I'
209
+ #define TS_GENTRY 'G'
210
+ #define TS_IC 'C'
211
+ #define TS_CDHASH 'H'
212
+ #define TS_ISEQ 'S'
213
+ #define TS_VARIABLE '.'
214
+ #define TS_FUNCPTR 'F'
215
+
216
+ static const char *const insn_name_info[] = {
217
+ "nop",
218
+ "getlocal",
219
+ "setlocal",
220
+ "getspecial",
221
+ "setspecial",
222
+ "getdynamic",
223
+ "setdynamic",
224
+ "getinstancevariable",
225
+ "setinstancevariable",
226
+ "getclassvariable",
227
+ "setclassvariable",
228
+ "getconstant",
229
+ "setconstant",
230
+ "getglobal",
231
+ "setglobal",
232
+ "putnil",
233
+ "putself",
234
+ "putobject",
235
+ "putspecialobject",
236
+ "putiseq",
237
+ "putstring",
238
+ "concatstrings",
239
+ "tostring",
240
+ "toregexp",
241
+ "newarray",
242
+ "duparray",
243
+ "expandarray",
244
+ "concatarray",
245
+ "splatarray",
246
+ "checkincludearray",
247
+ "newhash",
248
+ "newrange",
249
+ "pop",
250
+ "dup",
251
+ "dupn",
252
+ "swap",
253
+ "reput",
254
+ "topn",
255
+ "setn",
256
+ "adjuststack",
257
+ "defined",
258
+ "trace",
259
+ "defineclass",
260
+ "send",
261
+ "invokesuper",
262
+ "invokeblock",
263
+ "leave",
264
+ "finish",
265
+ "throw",
266
+ "jump",
267
+ "branchif",
268
+ "branchunless",
269
+ "getinlinecache",
270
+ "onceinlinecache",
271
+ "setinlinecache",
272
+ "opt_case_dispatch",
273
+ "opt_checkenv",
274
+ "opt_plus",
275
+ "opt_minus",
276
+ "opt_mult",
277
+ "opt_div",
278
+ "opt_mod",
279
+ "opt_eq",
280
+ "opt_neq",
281
+ "opt_lt",
282
+ "opt_le",
283
+ "opt_gt",
284
+ "opt_ge",
285
+ "opt_ltlt",
286
+ "opt_aref",
287
+ "opt_aset",
288
+ "opt_length",
289
+ "opt_succ",
290
+ "opt_not",
291
+ "opt_regexpmatch1",
292
+ "opt_regexpmatch2",
293
+ "opt_call_c_function",
294
+ "bitblt",
295
+ "answer",
296
+
297
+ };
298
+
299
+ static const char *const insn_operand_info[] = {
300
+ "",
301
+ "L",
302
+ "L",
303
+ "VN",
304
+ "V",
305
+ "DN",
306
+ "DN",
307
+ "I",
308
+ "I",
309
+ "I",
310
+ "I",
311
+ "I",
312
+ "I",
313
+ "G",
314
+ "G",
315
+ "",
316
+ "",
317
+ "V",
318
+ "N",
319
+ "S",
320
+ "V",
321
+ "N",
322
+ "",
323
+ "NN",
324
+ "N",
325
+ "V",
326
+ "NN",
327
+ "",
328
+ "V",
329
+ "V",
330
+ "N",
331
+ "N",
332
+ "",
333
+ "",
334
+ "N",
335
+ "",
336
+ "",
337
+ "N",
338
+ "N",
339
+ "N",
340
+ "NVV",
341
+ "N",
342
+ "ISN",
343
+ "INSNC",
344
+ "NSN",
345
+ "NN",
346
+ "",
347
+ "",
348
+ "N",
349
+ "O",
350
+ "O",
351
+ "O",
352
+ "CO",
353
+ "CO",
354
+ "O",
355
+ "HO",
356
+ "",
357
+ "",
358
+ "",
359
+ "",
360
+ "",
361
+ "",
362
+ "C",
363
+ "CC",
364
+ "",
365
+ "",
366
+ "",
367
+ "",
368
+ "",
369
+ "",
370
+ "",
371
+ "",
372
+ "",
373
+ "C",
374
+ "V",
375
+ "",
376
+ "F",
377
+ "",
378
+ "",
379
+
380
+ };
381
+
382
+ static const int insn_len_info[] = {
383
+ 1,
384
+ 2,
385
+ 2,
386
+ 3,
387
+ 2,
388
+ 3,
389
+ 3,
390
+ 2,
391
+ 2,
392
+ 2,
393
+ 2,
394
+ 2,
395
+ 2,
396
+ 2,
397
+ 2,
398
+ 1,
399
+ 1,
400
+ 2,
401
+ 2,
402
+ 2,
403
+ 2,
404
+ 2,
405
+ 1,
406
+ 3,
407
+ 2,
408
+ 2,
409
+ 3,
410
+ 1,
411
+ 2,
412
+ 2,
413
+ 2,
414
+ 2,
415
+ 1,
416
+ 1,
417
+ 2,
418
+ 1,
419
+ 1,
420
+ 2,
421
+ 2,
422
+ 2,
423
+ 4,
424
+ 2,
425
+ 4,
426
+ 6,
427
+ 4,
428
+ 3,
429
+ 1,
430
+ 1,
431
+ 2,
432
+ 2,
433
+ 2,
434
+ 2,
435
+ 3,
436
+ 3,
437
+ 2,
438
+ 3,
439
+ 1,
440
+ 1,
441
+ 1,
442
+ 1,
443
+ 1,
444
+ 1,
445
+ 2,
446
+ 3,
447
+ 1,
448
+ 1,
449
+ 1,
450
+ 1,
451
+ 1,
452
+ 1,
453
+ 1,
454
+ 1,
455
+ 1,
456
+ 2,
457
+ 2,
458
+ 1,
459
+ 2,
460
+ 1,
461
+ 1,
462
+
463
+ };
464
+
465
+ #ifdef USE_INSN_RET_NUM
466
+ static const int insn_stack_push_num_info[] = {
467
+ 0,
468
+ 1,
469
+ 0,
470
+ 1,
471
+ 0,
472
+ 1,
473
+ 0,
474
+ 1,
475
+ 0,
476
+ 1,
477
+ 0,
478
+ 1,
479
+ 0,
480
+ 1,
481
+ 0,
482
+ 1,
483
+ 1,
484
+ 1,
485
+ 1,
486
+ 1,
487
+ 1,
488
+ 1,
489
+ 1,
490
+ 1,
491
+ 1,
492
+ 1,
493
+ 1,
494
+ 1,
495
+ 1,
496
+ 2,
497
+ 1,
498
+ 1,
499
+ 0,
500
+ 2,
501
+ 1,
502
+ 2,
503
+ 1,
504
+ 1,
505
+ 1,
506
+ 1,
507
+ 1,
508
+ 0,
509
+ 1,
510
+ 1,
511
+ 1,
512
+ 1,
513
+ 1,
514
+ 1,
515
+ 1,
516
+ 0,
517
+ 0,
518
+ 0,
519
+ 1,
520
+ 1,
521
+ 1,
522
+ 0,
523
+ 0,
524
+ 1,
525
+ 1,
526
+ 1,
527
+ 1,
528
+ 1,
529
+ 1,
530
+ 1,
531
+ 1,
532
+ 1,
533
+ 1,
534
+ 1,
535
+ 1,
536
+ 1,
537
+ 1,
538
+ 1,
539
+ 1,
540
+ 1,
541
+ 1,
542
+ 1,
543
+ 0,
544
+ 1,
545
+ 1,
546
+
547
+ };
548
+ #endif
549
+
550
+ #ifdef USE_INSN_STACK_INCREASE
551
+ static int
552
+ insn_stack_increase(int depth, int insn, VALUE *opes)
553
+ {
554
+ switch(insn){
555
+ case BIN(nop):{
556
+ return depth + 0;
557
+ }
558
+ case BIN(getlocal):{
559
+ return depth + 1;
560
+ }
561
+ case BIN(setlocal):{
562
+ return depth + -1;
563
+ }
564
+ case BIN(getspecial):{
565
+ return depth + 1;
566
+ }
567
+ case BIN(setspecial):{
568
+ return depth + -1;
569
+ }
570
+ case BIN(getdynamic):{
571
+ return depth + 1;
572
+ }
573
+ case BIN(setdynamic):{
574
+ return depth + -1;
575
+ }
576
+ case BIN(getinstancevariable):{
577
+ return depth + 1;
578
+ }
579
+ case BIN(setinstancevariable):{
580
+ return depth + -1;
581
+ }
582
+ case BIN(getclassvariable):{
583
+ return depth + 1;
584
+ }
585
+ case BIN(setclassvariable):{
586
+ return depth + -1;
587
+ }
588
+ case BIN(getconstant):{
589
+ return depth + 0;
590
+ }
591
+ case BIN(setconstant):{
592
+ return depth + -2;
593
+ }
594
+ case BIN(getglobal):{
595
+ return depth + 1;
596
+ }
597
+ case BIN(setglobal):{
598
+ return depth + -1;
599
+ }
600
+ case BIN(putnil):{
601
+ return depth + 1;
602
+ }
603
+ case BIN(putself):{
604
+ return depth + 1;
605
+ }
606
+ case BIN(putobject):{
607
+ return depth + 1;
608
+ }
609
+ case BIN(putspecialobject):{
610
+ return depth + 1;
611
+ }
612
+ case BIN(putiseq):{
613
+ return depth + 1;
614
+ }
615
+ case BIN(putstring):{
616
+ return depth + 1;
617
+ }
618
+ case BIN(concatstrings):{
619
+ int inc = 0;
620
+ rb_num_t num = FIX2INT(opes[0]);
621
+ inc += 1 - num;;
622
+ return depth + inc;
623
+ }
624
+ case BIN(tostring):{
625
+ return depth + 0;
626
+ }
627
+ case BIN(toregexp):{
628
+ int inc = 0;
629
+ rb_num_t cnt = FIX2INT(opes[1]);
630
+ inc += 1 - cnt;;
631
+ return depth + inc;
632
+ }
633
+ case BIN(newarray):{
634
+ int inc = 0;
635
+ rb_num_t num = FIX2INT(opes[0]);
636
+ inc += 1 - num;;
637
+ return depth + inc;
638
+ }
639
+ case BIN(duparray):{
640
+ return depth + 1;
641
+ }
642
+ case BIN(expandarray):{
643
+ int inc = 0;
644
+ rb_num_t num = FIX2INT(opes[0]);
645
+ rb_num_t flag = FIX2INT(opes[1]);
646
+ inc += num - 1 + (flag & 1 ? 1 : 0);;
647
+ return depth + inc;
648
+ }
649
+ case BIN(concatarray):{
650
+ return depth + -1;
651
+ }
652
+ case BIN(splatarray):{
653
+ return depth + 0;
654
+ }
655
+ case BIN(checkincludearray):{
656
+ return depth + 0;
657
+ }
658
+ case BIN(newhash):{
659
+ int inc = 0;
660
+ rb_num_t num = FIX2INT(opes[0]);
661
+ inc += 1 - num;;
662
+ return depth + inc;
663
+ }
664
+ case BIN(newrange):{
665
+ return depth + -1;
666
+ }
667
+ case BIN(pop):{
668
+ return depth + -1;
669
+ }
670
+ case BIN(dup):{
671
+ return depth + 1;
672
+ }
673
+ case BIN(dupn):{
674
+ int inc = 0;
675
+ rb_num_t n = FIX2INT(opes[0]);
676
+ inc += n;;
677
+ return depth + inc;
678
+ }
679
+ case BIN(swap):{
680
+ return depth + 0;
681
+ }
682
+ case BIN(reput):{
683
+ int inc = 0;
684
+ inc += 0;;
685
+ return depth + inc;
686
+ }
687
+ case BIN(topn):{
688
+ int inc = 0;
689
+ inc += 1;;
690
+ return depth + inc;
691
+ }
692
+ case BIN(setn):{
693
+ int inc = 0;
694
+ inc += 0;
695
+ return depth + inc;
696
+ }
697
+ case BIN(adjuststack):{
698
+ int inc = 0;
699
+ rb_num_t n = FIX2INT(opes[0]);
700
+ inc -= n;
701
+ return depth + inc;
702
+ }
703
+ case BIN(defined):{
704
+ return depth + 0;
705
+ }
706
+ case BIN(trace):{
707
+ return depth + 0;
708
+ }
709
+ case BIN(defineclass):{
710
+ return depth + -1;
711
+ }
712
+ case BIN(send):{
713
+ int inc = 0;
714
+ rb_num_t op_argc = FIX2INT(opes[1]);
715
+ rb_num_t op_flag = FIX2INT(opes[3]);
716
+ inc += - (op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));;
717
+ return depth + inc;
718
+ }
719
+ case BIN(invokesuper):{
720
+ int inc = 0;
721
+ rb_num_t op_argc = FIX2INT(opes[0]);
722
+ rb_num_t op_flag = FIX2INT(opes[2]);
723
+ inc += - (op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));;
724
+ return depth + inc;
725
+ }
726
+ case BIN(invokeblock):{
727
+ int inc = 0;
728
+ rb_num_t num = FIX2INT(opes[0]);
729
+ inc += 1 - num;;
730
+ return depth + inc;
731
+ }
732
+ case BIN(leave):{
733
+ return depth + 0;
734
+ }
735
+ case BIN(finish):{
736
+ return depth + 0;
737
+ }
738
+ case BIN(throw):{
739
+ return depth + 0;
740
+ }
741
+ case BIN(jump):{
742
+ return depth + 0;
743
+ }
744
+ case BIN(branchif):{
745
+ return depth + -1;
746
+ }
747
+ case BIN(branchunless):{
748
+ return depth + -1;
749
+ }
750
+ case BIN(getinlinecache):{
751
+ return depth + 1;
752
+ }
753
+ case BIN(onceinlinecache):{
754
+ return depth + 1;
755
+ }
756
+ case BIN(setinlinecache):{
757
+ return depth + 0;
758
+ }
759
+ case BIN(opt_case_dispatch):{
760
+ int inc = 0;
761
+ inc += -1;;
762
+ return depth + inc;
763
+ }
764
+ case BIN(opt_checkenv):{
765
+ return depth + 0;
766
+ }
767
+ case BIN(opt_plus):{
768
+ return depth + -1;
769
+ }
770
+ case BIN(opt_minus):{
771
+ return depth + -1;
772
+ }
773
+ case BIN(opt_mult):{
774
+ return depth + -1;
775
+ }
776
+ case BIN(opt_div):{
777
+ return depth + -1;
778
+ }
779
+ case BIN(opt_mod):{
780
+ return depth + -1;
781
+ }
782
+ case BIN(opt_eq):{
783
+ return depth + -1;
784
+ }
785
+ case BIN(opt_neq):{
786
+ return depth + -1;
787
+ }
788
+ case BIN(opt_lt):{
789
+ return depth + -1;
790
+ }
791
+ case BIN(opt_le):{
792
+ return depth + -1;
793
+ }
794
+ case BIN(opt_gt):{
795
+ return depth + -1;
796
+ }
797
+ case BIN(opt_ge):{
798
+ return depth + -1;
799
+ }
800
+ case BIN(opt_ltlt):{
801
+ return depth + -1;
802
+ }
803
+ case BIN(opt_aref):{
804
+ return depth + -1;
805
+ }
806
+ case BIN(opt_aset):{
807
+ return depth + -2;
808
+ }
809
+ case BIN(opt_length):{
810
+ return depth + 0;
811
+ }
812
+ case BIN(opt_succ):{
813
+ return depth + 0;
814
+ }
815
+ case BIN(opt_not):{
816
+ return depth + 0;
817
+ }
818
+ case BIN(opt_regexpmatch1):{
819
+ return depth + 0;
820
+ }
821
+ case BIN(opt_regexpmatch2):{
822
+ return depth + -1;
823
+ }
824
+ case BIN(opt_call_c_function):{
825
+ return depth + 0;
826
+ }
827
+ case BIN(bitblt):{
828
+ return depth + 1;
829
+ }
830
+ case BIN(answer):{
831
+ return depth + 1;
832
+ }
833
+
834
+ default:
835
+ rb_bug("insn_sp_increase: unreachable");
836
+ }
837
+ return 0;
838
+ }
839
+ #endif
840
+
841
+ /* some utilities */
842
+
843
+ static int
844
+ insn_len(int insn)
845
+ {
846
+ return insn_len_info[insn];
847
+ }
848
+
849
+ static const char *
850
+ insn_name(int insn)
851
+ {
852
+ return insn_name_info[insn];
853
+ }
854
+
855
+ static const char *
856
+ insn_op_types(int insn)
857
+ {
858
+ return insn_operand_info[insn];
859
+ }
860
+
861
+ static int
862
+ insn_op_type(int insn, int pos)
863
+ {
864
+ int len = insn_len(insn) - 1;
865
+ if(pos < len){
866
+ return insn_operand_info[insn][pos];
867
+ }
868
+ else{
869
+ return 0;
870
+ }
871
+ }
872
+
873
+ #ifdef USE_INSN_RET_NUM
874
+ static int
875
+ insn_ret_num(int insn)
876
+ {
877
+ return insn_stack_push_num_info[insn];
878
+ }
879
+ #endif
880
+ void
881
+ make_compile_option(rb_compile_option_t *option, VALUE opt);
882
+ void
883
+ make_compile_option_value(rb_compile_option_t *option);
884
+
885
+ extern VALUE instruction_class[VM_INSTRUCTION_SIZE];
886
+ void define_instruction_subclasses(VALUE rb_cInstruction);
887
+
888
+ #endif
889
+
890
+ #endif
891
+