script_core 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (381) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +8 -6
  4. data/.ruby-version +1 -1
  5. data/Gemfile +2 -1
  6. data/bin/sandbox +1 -1
  7. data/ext/enterprise_script_service/Rakefile +1 -1
  8. data/ext/enterprise_script_service/flags.rb +5 -0
  9. data/ext/enterprise_script_service/libseccomp/CHANGELOG +15 -0
  10. data/ext/enterprise_script_service/libseccomp/CREDITS +3 -0
  11. data/ext/enterprise_script_service/libseccomp/Makefile.am +1 -1
  12. data/ext/enterprise_script_service/libseccomp/README.md +1 -1
  13. data/ext/enterprise_script_service/libseccomp/SECURITY.md +45 -0
  14. data/ext/enterprise_script_service/libseccomp/configure.ac +3 -3
  15. data/ext/enterprise_script_service/libseccomp/doc/admin/MAINTAINER_PROCESS.md +95 -0
  16. data/ext/enterprise_script_service/libseccomp/{RELEASE_PROCESS.md → doc/admin/RELEASE_PROCESS.md} +9 -1
  17. data/ext/enterprise_script_service/libseccomp/include/Makefile.am +1 -1
  18. data/ext/enterprise_script_service/libseccomp/include/seccomp-syscalls.h +2292 -0
  19. data/ext/enterprise_script_service/libseccomp/include/seccomp.h.in +3 -1065
  20. data/ext/enterprise_script_service/libseccomp/src/arch-aarch64-syscalls.c +35 -3
  21. data/ext/enterprise_script_service/libseccomp/src/arch-arm-syscalls.c +35 -3
  22. data/ext/enterprise_script_service/libseccomp/src/arch-mips-syscalls.c +43 -11
  23. data/ext/enterprise_script_service/libseccomp/src/arch-mips64-syscalls.c +33 -1
  24. data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32-syscalls.c +33 -1
  25. data/ext/enterprise_script_service/libseccomp/src/arch-parisc-syscalls.c +34 -2
  26. data/ext/enterprise_script_service/libseccomp/src/arch-ppc-syscalls.c +43 -11
  27. data/ext/enterprise_script_service/libseccomp/src/arch-ppc64-syscalls.c +44 -12
  28. data/ext/enterprise_script_service/libseccomp/src/arch-s390-syscalls.c +46 -14
  29. data/ext/enterprise_script_service/libseccomp/src/arch-s390.c +142 -18
  30. data/ext/enterprise_script_service/libseccomp/src/arch-s390x-syscalls.c +47 -15
  31. data/ext/enterprise_script_service/libseccomp/src/arch-s390x.c +143 -17
  32. data/ext/enterprise_script_service/libseccomp/src/arch-x32-syscalls.c +33 -1
  33. data/ext/enterprise_script_service/libseccomp/src/arch-x86-syscalls.c +94 -12
  34. data/ext/enterprise_script_service/libseccomp/src/arch-x86.c +142 -19
  35. data/ext/enterprise_script_service/libseccomp/src/arch-x86_64-syscalls.c +33 -1
  36. data/ext/enterprise_script_service/libseccomp/src/db.c +1 -0
  37. data/ext/enterprise_script_service/libseccomp/src/gen_bpf.c +10 -3
  38. data/ext/enterprise_script_service/libseccomp/src/python/Makefile.am +4 -4
  39. data/ext/enterprise_script_service/libseccomp/src/python/seccomp.pyx +2 -0
  40. data/ext/enterprise_script_service/libseccomp/tests/.gitignore +1 -0
  41. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.c +98 -0
  42. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.py +61 -0
  43. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.tests +18 -0
  44. data/ext/enterprise_script_service/libseccomp/tests/Makefile.am +6 -3
  45. data/ext/enterprise_script_service/libseccomp/tools/Makefile.am +0 -2
  46. data/ext/enterprise_script_service/libseccomp/tools/check-syntax +1 -0
  47. data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_sim.c +2 -0
  48. data/ext/enterprise_script_service/mruby-mpdecimal/src/ext.c +1 -1
  49. data/ext/enterprise_script_service/mruby/.gitignore +2 -2
  50. data/ext/enterprise_script_service/mruby/CONTRIBUTING.md +10 -3
  51. data/ext/enterprise_script_service/mruby/Doxyfile +2408 -0
  52. data/ext/enterprise_script_service/mruby/README.md +21 -8
  53. data/ext/enterprise_script_service/mruby/Rakefile +4 -13
  54. data/ext/enterprise_script_service/mruby/appveyor_config.rb +1 -1
  55. data/ext/enterprise_script_service/mruby/build_config.rb +3 -3
  56. data/ext/enterprise_script_service/mruby/doc/guides/compile.md +42 -42
  57. data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +1 -1
  58. data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +45 -6
  59. data/ext/enterprise_script_service/mruby/doc/guides/mrbgems.md +5 -0
  60. data/ext/enterprise_script_service/mruby/doc/limitations.md +88 -38
  61. data/ext/enterprise_script_service/mruby/doc/mruby_logo_red_icon.png +0 -0
  62. data/ext/enterprise_script_service/mruby/doc/opcode.md +94 -94
  63. data/ext/enterprise_script_service/mruby/include/mrbconf.h +74 -11
  64. data/ext/enterprise_script_service/mruby/include/mruby.h +242 -146
  65. data/ext/enterprise_script_service/mruby/include/mruby/array.h +7 -7
  66. data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +2 -9
  67. data/ext/enterprise_script_service/mruby/include/mruby/boxing_no.h +11 -10
  68. data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +104 -69
  69. data/ext/enterprise_script_service/mruby/include/mruby/class.h +7 -5
  70. data/ext/enterprise_script_service/mruby/include/mruby/common.h +9 -7
  71. data/ext/enterprise_script_service/mruby/include/mruby/compile.h +6 -6
  72. data/ext/enterprise_script_service/mruby/include/mruby/data.h +5 -5
  73. data/ext/enterprise_script_service/mruby/include/mruby/debug.h +2 -2
  74. data/ext/enterprise_script_service/mruby/include/mruby/dump.h +3 -7
  75. data/ext/enterprise_script_service/mruby/include/mruby/error.h +34 -6
  76. data/ext/enterprise_script_service/mruby/include/mruby/gc.h +2 -2
  77. data/ext/enterprise_script_service/mruby/include/mruby/hash.h +4 -11
  78. data/ext/enterprise_script_service/mruby/include/mruby/irep.h +16 -4
  79. data/ext/enterprise_script_service/mruby/include/mruby/istruct.h +4 -4
  80. data/ext/enterprise_script_service/mruby/include/mruby/khash.h +2 -2
  81. data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +41 -7
  82. data/ext/enterprise_script_service/mruby/include/mruby/object.h +8 -9
  83. data/ext/enterprise_script_service/mruby/include/mruby/opcode.h +2 -2
  84. data/ext/enterprise_script_service/mruby/include/mruby/ops.h +6 -6
  85. data/ext/enterprise_script_service/mruby/include/mruby/proc.h +19 -13
  86. data/ext/enterprise_script_service/mruby/include/mruby/range.h +10 -4
  87. data/ext/enterprise_script_service/mruby/include/mruby/re.h +2 -2
  88. data/ext/enterprise_script_service/mruby/include/mruby/string.h +130 -107
  89. data/ext/enterprise_script_service/mruby/include/mruby/throw.h +2 -2
  90. data/ext/enterprise_script_service/mruby/include/mruby/value.h +137 -49
  91. data/ext/enterprise_script_service/mruby/include/mruby/variable.h +3 -5
  92. data/ext/enterprise_script_service/mruby/include/mruby/version.h +24 -10
  93. data/ext/enterprise_script_service/mruby/lib/mruby-core-ext.rb +2 -39
  94. data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +32 -15
  95. data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +63 -17
  96. data/ext/enterprise_script_service/mruby/lib/mruby/build/load_gems.rb +24 -10
  97. data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +11 -7
  98. data/ext/enterprise_script_service/mruby/lib/mruby/lockfile.rb +81 -0
  99. data/ext/enterprise_script_service/mruby/minirake +27 -11
  100. data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +3 -0
  101. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrbgem.rake +0 -1
  102. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +47 -9
  103. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +3 -3
  104. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/test/array.rb +50 -29
  105. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +3 -3
  106. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +2 -2
  107. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c +3 -3
  108. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +2 -2
  109. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +1 -1
  110. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +4 -0
  111. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +28 -1
  112. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +1 -2
  113. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +75 -8
  114. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +134 -90
  115. data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +7 -8
  116. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +69 -46
  117. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/keywords +0 -3
  118. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/lex.def +51 -59
  119. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +430 -241
  120. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrbgem.rake +10 -0
  121. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +122 -0
  122. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +249 -0
  123. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/test/complex.rb +153 -0
  124. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/mrblib/chain.rb +19 -17
  125. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/test/enum_chain.rb +41 -9
  126. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb +30 -4
  127. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/test/enum.rb +8 -3
  128. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrbgem.rake +0 -1
  129. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +46 -14
  130. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +51 -2
  131. data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/src/exception.c +10 -0
  132. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +47 -44
  133. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/test/eval.rb +2 -2
  134. data/ext/enterprise_script_service/mruby/mrbgems/mruby-exit/src/mruby-exit.c +9 -4
  135. data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +16 -12
  136. data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/test/fiber.rb +1 -1
  137. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +0 -2
  138. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb +3 -0
  139. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/test/hash.rb +3 -7
  140. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/README.md +1 -3
  141. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrbgem.rake +1 -1
  142. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file.rb +0 -5
  143. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +24 -38
  144. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/kernel.rb +16 -0
  145. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +19 -18
  146. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +5 -16
  147. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +54 -42
  148. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +24 -20
  149. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file_test.rb +4 -9
  150. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +41 -35
  151. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +9 -36
  152. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrbgem.rake +1 -1
  153. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +9 -27
  154. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/test/kernel.rb +2 -0
  155. data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/src/math.c +5 -2
  156. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +39 -24
  157. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +48 -17
  158. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/method.rb +0 -12
  159. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +134 -101
  160. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/test/method.rb +9 -1
  161. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb +1 -5
  162. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +17 -37
  163. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +0 -8
  164. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrbgem.rake +1 -1
  165. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrblib/object.rb +15 -1
  166. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +35 -6
  167. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/test/nil.rb +4 -0
  168. data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +1 -5
  169. data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +1 -1
  170. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +28 -23
  171. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/test/pack.rb +43 -49
  172. data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/mrblib/print.rb +3 -9
  173. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +6 -9
  174. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/test/proc.rb +21 -5
  175. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.c +157 -124
  176. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/test/random.rb +72 -26
  177. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/mrblib/range.rb +38 -0
  178. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +26 -11
  179. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/test/range.rb +111 -1
  180. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrbgem.rake +5 -0
  181. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +117 -0
  182. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +209 -0
  183. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/test/rational.rb +308 -0
  184. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/README.md +1 -1
  185. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/src/socket.c +10 -9
  186. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/kernel.c +2 -2
  187. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +22 -24
  188. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrbgem.rake +0 -1
  189. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +8 -4
  190. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +116 -117
  191. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/numeric.rb +29 -0
  192. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/range.rb +26 -0
  193. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/string.rb +32 -50
  194. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/mrblib/struct.rb +5 -7
  195. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +43 -57
  196. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/test/struct.rb +16 -11
  197. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +2 -2
  198. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +1 -1
  199. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/driver.c +152 -1
  200. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +4 -3
  201. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/vformat.c +200 -0
  202. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/include/mruby/time.h +2 -1
  203. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +199 -68
  204. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/test/time.rb +81 -46
  205. data/ext/enterprise_script_service/mruby/mrblib/array.rb +14 -16
  206. data/ext/enterprise_script_service/mruby/mrblib/enum.rb +13 -9
  207. data/ext/enterprise_script_service/mruby/mrblib/hash.rb +5 -7
  208. data/ext/enterprise_script_service/mruby/mrblib/kernel.rb +1 -1
  209. data/ext/enterprise_script_service/mruby/mrblib/numeric.rb +4 -4
  210. data/ext/enterprise_script_service/mruby/mrblib/range.rb +1 -1
  211. data/ext/enterprise_script_service/mruby/mrblib/string.rb +55 -112
  212. data/ext/enterprise_script_service/mruby/mruby-source.gemspec +1 -1
  213. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby.dict +105 -0
  214. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_fuzzer.options +5 -0
  215. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_proto_fuzzer.options +4 -0
  216. data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_fuzzer.c +18 -0
  217. data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_proto_fuzzer.cpp +44 -0
  218. data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.cpp +455 -0
  219. data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.h +55 -0
  220. data/ext/enterprise_script_service/mruby/oss-fuzz/ruby.proto +201 -0
  221. data/ext/enterprise_script_service/mruby/src/array.c +95 -46
  222. data/ext/enterprise_script_service/mruby/src/backtrace.c +6 -8
  223. data/ext/enterprise_script_service/mruby/src/class.c +370 -278
  224. data/ext/enterprise_script_service/mruby/src/codedump.c +34 -34
  225. data/ext/enterprise_script_service/mruby/src/debug.c +2 -2
  226. data/ext/enterprise_script_service/mruby/src/dump.c +8 -6
  227. data/ext/enterprise_script_service/mruby/src/enum.c +1 -1
  228. data/ext/enterprise_script_service/mruby/src/error.c +157 -55
  229. data/ext/enterprise_script_service/mruby/src/etc.c +13 -46
  230. data/ext/enterprise_script_service/mruby/src/fmt_fp.c +2 -2
  231. data/ext/enterprise_script_service/mruby/src/gc.c +30 -11
  232. data/ext/enterprise_script_service/mruby/src/hash.c +23 -14
  233. data/ext/enterprise_script_service/mruby/src/kernel.c +16 -54
  234. data/ext/enterprise_script_service/mruby/src/load.c +40 -76
  235. data/ext/enterprise_script_service/mruby/src/numeric.c +164 -94
  236. data/ext/enterprise_script_service/mruby/src/object.c +16 -39
  237. data/ext/enterprise_script_service/mruby/src/pool.c +0 -2
  238. data/ext/enterprise_script_service/mruby/src/proc.c +47 -48
  239. data/ext/enterprise_script_service/mruby/src/range.c +22 -35
  240. data/ext/enterprise_script_service/mruby/src/state.c +5 -94
  241. data/ext/enterprise_script_service/mruby/src/string.c +874 -710
  242. data/ext/enterprise_script_service/mruby/src/symbol.c +73 -48
  243. data/ext/enterprise_script_service/mruby/src/variable.c +58 -38
  244. data/ext/enterprise_script_service/mruby/src/vm.c +133 -304
  245. data/ext/enterprise_script_service/mruby/tasks/doc.rake +48 -0
  246. data/ext/enterprise_script_service/mruby/tasks/toolchains/clang.rake +3 -4
  247. data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +20 -19
  248. data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +0 -12
  249. data/ext/enterprise_script_service/mruby/test/assert.rb +186 -25
  250. data/ext/enterprise_script_service/mruby/test/t/array.rb +34 -6
  251. data/ext/enterprise_script_service/mruby/test/t/class.rb +26 -0
  252. data/ext/enterprise_script_service/mruby/test/t/enumerable.rb +2 -2
  253. data/ext/enterprise_script_service/mruby/test/t/float.rb +17 -17
  254. data/ext/enterprise_script_service/mruby/test/t/hash.rb +2 -0
  255. data/ext/enterprise_script_service/mruby/test/t/integer.rb +14 -6
  256. data/ext/enterprise_script_service/mruby/test/t/kernel.rb +38 -19
  257. data/ext/enterprise_script_service/mruby/test/t/module.rb +87 -14
  258. data/ext/enterprise_script_service/mruby/test/t/numeric.rb +65 -23
  259. data/ext/enterprise_script_service/mruby/test/t/range.rb +4 -4
  260. data/ext/enterprise_script_service/mruby/test/t/string.rb +211 -49
  261. data/ext/enterprise_script_service/mruby/test/t/syntax.rb +19 -2
  262. data/ext/enterprise_script_service/mruby/test/t/vformat.rb +92 -0
  263. data/ext/enterprise_script_service/mruby/travis_config.rb +2 -2
  264. data/ext/enterprise_script_service/mruby_config.rb +10 -0
  265. data/ext/enterprise_script_service/mruby_engine.cpp +2 -2
  266. data/ext/enterprise_script_service/mruby_engine.gembox +1 -0
  267. data/ext/enterprise_script_service/msgpack/CHANGELOG.md +14 -0
  268. data/ext/enterprise_script_service/msgpack/Files.cmake +4 -0
  269. data/ext/enterprise_script_service/msgpack/README.md +1 -1
  270. data/ext/enterprise_script_service/msgpack/appveyor.yml +1 -1
  271. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple.hpp.erb +1 -1
  272. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple_decl.hpp.erb +1 -1
  273. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_zone.hpp.erb +3 -3
  274. data/ext/enterprise_script_service/msgpack/example/boost/asio_send_recv.cpp +1 -1
  275. data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/cpp11/timespec.hpp +16 -0
  276. data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/wstring.hpp +15 -0
  277. data/ext/enterprise_script_service/msgpack/include/msgpack/object.h +2 -0
  278. data/ext/enterprise_script_service/msgpack/include/msgpack/pack_template.h +17 -9
  279. data/ext/enterprise_script_service/msgpack/include/msgpack/sysdep.h +27 -16
  280. data/ext/enterprise_script_service/msgpack/include/msgpack/type.hpp +2 -0
  281. data/ext/enterprise_script_service/msgpack/include/msgpack/unpack_template.h +5 -0
  282. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/array_ref.hpp +0 -1
  283. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/check_container_size.hpp +1 -1
  284. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/chrono.hpp +5 -5
  285. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/timespec.hpp +140 -0
  286. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple.hpp +32 -32
  287. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple_decl.hpp +32 -32
  288. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple.hpp +6 -6
  289. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple_decl.hpp +10 -10
  290. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/ext.hpp +1 -1
  291. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/fixint.hpp +5 -4
  292. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int.hpp +40 -13
  293. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int_decl.hpp +3 -2
  294. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/wstring.hpp +121 -0
  295. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp03_zone.hpp +3 -3
  296. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp11_zone.hpp +3 -3
  297. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object.hpp +6 -6
  298. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object_fwd.hpp +1 -1
  299. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/pack.hpp +40 -5
  300. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/unpack.hpp +11 -11
  301. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/vrefbuffer.hpp +7 -7
  302. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/zbuffer.hpp +5 -5
  303. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/adaptor/int_decl.hpp +1 -1
  304. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/create_object_visitor.hpp +1 -1
  305. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/parse.hpp +13 -13
  306. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/x3_parse.hpp +28 -26
  307. data/ext/enterprise_script_service/msgpack/include/msgpack/v3/adaptor/int_decl.hpp +1 -1
  308. data/ext/enterprise_script_service/msgpack/include/msgpack/v3/parse.hpp +13 -13
  309. data/ext/enterprise_script_service/msgpack/include/msgpack/version_master.h +2 -2
  310. data/ext/enterprise_script_service/msgpack/include/msgpack/zbuffer.h +6 -6
  311. data/ext/enterprise_script_service/msgpack/include/msgpack/zone.h +1 -1
  312. data/ext/enterprise_script_service/msgpack/src/objectc.c +83 -148
  313. data/ext/enterprise_script_service/msgpack/src/unpack.c +73 -47
  314. data/ext/enterprise_script_service/msgpack/test/CMakeLists.txt +1 -1
  315. data/ext/enterprise_script_service/msgpack/test/array_ref.cpp +5 -0
  316. data/ext/enterprise_script_service/msgpack/test/boost_fusion.cpp +5 -0
  317. data/ext/enterprise_script_service/msgpack/test/boost_optional.cpp +7 -0
  318. data/ext/enterprise_script_service/msgpack/test/boost_string_ref.cpp +7 -0
  319. data/ext/enterprise_script_service/msgpack/test/boost_string_view.cpp +6 -0
  320. data/ext/enterprise_script_service/msgpack/test/boost_variant.cpp +15 -9
  321. data/ext/enterprise_script_service/msgpack/test/buffer.cpp +7 -0
  322. data/ext/enterprise_script_service/msgpack/test/carray.cpp +7 -0
  323. data/ext/enterprise_script_service/msgpack/test/cases.cpp +7 -1
  324. data/ext/enterprise_script_service/msgpack/test/convert.cpp +6 -0
  325. data/ext/enterprise_script_service/msgpack/test/fixint.cpp +7 -1
  326. data/ext/enterprise_script_service/msgpack/test/fixint_c.cpp +6 -1
  327. data/ext/enterprise_script_service/msgpack/test/fuzz_unpack_pack_fuzzer_cpp11.cpp +5 -0
  328. data/ext/enterprise_script_service/msgpack/test/iterator_cpp11.cpp +8 -2
  329. data/ext/enterprise_script_service/msgpack/test/json.cpp +6 -0
  330. data/ext/enterprise_script_service/msgpack/test/limit.cpp +7 -0
  331. data/ext/enterprise_script_service/msgpack/test/msgpack_basic.cpp +128 -6
  332. data/ext/enterprise_script_service/msgpack/test/msgpack_c.cpp +7 -2
  333. data/ext/enterprise_script_service/msgpack/test/msgpack_container.cpp +20 -3
  334. data/ext/enterprise_script_service/msgpack/test/msgpack_cpp11.cpp +159 -0
  335. data/ext/enterprise_script_service/msgpack/test/msgpack_cpp17.cpp +5 -0
  336. data/ext/enterprise_script_service/msgpack/test/msgpack_stream.cpp +8 -3
  337. data/ext/enterprise_script_service/msgpack/test/msgpack_tuple.cpp +6 -0
  338. data/ext/enterprise_script_service/msgpack/test/msgpack_vref.cpp +5 -0
  339. data/ext/enterprise_script_service/msgpack/test/msgpack_x3_parse.cpp +23 -18
  340. data/ext/enterprise_script_service/msgpack/test/object.cpp +77 -45
  341. data/ext/enterprise_script_service/msgpack/test/object_with_zone.cpp +28 -10
  342. data/ext/enterprise_script_service/msgpack/test/pack_unpack.cpp +25 -18
  343. data/ext/enterprise_script_service/msgpack/test/pack_unpack_c.cpp +7 -0
  344. data/ext/enterprise_script_service/msgpack/test/raw.cpp +17 -12
  345. data/ext/enterprise_script_service/msgpack/test/reference.cpp +6 -0
  346. data/ext/enterprise_script_service/msgpack/test/reference_cpp11.cpp +6 -0
  347. data/ext/enterprise_script_service/msgpack/test/reference_wrapper_cpp11.cpp +6 -0
  348. data/ext/enterprise_script_service/msgpack/test/shared_ptr_cpp11.cpp +6 -0
  349. data/ext/enterprise_script_service/msgpack/test/size_equal_only.cpp +6 -2
  350. data/ext/enterprise_script_service/msgpack/test/streaming.cpp +10 -3
  351. data/ext/enterprise_script_service/msgpack/test/streaming_c.cpp +7 -0
  352. data/ext/enterprise_script_service/msgpack/test/unique_ptr_cpp11.cpp +6 -0
  353. data/ext/enterprise_script_service/msgpack/test/user_class.cpp +5 -0
  354. data/ext/enterprise_script_service/msgpack/test/version.cpp +6 -0
  355. data/ext/enterprise_script_service/msgpack/test/visitor.cpp +7 -0
  356. data/ext/enterprise_script_service/msgpack/test/zone.cpp +6 -0
  357. data/lib/script_core/version.rb +1 -1
  358. data/lib/tasks/mruby/engine.gembox.example +1 -0
  359. data/lib/tasks/script_core.rake +21 -3
  360. data/spec/dummy/app/helpers/fields_helper.rb +2 -2
  361. data/spec/dummy/mruby/engine.gembox +1 -0
  362. data/spec/script_core_spec.rb +1 -1
  363. metadata +38 -22
  364. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.gitignore +0 -1
  365. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.travis.yml +0 -2
  366. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/run_test.rb +0 -26
  367. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrblib/kernel.rb +0 -15
  368. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/unbound_method.rb +0 -9
  369. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.gitignore +0 -5
  370. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.travis.yml +0 -2
  371. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/packtest.rb +0 -157
  372. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/run_test.rb +0 -26
  373. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.c +0 -224
  374. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.h +0 -80
  375. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.h +0 -12
  376. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.gitignore +0 -4
  377. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis.yml +0 -29
  378. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis_build_config.rb +0 -6
  379. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/Rakefile +0 -29
  380. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/.travis.yml +0 -4
  381. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/run_test.rb +0 -28
@@ -461,7 +461,7 @@ mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc
461
461
  stack_init(mrb);
462
462
  }
463
463
  if (argc < 0) {
464
- mrb_raisef(mrb, E_ARGUMENT_ERROR, "negative argc for funcall (%S)", mrb_fixnum_value(argc));
464
+ mrb_raisef(mrb, E_ARGUMENT_ERROR, "negative argc for funcall (%i)", argc);
465
465
  }
466
466
  c = mrb_class(mrb, self);
467
467
  m = mrb_method_search_vm(mrb, &c, mid);
@@ -486,26 +486,25 @@ mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc
486
486
  ci->argc = (int)argc;
487
487
  ci->target_class = c;
488
488
  mrb->c->stack = mrb->c->stack + n;
489
+ if (argc < 0) argc = 1;
489
490
  if (mrb->c->stbase <= argv && argv < mrb->c->stend) {
490
491
  voff = argv - mrb->c->stbase;
491
492
  }
492
- if (MRB_METHOD_CFUNC_P(m)) {
493
- mrb_stack_extend(mrb, argc + 2);
494
- }
495
- else if (argc >= CALL_MAXARGS) {
493
+ if (argc >= CALL_MAXARGS) {
496
494
  mrb_value args = mrb_ary_new_from_values(mrb, argc, argv);
497
495
 
498
- mrb_stack_extend(mrb, 3);
499
496
  mrb->c->stack[1] = args;
500
497
  ci->argc = -1;
501
498
  argc = 1;
502
499
  }
503
- else {
500
+ mrb_stack_extend(mrb, argc + 2);
501
+ if (MRB_METHOD_PROC_P(m)) {
504
502
  struct RProc *p = MRB_METHOD_PROC(m);
505
503
 
506
504
  ci->proc = p;
507
- if (argc < 0) argc = 1;
508
- mrb_stack_extend(mrb, p->body.irep->nregs + argc);
505
+ if (!MRB_PROC_CFUNC_P(p)) {
506
+ mrb_stack_extend(mrb, p->body.irep->nregs + argc);
507
+ }
509
508
  }
510
509
  if (voff >= 0) {
511
510
  argv = mrb->c->stbase + voff;
@@ -520,9 +519,6 @@ mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc
520
519
  int ai = mrb_gc_arena_save(mrb);
521
520
 
522
521
  ci->acc = CI_ACC_DIRECT;
523
- if (MRB_METHOD_PROC_P(m)) {
524
- ci->proc = MRB_METHOD_PROC(m);
525
- }
526
522
  val = MRB_METHOD_CFUNC(m)(mrb, self);
527
523
  mrb->c->stack = mrb->c->ci->stackent;
528
524
  cipop(mrb);
@@ -820,7 +816,7 @@ mrb_yield_cont(mrb_state *mrb, mrb_value b, mrb_value self, mrb_int argc, const
820
816
  if (mrb_nil_p(b)) {
821
817
  mrb_raise(mrb, E_ARGUMENT_ERROR, "no block given");
822
818
  }
823
- if (mrb_type(b) != MRB_TT_PROC) {
819
+ if (!mrb_proc_p(b)) {
824
820
  mrb_raise(mrb, E_TYPE_ERROR, "not a block");
825
821
  }
826
822
 
@@ -834,39 +830,14 @@ mrb_yield_cont(mrb_state *mrb, mrb_value b, mrb_value self, mrb_int argc, const
834
830
  return mrb_exec_irep(mrb, self, p);
835
831
  }
836
832
 
837
- mrb_value
838
- mrb_mod_s_nesting(mrb_state *mrb, mrb_value mod)
839
- {
840
- struct RProc *proc;
841
- mrb_value ary;
842
- struct RClass *c = NULL;
843
-
844
- mrb_get_args(mrb, "");
845
- ary = mrb_ary_new(mrb);
846
- proc = mrb->c->ci[-1].proc; /* callee proc */
847
- mrb_assert(!MRB_PROC_CFUNC_P(proc));
848
- while (proc) {
849
- if (MRB_PROC_SCOPE_P(proc)) {
850
- struct RClass *c2 = MRB_PROC_TARGET_CLASS(proc);
851
-
852
- if (c2 != c) {
853
- c = c2;
854
- mrb_ary_push(mrb, ary, mrb_obj_value(c));
855
- }
856
- }
857
- proc = proc->upper;
858
- }
859
- return ary;
860
- }
861
-
862
833
  static struct RBreak*
863
834
  break_new(mrb_state *mrb, struct RProc *p, mrb_value val)
864
835
  {
865
836
  struct RBreak *brk;
866
837
 
867
838
  brk = (struct RBreak*)mrb_obj_alloc(mrb, MRB_TT_BREAK, NULL);
868
- brk->proc = p;
869
- brk->val = val;
839
+ mrb_break_proc_set(brk, p);
840
+ mrb_break_value_set(brk, val);
870
841
 
871
842
  return brk;
872
843
  }
@@ -907,13 +878,11 @@ argnum_error(mrb_state *mrb, mrb_int num)
907
878
  }
908
879
  }
909
880
  if (mrb->c->ci->mid) {
910
- str = mrb_format(mrb, "'%S': wrong number of arguments (%S for %S)",
911
- mrb_sym2str(mrb, mrb->c->ci->mid),
912
- mrb_fixnum_value(argc), mrb_fixnum_value(num));
881
+ str = mrb_format(mrb, "'%n': wrong number of arguments (%i for %i)",
882
+ mrb->c->ci->mid, argc, num);
913
883
  }
914
884
  else {
915
- str = mrb_format(mrb, "wrong number of arguments (%S for %S)",
916
- mrb_fixnum_value(argc), mrb_fixnum_value(num));
885
+ str = mrb_format(mrb, "wrong number of arguments (%i for %i)", argc, num);
917
886
  }
918
887
  exc = mrb_exc_new_str(mrb, E_ARGUMENT_ERROR, str);
919
888
  mrb_exc_set(mrb, exc);
@@ -1002,10 +971,10 @@ check_target_class(mrb_state *mrb)
1002
971
  void mrb_hash_check_kdict(mrb_state *mrb, mrb_value self);
1003
972
 
1004
973
  MRB_API mrb_value
1005
- mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
974
+ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, const mrb_code *pc)
1006
975
  {
1007
- /* mrb_assert(mrb_proc_cfunc_p(proc)) */
1008
- mrb_code *pc0 = pc;
976
+ /* mrb_assert(MRB_PROC_CFUNC_P(proc)) */
977
+ const mrb_code *pc0 = pc;
1009
978
  mrb_irep *irep = proc->body.irep;
1010
979
  mrb_value *pool = irep->pool;
1011
980
  mrb_sym *syms = irep->syms;
@@ -1418,7 +1387,7 @@ RETRY_TRY_BLOCK:
1418
1387
 
1419
1388
  recv = regs[a];
1420
1389
  blk = regs[bidx];
1421
- if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
1390
+ if (!mrb_nil_p(blk) && !mrb_proc_p(blk)) {
1422
1391
  blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
1423
1392
  /* The stack might have been reallocated during mrb_convert_type(),
1424
1393
  see #3622 */
@@ -1466,6 +1435,11 @@ RETRY_TRY_BLOCK:
1466
1435
  ci->proc = p;
1467
1436
  recv = p->body.func(mrb, recv);
1468
1437
  }
1438
+ else if (MRB_METHOD_NOARG_P(m) &&
1439
+ (argc > 0 || (argc == -1 && RARRAY_LEN(regs[1]) != 0))) {
1440
+ argnum_error(mrb, 0);
1441
+ goto L_RAISE;
1442
+ }
1469
1443
  else {
1470
1444
  recv = MRB_METHOD_FUNC(m)(mrb, recv);
1471
1445
  }
@@ -1473,7 +1447,7 @@ RETRY_TRY_BLOCK:
1473
1447
  mrb_gc_arena_shrink(mrb, ai);
1474
1448
  if (mrb->exc) goto L_RAISE;
1475
1449
  ci = mrb->c->ci;
1476
- if (mrb_type(blk) == MRB_TT_PROC) {
1450
+ if (mrb_proc_p(blk)) {
1477
1451
  struct RProc *p = mrb_proc_ptr(blk);
1478
1452
  if (p && !MRB_PROC_STRICT_P(p) && MRB_PROC_ENV(p) == ci[-1].env) {
1479
1453
  p->flags |= MRB_PROC_ORPHAN;
@@ -1584,9 +1558,13 @@ RETRY_TRY_BLOCK:
1584
1558
  struct RClass *cls;
1585
1559
  mrb_callinfo *ci = mrb->c->ci;
1586
1560
  mrb_value recv, blk;
1561
+ struct RProc *p = ci->proc;
1587
1562
  mrb_sym mid = ci->mid;
1588
- struct RClass* target_class = MRB_PROC_TARGET_CLASS(ci->proc);
1563
+ struct RClass* target_class = MRB_PROC_TARGET_CLASS(p);
1589
1564
 
1565
+ if (MRB_PROC_ENV_P(p) && p->e.env->mid && p->e.env->mid != mid) { /* alias support */
1566
+ mid = p->e.env->mid; /* restore old mid */
1567
+ }
1590
1568
  mrb_assert(bidx < irep->nregs);
1591
1569
 
1592
1570
  if (mid == 0 || !target_class) {
@@ -1610,7 +1588,7 @@ RETRY_TRY_BLOCK:
1610
1588
  goto L_RAISE;
1611
1589
  }
1612
1590
  blk = regs[bidx];
1613
- if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
1591
+ if (!mrb_nil_p(blk) && !mrb_proc_p(blk)) {
1614
1592
  blk = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
1615
1593
  /* The stack or ci stack might have been reallocated during
1616
1594
  mrb_convert_type(), see #3622 and #3784 */
@@ -1897,7 +1875,7 @@ RETRY_TRY_BLOCK:
1897
1875
  mrb_value kdict = regs[mrb->c->ci->argc];
1898
1876
 
1899
1877
  if (!mrb_hash_p(kdict) || !mrb_hash_key_p(mrb, kdict, k)) {
1900
- mrb_value str = mrb_format(mrb, "missing keyword: %S", k);
1878
+ mrb_value str = mrb_format(mrb, "missing keyword: %v", k);
1901
1879
  mrb_exc_set(mrb, mrb_exc_new_str(mrb, E_ARGUMENT_ERROR, str));
1902
1880
  goto L_RAISE;
1903
1881
  }
@@ -1924,7 +1902,7 @@ RETRY_TRY_BLOCK:
1924
1902
  if (mrb_hash_p(kdict) && !mrb_hash_empty_p(mrb, kdict)) {
1925
1903
  mrb_value keys = mrb_hash_keys(mrb, kdict);
1926
1904
  mrb_value key1 = RARRAY_PTR(keys)[0];
1927
- mrb_value str = mrb_format(mrb, "unknown keyword: %S", key1);
1905
+ mrb_value str = mrb_format(mrb, "unknown keyword: %v", key1);
1928
1906
  mrb_exc_set(mrb, mrb_exc_new_str(mrb, E_ARGUMENT_ERROR, str));
1929
1907
  goto L_RAISE;
1930
1908
  }
@@ -1961,7 +1939,7 @@ RETRY_TRY_BLOCK:
1961
1939
  else {
1962
1940
  blk = regs[ci->argc+1];
1963
1941
  }
1964
- if (mrb_type(blk) == MRB_TT_PROC) {
1942
+ if (mrb_proc_p(blk)) {
1965
1943
  struct RProc *p = mrb_proc_ptr(blk);
1966
1944
 
1967
1945
  if (!MRB_PROC_STRICT_P(p) &&
@@ -2046,7 +2024,7 @@ RETRY_TRY_BLOCK:
2046
2024
  if (MRB_PROC_ENV_P(dst)) {
2047
2025
  struct REnv *e = MRB_PROC_ENV(dst);
2048
2026
 
2049
- if (!MRB_ENV_STACK_SHARED_P(e) || e->cxt != mrb->c) {
2027
+ if (!MRB_ENV_STACK_SHARED_P(e) || (e->cxt && e->cxt != mrb->c)) {
2050
2028
  localjump_error(mrb, LOCALJUMP_ERROR_RETURN);
2051
2029
  goto L_RAISE;
2052
2030
  }
@@ -2131,8 +2109,8 @@ RETRY_TRY_BLOCK:
2131
2109
  }
2132
2110
  if (FALSE) {
2133
2111
  L_BREAK:
2134
- v = ((struct RBreak*)mrb->exc)->val;
2135
- proc = ((struct RBreak*)mrb->exc)->proc;
2112
+ v = mrb_break_value_get((struct RBreak*)mrb->exc);
2113
+ proc = mrb_break_proc_get((struct RBreak*)mrb->exc);
2136
2114
  mrb->exc = NULL;
2137
2115
  ci = mrb->c->ci;
2138
2116
  }
@@ -2178,7 +2156,7 @@ RETRY_TRY_BLOCK:
2178
2156
  }
2179
2157
  pc = ci->pc;
2180
2158
  ci = mrb->c->ci;
2181
- DEBUG(fprintf(stderr, "from :%s\n", mrb_sym2name(mrb, ci->mid)));
2159
+ DEBUG(fprintf(stderr, "from :%s\n", mrb_sym_name(mrb, ci->mid)));
2182
2160
  proc = mrb->c->ci->proc;
2183
2161
  irep = proc->body.irep;
2184
2162
  pool = irep->pool;
@@ -2217,184 +2195,67 @@ RETRY_TRY_BLOCK:
2217
2195
  }
2218
2196
 
2219
2197
  #define TYPES2(a,b) ((((uint16_t)(a))<<8)|(((uint16_t)(b))&0xff))
2220
- #define OP_MATH_BODY(op,v1,v2) do {\
2221
- v1(regs[a]) = v1(regs[a]) op v2(regs[a+1]);\
2222
- } while(0)
2223
-
2224
- CASE(OP_ADD, B) {
2225
- /* need to check if op is overridden */
2226
- switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {
2227
- case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):
2228
- {
2229
- mrb_int x, y, z;
2230
- mrb_value *regs_a = regs + a;
2231
-
2232
- x = mrb_fixnum(regs_a[0]);
2233
- y = mrb_fixnum(regs_a[1]);
2234
- if (mrb_int_add_overflow(x, y, &z)) {
2235
- #ifndef MRB_WITHOUT_FLOAT
2236
- SET_FLOAT_VALUE(mrb, regs_a[0], (mrb_float)x + (mrb_float)y);
2237
- break;
2238
- #endif
2239
- }
2240
- SET_INT_VALUE(regs[a], z);
2241
- }
2242
- break;
2243
- #ifndef MRB_WITHOUT_FLOAT
2244
- case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):
2245
- {
2246
- mrb_int x = mrb_fixnum(regs[a]);
2247
- mrb_float y = mrb_float(regs[a+1]);
2248
- SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x + y);
2249
- }
2250
- break;
2251
- case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):
2252
- #ifdef MRB_WORD_BOXING
2253
- {
2254
- mrb_float x = mrb_float(regs[a]);
2255
- mrb_int y = mrb_fixnum(regs[a+1]);
2256
- SET_FLOAT_VALUE(mrb, regs[a], x + y);
2257
- }
2258
- #else
2259
- OP_MATH_BODY(+,mrb_float,mrb_fixnum);
2260
- #endif
2261
- break;
2262
- case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):
2263
- #ifdef MRB_WORD_BOXING
2264
- {
2265
- mrb_float x = mrb_float(regs[a]);
2266
- mrb_float y = mrb_float(regs[a+1]);
2267
- SET_FLOAT_VALUE(mrb, regs[a], x + y);
2268
- }
2198
+ #define OP_MATH(op_name) \
2199
+ /* need to check if op is overridden */ \
2200
+ switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) { \
2201
+ OP_MATH_CASE_FIXNUM(op_name); \
2202
+ OP_MATH_CASE_FLOAT(op_name, fixnum, float); \
2203
+ OP_MATH_CASE_FLOAT(op_name, float, fixnum); \
2204
+ OP_MATH_CASE_FLOAT(op_name, float, float); \
2205
+ OP_MATH_CASE_STRING_##op_name(); \
2206
+ default: \
2207
+ c = 1; \
2208
+ mid = mrb_intern_lit(mrb, MRB_STRINGIZE(OP_MATH_OP_##op_name)); \
2209
+ goto L_SEND_SYM; \
2210
+ } \
2211
+ NEXT;
2212
+ #define OP_MATH_CASE_FIXNUM(op_name) \
2213
+ case TYPES2(MRB_TT_FIXNUM, MRB_TT_FIXNUM): \
2214
+ { \
2215
+ mrb_int x = mrb_fixnum(regs[a]), y = mrb_fixnum(regs[a+1]), z; \
2216
+ if (mrb_int_##op_name##_overflow(x, y, &z)) \
2217
+ OP_MATH_OVERFLOW_INT(op_name, x, y, z); \
2218
+ else \
2219
+ SET_INT_VALUE(regs[a], z); \
2220
+ } \
2221
+ break
2222
+ #ifdef MRB_WITHOUT_FLOAT
2223
+ #define OP_MATH_CASE_FLOAT(op_name, t1, t2) (void)0
2224
+ #define OP_MATH_OVERFLOW_INT(op_name, x, y, z) SET_INT_VALUE(regs[a], z)
2269
2225
  #else
2270
- OP_MATH_BODY(+,mrb_float,mrb_float);
2271
- #endif
2272
- break;
2226
+ #define OP_MATH_CASE_FLOAT(op_name, t1, t2) \
2227
+ case TYPES2(OP_MATH_TT_##t1, OP_MATH_TT_##t2): \
2228
+ { \
2229
+ mrb_float z = mrb_##t1(regs[a]) OP_MATH_OP_##op_name mrb_##t2(regs[a+1]); \
2230
+ SET_FLOAT_VALUE(mrb, regs[a], z); \
2231
+ } \
2232
+ break
2233
+ #define OP_MATH_OVERFLOW_INT(op_name, x, y, z) \
2234
+ SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x OP_MATH_OP_##op_name (mrb_float)y)
2273
2235
  #endif
2274
- case TYPES2(MRB_TT_STRING,MRB_TT_STRING):
2275
- regs[a] = mrb_str_plus(mrb, regs[a], regs[a+1]);
2276
- break;
2277
- default:
2278
- c = 1;
2279
- mid = mrb_intern_lit(mrb, "+");
2280
- goto L_SEND_SYM;
2281
- }
2282
- mrb_gc_arena_restore(mrb, ai);
2283
- NEXT;
2236
+ #define OP_MATH_CASE_STRING_add() \
2237
+ case TYPES2(MRB_TT_STRING, MRB_TT_STRING): \
2238
+ regs[a] = mrb_str_plus(mrb, regs[a], regs[a+1]); \
2239
+ mrb_gc_arena_restore(mrb, ai); \
2240
+ break
2241
+ #define OP_MATH_CASE_STRING_sub() (void)0
2242
+ #define OP_MATH_CASE_STRING_mul() (void)0
2243
+ #define OP_MATH_OP_add +
2244
+ #define OP_MATH_OP_sub -
2245
+ #define OP_MATH_OP_mul *
2246
+ #define OP_MATH_TT_fixnum MRB_TT_FIXNUM
2247
+ #define OP_MATH_TT_float MRB_TT_FLOAT
2248
+
2249
+ CASE(OP_ADD, B) {
2250
+ OP_MATH(add);
2284
2251
  }
2285
2252
 
2286
2253
  CASE(OP_SUB, B) {
2287
- /* need to check if op is overridden */
2288
- switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {
2289
- case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):
2290
- {
2291
- mrb_int x, y, z;
2292
-
2293
- x = mrb_fixnum(regs[a]);
2294
- y = mrb_fixnum(regs[a+1]);
2295
- if (mrb_int_sub_overflow(x, y, &z)) {
2296
- #ifndef MRB_WITHOUT_FLOAT
2297
- SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x - (mrb_float)y);
2298
- break;
2299
- #endif
2300
- }
2301
- SET_INT_VALUE(regs[a], z);
2302
- }
2303
- break;
2304
- #ifndef MRB_WITHOUT_FLOAT
2305
- case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):
2306
- {
2307
- mrb_int x = mrb_fixnum(regs[a]);
2308
- mrb_float y = mrb_float(regs[a+1]);
2309
- SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x - y);
2310
- }
2311
- break;
2312
- case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):
2313
- #ifdef MRB_WORD_BOXING
2314
- {
2315
- mrb_float x = mrb_float(regs[a]);
2316
- mrb_int y = mrb_fixnum(regs[a+1]);
2317
- SET_FLOAT_VALUE(mrb, regs[a], x - y);
2318
- }
2319
- #else
2320
- OP_MATH_BODY(-,mrb_float,mrb_fixnum);
2321
- #endif
2322
- break;
2323
- case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):
2324
- #ifdef MRB_WORD_BOXING
2325
- {
2326
- mrb_float x = mrb_float(regs[a]);
2327
- mrb_float y = mrb_float(regs[a+1]);
2328
- SET_FLOAT_VALUE(mrb, regs[a], x - y);
2329
- }
2330
- #else
2331
- OP_MATH_BODY(-,mrb_float,mrb_float);
2332
- #endif
2333
- break;
2334
- #endif
2335
- default:
2336
- c = 1;
2337
- mid = mrb_intern_lit(mrb, "-");
2338
- goto L_SEND_SYM;
2339
- }
2340
- NEXT;
2254
+ OP_MATH(sub);
2341
2255
  }
2342
2256
 
2343
2257
  CASE(OP_MUL, B) {
2344
- /* need to check if op is overridden */
2345
- switch (TYPES2(mrb_type(regs[a]),mrb_type(regs[a+1]))) {
2346
- case TYPES2(MRB_TT_FIXNUM,MRB_TT_FIXNUM):
2347
- {
2348
- mrb_int x, y, z;
2349
-
2350
- x = mrb_fixnum(regs[a]);
2351
- y = mrb_fixnum(regs[a+1]);
2352
- if (mrb_int_mul_overflow(x, y, &z)) {
2353
- #ifndef MRB_WITHOUT_FLOAT
2354
- SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x * (mrb_float)y);
2355
- break;
2356
- #endif
2357
- }
2358
- SET_INT_VALUE(regs[a], z);
2359
- }
2360
- break;
2361
- #ifndef MRB_WITHOUT_FLOAT
2362
- case TYPES2(MRB_TT_FIXNUM,MRB_TT_FLOAT):
2363
- {
2364
- mrb_int x = mrb_fixnum(regs[a]);
2365
- mrb_float y = mrb_float(regs[a+1]);
2366
- SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x * y);
2367
- }
2368
- break;
2369
- case TYPES2(MRB_TT_FLOAT,MRB_TT_FIXNUM):
2370
- #ifdef MRB_WORD_BOXING
2371
- {
2372
- mrb_float x = mrb_float(regs[a]);
2373
- mrb_int y = mrb_fixnum(regs[a+1]);
2374
- SET_FLOAT_VALUE(mrb, regs[a], x * y);
2375
- }
2376
- #else
2377
- OP_MATH_BODY(*,mrb_float,mrb_fixnum);
2378
- #endif
2379
- break;
2380
- case TYPES2(MRB_TT_FLOAT,MRB_TT_FLOAT):
2381
- #ifdef MRB_WORD_BOXING
2382
- {
2383
- mrb_float x = mrb_float(regs[a]);
2384
- mrb_float y = mrb_float(regs[a+1]);
2385
- SET_FLOAT_VALUE(mrb, regs[a], x * y);
2386
- }
2387
- #else
2388
- OP_MATH_BODY(*,mrb_float,mrb_float);
2389
- #endif
2390
- break;
2391
- #endif
2392
- default:
2393
- c = 1;
2394
- mid = mrb_intern_lit(mrb, "*");
2395
- goto L_SEND_SYM;
2396
- }
2397
- NEXT;
2258
+ OP_MATH(mul);
2398
2259
  }
2399
2260
 
2400
2261
  CASE(OP_DIV, B) {
@@ -2449,84 +2310,46 @@ RETRY_TRY_BLOCK:
2449
2310
  NEXT;
2450
2311
  }
2451
2312
 
2452
- CASE(OP_ADDI, BB) {
2453
- /* need to check if + is overridden */
2454
- switch (mrb_type(regs[a])) {
2455
- case MRB_TT_FIXNUM:
2456
- {
2457
- mrb_int x = mrb_fixnum(regs[a]);
2458
- mrb_int y = (mrb_int)b;
2459
- mrb_int z;
2460
-
2461
- if (mrb_int_add_overflow(x, y, &z)) {
2462
- #ifndef MRB_WITHOUT_FLOAT
2463
- SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x + (mrb_float)y);
2464
- break;
2465
- #endif
2466
- }
2467
- SET_INT_VALUE(regs[a], z);
2468
- }
2469
- break;
2470
- #ifndef MRB_WITHOUT_FLOAT
2471
- case MRB_TT_FLOAT:
2472
- #ifdef MRB_WORD_BOXING
2473
- {
2474
- mrb_float x = mrb_float(regs[a]);
2475
- SET_FLOAT_VALUE(mrb, regs[a], x + b);
2476
- }
2313
+ #define OP_MATHI(op_name) \
2314
+ /* need to check if op is overridden */ \
2315
+ switch (mrb_type(regs[a])) { \
2316
+ OP_MATHI_CASE_FIXNUM(op_name); \
2317
+ OP_MATHI_CASE_FLOAT(op_name); \
2318
+ default: \
2319
+ SET_INT_VALUE(regs[a+1], b); \
2320
+ c = 1; \
2321
+ mid = mrb_intern_lit(mrb, MRB_STRINGIZE(OP_MATH_OP_##op_name)); \
2322
+ goto L_SEND_SYM; \
2323
+ } \
2324
+ NEXT;
2325
+ #define OP_MATHI_CASE_FIXNUM(op_name) \
2326
+ case MRB_TT_FIXNUM: \
2327
+ { \
2328
+ mrb_int x = mrb_fixnum(regs[a]), y = (mrb_int)b, z; \
2329
+ if (mrb_int_##op_name##_overflow(x, y, &z)) \
2330
+ OP_MATH_OVERFLOW_INT(op_name, x, y, z); \
2331
+ else \
2332
+ SET_INT_VALUE(regs[a], z); \
2333
+ } \
2334
+ break
2335
+ #ifdef MRB_WITHOUT_FLOAT
2336
+ #define OP_MATHI_CASE_FLOAT(op_name) (void)0
2477
2337
  #else
2478
- mrb_float(regs[a]) += b;
2479
- #endif
2480
- break;
2338
+ #define OP_MATHI_CASE_FLOAT(op_name) \
2339
+ case MRB_TT_FLOAT: \
2340
+ { \
2341
+ mrb_float z = mrb_float(regs[a]) OP_MATH_OP_##op_name b; \
2342
+ SET_FLOAT_VALUE(mrb, regs[a], z); \
2343
+ } \
2344
+ break
2481
2345
  #endif
2482
- default:
2483
- SET_INT_VALUE(regs[a+1], b);
2484
- c = 1;
2485
- mid = mrb_intern_lit(mrb, "+");
2486
- goto L_SEND_SYM;
2487
- }
2488
- NEXT;
2346
+
2347
+ CASE(OP_ADDI, BB) {
2348
+ OP_MATHI(add);
2489
2349
  }
2490
2350
 
2491
2351
  CASE(OP_SUBI, BB) {
2492
- mrb_value *regs_a = regs + a;
2493
-
2494
- /* need to check if + is overridden */
2495
- switch (mrb_type(regs_a[0])) {
2496
- case MRB_TT_FIXNUM:
2497
- {
2498
- mrb_int x = mrb_fixnum(regs_a[0]);
2499
- mrb_int y = (mrb_int)b;
2500
- mrb_int z;
2501
-
2502
- if (mrb_int_sub_overflow(x, y, &z)) {
2503
- #ifndef MRB_WITHOUT_FLOAT
2504
- SET_FLOAT_VALUE(mrb, regs_a[0], (mrb_float)x - (mrb_float)y);
2505
- break;
2506
- #endif
2507
- }
2508
- SET_INT_VALUE(regs_a[0], z);
2509
- }
2510
- break;
2511
- #ifndef MRB_WITHOUT_FLOAT
2512
- case MRB_TT_FLOAT:
2513
- #ifdef MRB_WORD_BOXING
2514
- {
2515
- mrb_float x = mrb_float(regs[a]);
2516
- SET_FLOAT_VALUE(mrb, regs[a], (mrb_float)x - (mrb_float)b);
2517
- }
2518
- #else
2519
- mrb_float(regs_a[0]) -= b;
2520
- #endif
2521
- break;
2522
- #endif
2523
- default:
2524
- SET_INT_VALUE(regs_a[1], b);
2525
- c = 1;
2526
- mid = mrb_intern_lit(mrb, "-");
2527
- goto L_SEND_SYM;
2528
- }
2529
- NEXT;
2352
+ OP_MATHI(sub);
2530
2353
  }
2531
2354
 
2532
2355
  #define OP_CMP_BODY(op,v1,v2) (v1(regs[a]) op v2(regs[a+1]))
@@ -2627,7 +2450,12 @@ RETRY_TRY_BLOCK:
2627
2450
 
2628
2451
  CASE(OP_ARYCAT, B) {
2629
2452
  mrb_value splat = mrb_ary_splat(mrb, regs[a+1]);
2630
- mrb_ary_concat(mrb, regs[a], splat);
2453
+ if (mrb_nil_p(regs[a])) {
2454
+ regs[a] = splat;
2455
+ }
2456
+ else {
2457
+ mrb_ary_concat(mrb, regs[a], splat);
2458
+ }
2631
2459
  mrb_gc_arena_restore(mrb, ai);
2632
2460
  NEXT;
2633
2461
  }
@@ -3018,14 +2846,15 @@ mrb_top_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int sta
3018
2846
  return mrb_vm_run(mrb, proc, self, stack_keep);
3019
2847
  }
3020
2848
  if (mrb->c->ci == mrb->c->cibase) {
2849
+ mrb->c->ci->env = NULL;
3021
2850
  return mrb_vm_run(mrb, proc, self, stack_keep);
3022
2851
  }
3023
2852
  ci = cipush(mrb);
2853
+ ci->stackent = mrb->c->stack;
3024
2854
  ci->mid = 0;
3025
2855
  ci->acc = CI_ACC_SKIP;
3026
2856
  ci->target_class = mrb->object_class;
3027
2857
  v = mrb_vm_run(mrb, proc, self, stack_keep);
3028
- cipop(mrb);
3029
2858
 
3030
2859
  return v;
3031
2860
  }