script_core 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (283) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/Gemfile +2 -2
  4. data/ext/enterprise_script_service/Rakefile +1 -1
  5. data/ext/enterprise_script_service/mruby/.github/workflows/build.yml +117 -74
  6. data/ext/enterprise_script_service/mruby/.github/workflows/codeql-analysis.yml +41 -37
  7. data/ext/enterprise_script_service/mruby/.github/workflows/lint.yml +23 -0
  8. data/ext/enterprise_script_service/mruby/.github/workflows/oss-fuzz.yml +27 -0
  9. data/ext/enterprise_script_service/mruby/.github/workflows/spell-checker.yml +17 -0
  10. data/ext/enterprise_script_service/mruby/.gitlab-ci.yml +3 -3
  11. data/ext/enterprise_script_service/mruby/.markdownlint.yml +16 -0
  12. data/ext/enterprise_script_service/mruby/.travis.yml +2 -2
  13. data/ext/enterprise_script_service/mruby/.yamllint +8 -0
  14. data/ext/enterprise_script_service/mruby/AUTHORS +3 -0
  15. data/ext/enterprise_script_service/mruby/CODEOWNERS +1 -0
  16. data/ext/enterprise_script_service/mruby/CONTRIBUTING.md +6 -13
  17. data/ext/enterprise_script_service/mruby/Doxyfile +4 -4
  18. data/ext/enterprise_script_service/mruby/LICENSE +1 -1
  19. data/ext/enterprise_script_service/mruby/Makefile +1 -1
  20. data/ext/enterprise_script_service/mruby/README.md +4 -14
  21. data/ext/enterprise_script_service/mruby/Rakefile +18 -108
  22. data/ext/enterprise_script_service/mruby/TODO.md +17 -0
  23. data/ext/enterprise_script_service/mruby/appveyor.yml +31 -25
  24. data/ext/enterprise_script_service/mruby/benchmark/bm_ao_render.rb +1 -1
  25. data/ext/enterprise_script_service/mruby/build_config.rb +9 -152
  26. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_ArduinoDue.rb → build_config/ArduinoDue.rb} +2 -19
  27. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_IntelEdison.rb → build_config/IntelEdison.rb} +2 -2
  28. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_IntelGalileo.rb → build_config/IntelGalileo.rb} +1 -18
  29. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_RX630.rb → build_config/RX630.rb} +2 -19
  30. data/ext/enterprise_script_service/mruby/build_config/android_arm64-v8a.rb +11 -0
  31. data/ext/enterprise_script_service/mruby/build_config/android_armeabi.rb +11 -0
  32. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_android_armeabi_v7a_neon_hard.rb → build_config/android_armeabi_v7a_neon_hard.rb} +0 -15
  33. data/ext/enterprise_script_service/mruby/build_config/bench.rb +11 -0
  34. data/ext/enterprise_script_service/mruby/build_config/boxing.rb +21 -0
  35. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_chipKITMax32.rb → build_config/chipKITMax32.rb} +2 -19
  36. data/ext/enterprise_script_service/mruby/{travis_config.rb → build_config/ci/gcc-clang.rb} +10 -10
  37. data/ext/enterprise_script_service/mruby/build_config/ci/msvc.rb +20 -0
  38. data/ext/enterprise_script_service/mruby/build_config/clang-asan.rb +11 -0
  39. data/ext/enterprise_script_service/mruby/build_config/cross-32bit.rb +14 -0
  40. data/ext/enterprise_script_service/mruby/build_config/default.rb +80 -0
  41. data/ext/enterprise_script_service/mruby/{examples/targets/build_config_dreamcast_shelf.rb → build_config/dreamcast_shelf.rb} +5 -19
  42. data/ext/enterprise_script_service/mruby/build_config/gameboyadvance.rb +73 -0
  43. data/ext/enterprise_script_service/mruby/build_config/host-cxx.rb +12 -0
  44. data/ext/enterprise_script_service/mruby/build_config/host-debug.rb +20 -0
  45. data/ext/enterprise_script_service/mruby/build_config/host-gprof.rb +14 -0
  46. data/ext/enterprise_script_service/mruby/build_config/host-m32.rb +15 -0
  47. data/ext/enterprise_script_service/mruby/build_config/host-shared.rb +36 -0
  48. data/ext/enterprise_script_service/mruby/build_config/mrbc.rb +11 -0
  49. data/ext/enterprise_script_service/mruby/build_config/no-float.rb +17 -0
  50. data/ext/enterprise_script_service/mruby/doc/guides/compile.md +138 -49
  51. data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +5 -4
  52. data/ext/enterprise_script_service/mruby/doc/guides/gc-arena-howto.md +1 -1
  53. data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +49 -22
  54. data/ext/enterprise_script_service/mruby/doc/guides/mrbgems.md +31 -14
  55. data/ext/enterprise_script_service/mruby/doc/guides/symbol.md +83 -0
  56. data/ext/enterprise_script_service/mruby/doc/limitations.md +35 -36
  57. data/ext/enterprise_script_service/mruby/doc/mruby3.md +163 -0
  58. data/ext/enterprise_script_service/mruby/doc/opcode.md +93 -107
  59. data/ext/enterprise_script_service/mruby/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb +1 -1
  60. data/ext/enterprise_script_service/mruby/examples/mrbgems/c_and_ruby_extension_example/src/example.c +5 -1
  61. data/ext/enterprise_script_service/mruby/examples/mrbgems/c_extension_example/src/example.c +5 -1
  62. data/ext/enterprise_script_service/mruby/examples/mrbgems/ruby_extension_example/mrblib/example.rb +1 -1
  63. data/ext/enterprise_script_service/mruby/include/mrbconf.h +81 -62
  64. data/ext/enterprise_script_service/mruby/include/mruby.h +137 -96
  65. data/ext/enterprise_script_service/mruby/include/mruby/array.h +23 -6
  66. data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +73 -48
  67. data/ext/enterprise_script_service/mruby/include/mruby/boxing_no.h +8 -8
  68. data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +79 -48
  69. data/ext/enterprise_script_service/mruby/include/mruby/class.h +10 -8
  70. data/ext/enterprise_script_service/mruby/include/mruby/common.h +4 -1
  71. data/ext/enterprise_script_service/mruby/include/mruby/compile.h +13 -7
  72. data/ext/enterprise_script_service/mruby/include/mruby/debug.h +2 -2
  73. data/ext/enterprise_script_service/mruby/include/mruby/dump.h +17 -35
  74. data/ext/enterprise_script_service/mruby/include/mruby/endian.h +44 -0
  75. data/ext/enterprise_script_service/mruby/include/mruby/error.h +39 -5
  76. data/ext/enterprise_script_service/mruby/include/mruby/gc.h +1 -0
  77. data/ext/enterprise_script_service/mruby/include/mruby/hash.h +33 -13
  78. data/ext/enterprise_script_service/mruby/include/mruby/irep.h +64 -14
  79. data/ext/enterprise_script_service/mruby/include/mruby/khash.h +6 -14
  80. data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +36 -63
  81. data/ext/enterprise_script_service/mruby/include/mruby/opcode.h +1 -27
  82. data/ext/enterprise_script_service/mruby/include/mruby/ops.h +27 -23
  83. data/ext/enterprise_script_service/mruby/include/mruby/presym.h +40 -0
  84. data/ext/enterprise_script_service/mruby/include/mruby/presym/disable.h +70 -0
  85. data/ext/enterprise_script_service/mruby/include/mruby/presym/enable.h +37 -0
  86. data/ext/enterprise_script_service/mruby/include/mruby/presym/scanning.h +73 -0
  87. data/ext/enterprise_script_service/mruby/include/mruby/proc.h +80 -13
  88. data/ext/enterprise_script_service/mruby/include/mruby/string.h +10 -15
  89. data/ext/enterprise_script_service/mruby/include/mruby/throw.h +14 -3
  90. data/ext/enterprise_script_service/mruby/include/mruby/value.h +29 -19
  91. data/ext/enterprise_script_service/mruby/include/mruby/variable.h +1 -0
  92. data/ext/enterprise_script_service/mruby/include/mruby/version.h +26 -7
  93. data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +198 -44
  94. data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +55 -37
  95. data/ext/enterprise_script_service/mruby/lib/mruby/build/load_gems.rb +12 -10
  96. data/ext/enterprise_script_service/mruby/lib/{mruby-core-ext.rb → mruby/core_ext.rb} +10 -3
  97. data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +75 -32
  98. data/ext/enterprise_script_service/mruby/lib/mruby/lockfile.rb +1 -1
  99. data/ext/enterprise_script_service/mruby/lib/mruby/presym.rb +132 -0
  100. data/ext/enterprise_script_service/mruby/mrbgems/default-no-fpu.gembox +3 -0
  101. data/ext/enterprise_script_service/mruby/mrbgems/default-no-stdio.gembox +4 -0
  102. data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +9 -88
  103. data/ext/enterprise_script_service/mruby/mrbgems/full-core.gembox +1 -4
  104. data/ext/enterprise_script_service/mruby/mrbgems/math.gembox +10 -0
  105. data/ext/enterprise_script_service/mruby/mrbgems/metaprog.gembox +15 -0
  106. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +1 -1
  107. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +5 -4
  108. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-config/mrbgem.rake +28 -19
  109. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-config/mruby-config +18 -8
  110. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/bintest/mrdb.rb +3 -6
  111. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/bintest/print.rb +10 -10
  112. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +14 -9
  113. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +3 -2
  114. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +4 -3
  115. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +2 -6
  116. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +4 -4
  117. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/bintest/mirb.rb +23 -5
  118. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/mrbgem.rake +11 -2
  119. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +41 -34
  120. data/ext/enterprise_script_service/mruby/mrbgems/{mruby-compiler → mruby-bin-mrbc}/bintest/mrbc.rb +0 -0
  121. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/mrbgem.rake +3 -4
  122. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +19 -9
  123. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +25 -4
  124. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +1 -1
  125. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +22 -6
  126. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb +1 -1
  127. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c +2 -2
  128. data/ext/enterprise_script_service/mruby/mrbgems/mruby-catch/mrbgem.rake +5 -0
  129. data/ext/enterprise_script_service/mruby/mrbgems/mruby-catch/mrblib/catch.rb +27 -0
  130. data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +2 -1
  131. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +430 -399
  132. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/keywords +5 -0
  133. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/lex.def +49 -44
  134. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +559 -217
  135. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/y.tab.c +4774 -4193
  136. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/mrbgem.rake +18 -19
  137. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +1 -1
  138. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +8 -7
  139. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/test/complex.rb +4 -4
  140. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +1 -0
  141. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +2 -2
  142. data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/mrbgem.rake +2 -2
  143. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +17 -25
  144. data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +18 -13
  145. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +30 -2
  146. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/test/hash.rb +7 -0
  147. data/ext/enterprise_script_service/mruby/mrbgems/mruby-inline-struct/test/inline.c +2 -2
  148. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/README.md +18 -16
  149. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/include/mruby/ext/io.h +2 -2
  150. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file.rb +9 -4
  151. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +2 -2
  152. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +55 -52
  153. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +4 -2
  154. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +99 -87
  155. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +2 -0
  156. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +2 -3
  157. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +1 -1
  158. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +7 -6
  159. data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/src/math.c +13 -12
  160. data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/test/math.rb +5 -4
  161. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +43 -58
  162. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +4 -4
  163. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/README.md +4 -3
  164. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +77 -74
  165. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/test/method.rb +4 -4
  166. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +14 -13
  167. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +5 -4
  168. data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +18 -12
  169. data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/mrbgem.rake +10 -0
  170. data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/src/memsize.c +231 -0
  171. data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/test/memsize.rb +63 -0
  172. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/README.md +15 -18
  173. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +38 -88
  174. data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/mrblib/print.rb +1 -30
  175. data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/src/print.c +62 -26
  176. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +32 -19
  177. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/test/proc.c +1 -1
  178. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.c +98 -43
  179. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/test/random.rb +2 -2
  180. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/mrblib/range.rb +39 -6
  181. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +20 -40
  182. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/test/range.rb +27 -3
  183. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +11 -17
  184. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +216 -38
  185. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/test/rational.rb +6 -6
  186. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/README.md +6 -4
  187. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/src/mrb_sleep.c +4 -4
  188. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/README.md +3 -2
  189. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/src/socket.c +47 -45
  190. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +102 -71
  191. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/test/sprintf.rb +4 -2
  192. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +23 -1
  193. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +13 -9
  194. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/mrblib/struct.rb +1 -1
  195. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +18 -25
  196. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +6 -5
  197. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +1 -1
  198. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/README.md +0 -1
  199. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/driver.c +5 -5
  200. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +16 -44
  201. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/vformat.c +4 -4
  202. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +27 -27
  203. data/ext/enterprise_script_service/mruby/mrbgems/stdlib-ext.gembox +18 -0
  204. data/ext/enterprise_script_service/mruby/mrbgems/stdlib-io.gembox +12 -0
  205. data/ext/enterprise_script_service/mruby/mrbgems/stdlib.gembox +54 -0
  206. data/ext/enterprise_script_service/mruby/mrblib/10error.rb +4 -0
  207. data/ext/enterprise_script_service/mruby/mrblib/array.rb +17 -9
  208. data/ext/enterprise_script_service/mruby/mrblib/enum.rb +1 -1
  209. data/ext/enterprise_script_service/mruby/mrblib/hash.rb +0 -20
  210. data/ext/enterprise_script_service/mruby/mrblib/init_mrblib.c +0 -11
  211. data/ext/enterprise_script_service/mruby/mrblib/numeric.rb +36 -11
  212. data/ext/enterprise_script_service/mruby/mrblib/range.rb +25 -3
  213. data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_proto_fuzzer.cpp +2 -2
  214. data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.h +1 -1
  215. data/ext/enterprise_script_service/mruby/src/array.c +43 -80
  216. data/ext/enterprise_script_service/mruby/src/backtrace.c +16 -17
  217. data/ext/enterprise_script_service/mruby/src/class.c +774 -182
  218. data/ext/enterprise_script_service/mruby/src/codedump.c +223 -198
  219. data/ext/enterprise_script_service/mruby/src/debug.c +6 -6
  220. data/ext/enterprise_script_service/mruby/src/dump.c +466 -141
  221. data/ext/enterprise_script_service/mruby/src/enum.c +1 -1
  222. data/ext/enterprise_script_service/mruby/src/error.c +36 -13
  223. data/ext/enterprise_script_service/mruby/src/etc.c +43 -34
  224. data/ext/enterprise_script_service/mruby/src/fmt_fp.c +5 -6
  225. data/ext/enterprise_script_service/mruby/src/gc.c +73 -71
  226. data/ext/enterprise_script_service/mruby/src/hash.c +1050 -707
  227. data/ext/enterprise_script_service/mruby/src/kernel.c +75 -220
  228. data/ext/enterprise_script_service/mruby/src/load.c +196 -166
  229. data/ext/enterprise_script_service/mruby/src/numeric.c +352 -314
  230. data/ext/enterprise_script_service/mruby/src/object.c +97 -90
  231. data/ext/enterprise_script_service/mruby/src/print.c +4 -3
  232. data/ext/enterprise_script_service/mruby/src/proc.c +48 -56
  233. data/ext/enterprise_script_service/mruby/src/range.c +45 -21
  234. data/ext/enterprise_script_service/mruby/src/state.c +25 -32
  235. data/ext/enterprise_script_service/mruby/src/string.c +59 -101
  236. data/ext/enterprise_script_service/mruby/src/symbol.c +121 -56
  237. data/ext/enterprise_script_service/mruby/src/value_array.h +1 -0
  238. data/ext/enterprise_script_service/mruby/src/variable.c +158 -158
  239. data/ext/enterprise_script_service/mruby/src/vm.c +617 -602
  240. data/ext/enterprise_script_service/mruby/tasks/benchmark.rake +6 -6
  241. data/ext/enterprise_script_service/mruby/tasks/bin.rake +23 -0
  242. data/ext/enterprise_script_service/mruby/tasks/core.rake +12 -0
  243. data/ext/enterprise_script_service/mruby/tasks/doc.rake +50 -38
  244. data/ext/enterprise_script_service/mruby/tasks/gitlab.rake +83 -77
  245. data/ext/enterprise_script_service/mruby/tasks/libmruby.rake +10 -1
  246. data/ext/enterprise_script_service/mruby/tasks/mrbgems.rake +13 -1
  247. data/ext/enterprise_script_service/mruby/tasks/mrblib.rake +40 -0
  248. data/ext/enterprise_script_service/mruby/tasks/presym.rake +44 -0
  249. data/ext/enterprise_script_service/mruby/tasks/test.rake +68 -0
  250. data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +6 -5
  251. data/ext/enterprise_script_service/mruby/tasks/toolchains/openwrt.rake +10 -14
  252. data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +17 -21
  253. data/ext/enterprise_script_service/mruby/test/bintest.rb +5 -5
  254. data/ext/enterprise_script_service/mruby/test/t/argumenterror.rb +16 -0
  255. data/ext/enterprise_script_service/mruby/test/t/array.rb +7 -3
  256. data/ext/enterprise_script_service/mruby/test/t/bs_literal.rb +1 -1
  257. data/ext/enterprise_script_service/mruby/test/t/float.rb +18 -8
  258. data/ext/enterprise_script_service/mruby/test/t/hash.rb +903 -281
  259. data/ext/enterprise_script_service/mruby/test/t/integer.rb +10 -38
  260. data/ext/enterprise_script_service/mruby/test/t/kernel.rb +1 -1
  261. data/ext/enterprise_script_service/mruby/test/t/literals.rb +50 -0
  262. data/ext/enterprise_script_service/mruby/test/t/module.rb +2 -2
  263. data/ext/enterprise_script_service/mruby/test/t/numeric.rb +1 -1
  264. data/ext/enterprise_script_service/mruby/test/t/range.rb +83 -1
  265. data/ext/enterprise_script_service/mruby/test/t/string.rb +4 -0
  266. data/ext/enterprise_script_service/mruby/test/t/superclass.rb +10 -10
  267. data/ext/enterprise_script_service/mruby/test/t/syntax.rb +24 -0
  268. data/ext/enterprise_script_service/mruby/test/t/vformat.rb +3 -3
  269. data/ext/enterprise_script_service/mruby_config.rb +2 -5
  270. data/ext/enterprise_script_service/mruby_engine.cpp +1 -1
  271. data/lib/script_core/version.rb +1 -1
  272. data/spec/script_core_spec.rb +13 -0
  273. metadata +61 -23
  274. data/ext/enterprise_script_service/mruby/.github/workflows/main.yml +0 -24
  275. data/ext/enterprise_script_service/mruby/TODO +0 -8
  276. data/ext/enterprise_script_service/mruby/appveyor_config.rb +0 -46
  277. data/ext/enterprise_script_service/mruby/benchmark/build_config_boxing.rb +0 -28
  278. data/ext/enterprise_script_service/mruby/examples/targets/build_config_android_arm64-v8a.rb +0 -26
  279. data/ext/enterprise_script_service/mruby/examples/targets/build_config_android_armeabi.rb +0 -26
  280. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/kernel.c +0 -30
  281. data/ext/enterprise_script_service/mruby/mrblib/mrblib.rake +0 -18
  282. data/ext/enterprise_script_service/mruby/src/crc.c +0 -39
  283. data/ext/enterprise_script_service/mruby/src/mruby_core.rake +0 -19
@@ -16,36 +16,72 @@
16
16
  MRB_BEGIN_DECL
17
17
 
18
18
  enum irep_pool_type {
19
- IREP_TT_STRING,
20
- IREP_TT_FIXNUM,
21
- IREP_TT_FLOAT,
19
+ IREP_TT_STR = 0, /* string (need free) */
20
+ IREP_TT_SSTR = 2, /* string (static) */
21
+ IREP_TT_INT32 = 1, /* 32bit integer */
22
+ IREP_TT_INT64 = 3, /* 64bit integer */
23
+ IREP_TT_FLOAT = 5, /* float (double/float) */
22
24
  };
23
25
 
24
- struct mrb_locals {
25
- mrb_sym name;
26
- uint16_t r;
26
+ #define IREP_TT_NFLAG 1 /* number (non string) flag */
27
+ #define IREP_TT_SFLAG 2 /* static string flag */
28
+
29
+ typedef struct mrb_pool_value {
30
+ uint32_t tt; /* packed type and length (for string) */
31
+ union {
32
+ const char *str;
33
+ int32_t i32;
34
+ #if defined(MRB_64BIT) || defined(MRB_INT64)
35
+ int64_t i64;
36
+ #endif
37
+ #ifndef MRB_NO_FLOAT
38
+ mrb_float f;
39
+ #endif
40
+ } u;
41
+ } mrb_pool_value;
42
+
43
+ enum mrb_catch_type {
44
+ MRB_CATCH_RESCUE = 0,
45
+ MRB_CATCH_ENSURE = 1,
46
+ };
47
+
48
+ struct mrb_irep_catch_handler {
49
+ uint8_t type; /* enum mrb_catch_type */
50
+ uint8_t begin[4]; /* The starting address to match the hander. Includes this. */
51
+ uint8_t end[4]; /* The endpoint address that matches the hander. Not Includes this. */
52
+ uint8_t target[4]; /* The address to jump to if a match is made. */
27
53
  };
28
54
 
29
55
  /* Program data array struct */
30
56
  typedef struct mrb_irep {
31
57
  uint16_t nlocals; /* Number of local variables */
32
58
  uint16_t nregs; /* Number of register variables */
59
+ uint16_t clen; /* Number of catch handlers */
33
60
  uint8_t flags;
34
61
 
35
62
  const mrb_code *iseq;
36
- mrb_value *pool;
37
- mrb_sym *syms;
38
- struct mrb_irep **reps;
39
-
40
- struct mrb_locals *lv;
63
+ /*
64
+ * A catch handler table is placed after the iseq entity.
65
+ * The reason it doesn't add fields to the structure is to keep the mrb_irep structure from bloating.
66
+ * The catch handler table can be obtained with `mrb_irep_catch_handler_table(irep)`.
67
+ */
68
+ const mrb_pool_value *pool;
69
+ const mrb_sym *syms;
70
+ const struct mrb_irep * const *reps;
71
+
72
+ const mrb_sym *lv;
41
73
  /* debug info */
42
74
  struct mrb_irep_debug_info* debug_info;
43
75
 
44
- uint16_t ilen, plen, slen, rlen;
45
- uint32_t refcnt;
76
+ uint32_t ilen;
77
+ uint16_t plen, slen;
78
+ uint16_t rlen;
79
+ uint16_t refcnt;
46
80
  } mrb_irep;
47
81
 
48
82
  #define MRB_ISEQ_NO_FREE 1
83
+ #define MRB_IREP_NO_FREE 2
84
+ #define MRB_IREP_STATIC (MRB_ISEQ_NO_FREE | MRB_IREP_NO_FREE)
49
85
 
50
86
  MRB_API mrb_irep *mrb_add_irep(mrb_state *mrb);
51
87
 
@@ -87,11 +123,25 @@ struct mrb_insn_data {
87
123
  uint8_t insn;
88
124
  uint16_t a;
89
125
  uint16_t b;
90
- uint8_t c;
126
+ uint16_t c;
91
127
  };
92
128
 
93
129
  struct mrb_insn_data mrb_decode_insn(const mrb_code *pc);
94
130
 
131
+ static inline const struct mrb_irep_catch_handler *
132
+ mrb_irep_catch_handler_table(const struct mrb_irep *irep)
133
+ {
134
+ if (irep->clen > 0) {
135
+ return (const struct mrb_irep_catch_handler*)(irep->iseq + irep->ilen);
136
+ }
137
+ else {
138
+ return (const struct mrb_irep_catch_handler*)NULL;
139
+ }
140
+ }
141
+
142
+ #define mrb_irep_catch_handler_pack(n, v) uint32_to_bin(n, v)
143
+ #define mrb_irep_catch_handler_unpack(v) bin_to_uint32(v)
144
+
95
145
  MRB_END_DECL
96
146
 
97
147
  #endif /* MRUBY_IREP_H */
@@ -61,7 +61,6 @@ static const uint8_t __m_either[] = {0x03, 0x0c, 0x30, 0xc0};
61
61
  typedef struct kh_##name { \
62
62
  khint_t n_buckets; \
63
63
  khint_t size; \
64
- khint_t n_occupied; \
65
64
  uint8_t *ed_flags; \
66
65
  khkey_t *keys; \
67
66
  khval_t *vals; \
@@ -73,7 +72,6 @@ static const uint8_t __m_either[] = {0x03, 0x0c, 0x30, 0xc0};
73
72
  void kh_clear_##name(mrb_state *mrb, kh_##name##_t *h); \
74
73
  khint_t kh_get_##name(mrb_state *mrb, kh_##name##_t *h, khkey_t key); \
75
74
  khint_t kh_put_##name(mrb_state *mrb, kh_##name##_t *h, khkey_t key, int *ret); \
76
- void kh_put_prepare_##name(mrb_state *mrb, kh_##name##_t *h); \
77
75
  void kh_resize_##name(mrb_state *mrb, kh_##name##_t *h, khint_t new_n_buckets); \
78
76
  void kh_del_##name(mrb_state *mrb, kh_##name##_t *h, khint_t x); \
79
77
  kh_##name##_t *kh_copy_##name(mrb_state *mrb, kh_##name##_t *h);
@@ -93,7 +91,7 @@ kh_fill_flags(uint8_t *p, uint8_t c, size_t len)
93
91
  khval_t: value data type
94
92
  kh_is_map: (0: hash set / 1: hash map)
95
93
  __hash_func: hash function
96
- __hash_equal: hash comparation function
94
+ __hash_equal: hash comparison function
97
95
  */
98
96
  #define KHASH_DEFINE(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \
99
97
  mrb_noreturn void mrb_raise_nomemory(mrb_state *mrb); \
@@ -103,7 +101,7 @@ kh_fill_flags(uint8_t *p, uint8_t c, size_t len)
103
101
  size_t len = sizeof(khkey_t) + (kh_is_map ? sizeof(khval_t) : 0); \
104
102
  uint8_t *p = (uint8_t*)mrb_malloc_simple(mrb, sizeof(uint8_t)*sz/4+len*sz); \
105
103
  if (!p) { return 1; } \
106
- h->size = h->n_occupied = 0; \
104
+ h->size = 0; \
107
105
  h->keys = (khkey_t *)p; \
108
106
  h->vals = kh_is_map ? (khval_t *)(p+sizeof(khkey_t)*sz) : NULL; \
109
107
  h->ed_flags = p+len*sz; \
@@ -143,7 +141,7 @@ kh_fill_flags(uint8_t *p, uint8_t c, size_t len)
143
141
  (void)mrb; \
144
142
  if (h && h->ed_flags) { \
145
143
  kh_fill_flags(h->ed_flags, 0xaa, h->n_buckets/4); \
146
- h->size = h->n_occupied = 0; \
144
+ h->size = 0; \
147
145
  } \
148
146
  } \
149
147
  khint_t kh_get_##name(mrb_state *mrb, kh_##name##_t *h, khkey_t key) \
@@ -184,16 +182,12 @@ kh_fill_flags(uint8_t *p, uint8_t c, size_t len)
184
182
  mrb_free(mrb, old_keys); \
185
183
  } \
186
184
  } \
187
- void kh_put_prepare_##name(mrb_state *mrb, kh_##name##_t *h) \
188
- { \
189
- if (h->n_occupied >= khash_upper_bound(h)) { \
190
- kh_resize_##name(mrb, h, h->n_buckets*2); \
191
- } \
192
- } \
193
185
  khint_t kh_put_##name(mrb_state *mrb, kh_##name##_t *h, khkey_t key, int *ret) \
194
186
  { \
195
187
  khint_t k, del_k, step = 0; \
196
- kh_put_prepare_##name(mrb, h); \
188
+ if (h->size >= khash_upper_bound(h)) { \
189
+ kh_resize_##name(mrb, h, h->n_buckets*2); \
190
+ } \
197
191
  k = __hash_func(mrb,key) & khash_mask(h); \
198
192
  del_k = kh_end(h); \
199
193
  while (!__ac_isempty(h->ed_flags, k)) { \
@@ -221,7 +215,6 @@ kh_fill_flags(uint8_t *p, uint8_t c, size_t len)
221
215
  h->keys[k] = key; \
222
216
  h->ed_flags[k/4] &= ~__m_empty[k%4]; \
223
217
  h->size++; \
224
- h->n_occupied++; \
225
218
  if (ret) *ret = 1; \
226
219
  return k; \
227
220
  } \
@@ -256,7 +249,6 @@ kh_fill_flags(uint8_t *p, uint8_t c, size_t len)
256
249
  #define kh_destroy(name, mrb, h) kh_destroy_##name(mrb, h)
257
250
  #define kh_clear(name, mrb, h) kh_clear_##name(mrb, h)
258
251
  #define kh_resize(name, mrb, h, s) kh_resize_##name(mrb, h, s)
259
- #define kh_put_prepare(name, mrb, h) kh_put_prepare_##name(mrb, h)
260
252
  #define kh_put(name, mrb, h, k) kh_put_##name(mrb, h, k, NULL)
261
253
  #define kh_put2(name, mrb, h, k, r) kh_put_##name(mrb, h, k, r)
262
254
  #define kh_get(name, mrb, h, k) kh_get_##name(mrb, h, k)
@@ -1,5 +1,5 @@
1
1
  /**
2
- ** @file mruby/numeric.h - Numeric, Integer, Float, Fixnum class
2
+ ** @file mruby/numeric.h - Numeric, Integer, Float class
3
3
  **
4
4
  ** See Copyright Notice in mruby.h
5
5
  */
@@ -12,17 +12,17 @@
12
12
  /**
13
13
  * Numeric class and it's sub-classes.
14
14
  *
15
- * Integer, Float and Fixnum
15
+ * Integer and Float
16
16
  */
17
17
  MRB_BEGIN_DECL
18
18
 
19
- #define TYPED_POSFIXABLE(f,t) ((f) <= (t)MRB_INT_MAX)
20
- #define TYPED_NEGFIXABLE(f,t) ((f) >= (t)MRB_INT_MIN)
19
+ #define TYPED_POSFIXABLE(f,t) ((f) <= (t)MRB_FIXNUM_MAX)
20
+ #define TYPED_NEGFIXABLE(f,t) ((f) >= (t)MRB_FIXNUM_MIN)
21
21
  #define TYPED_FIXABLE(f,t) (TYPED_POSFIXABLE(f,t) && TYPED_NEGFIXABLE(f,t))
22
22
  #define POSFIXABLE(f) TYPED_POSFIXABLE(f,mrb_int)
23
23
  #define NEGFIXABLE(f) TYPED_NEGFIXABLE(f,mrb_int)
24
24
  #define FIXABLE(f) TYPED_FIXABLE(f,mrb_int)
25
- #ifndef MRB_WITHOUT_FLOAT
25
+ #ifndef MRB_NO_FLOAT
26
26
  #ifdef MRB_INT64
27
27
  #define FIXABLE_FLOAT(f) ((f)>=-9223372036854775808.0 && (f)<9223372036854775808.0)
28
28
  #else
@@ -30,16 +30,15 @@ MRB_BEGIN_DECL
30
30
  #endif
31
31
  #endif
32
32
 
33
- #ifndef MRB_WITHOUT_FLOAT
33
+ #ifndef MRB_NO_FLOAT
34
34
  MRB_API mrb_value mrb_flo_to_fixnum(mrb_state *mrb, mrb_value val);
35
35
  #endif
36
36
  MRB_API mrb_value mrb_fixnum_to_str(mrb_state *mrb, mrb_value x, mrb_int base);
37
37
  /* ArgumentError if format string doesn't match /%(\.[0-9]+)?[aAeEfFgG]/ */
38
- #ifndef MRB_WITHOUT_FLOAT
38
+ #ifndef MRB_NO_FLOAT
39
39
  MRB_API mrb_value mrb_float_to_str(mrb_state *mrb, mrb_value x, const char *fmt);
40
40
  MRB_API int mrb_float_to_cstr(mrb_state *mrb, char *buf, size_t len, const char *fmt, mrb_float f);
41
41
  MRB_API mrb_float mrb_to_flo(mrb_state *mrb, mrb_value x);
42
- MRB_API mrb_value mrb_int_value(mrb_state *mrb, mrb_float f);
43
42
  #endif
44
43
 
45
44
  MRB_API mrb_value mrb_num_plus(mrb_state *mrb, mrb_value x, mrb_value y);
@@ -71,103 +70,77 @@ MRB_API mrb_value mrb_num_mul(mrb_state *mrb, mrb_value x, mrb_value y);
71
70
 
72
71
  #ifdef MRB_HAVE_TYPE_GENERIC_CHECKED_ARITHMETIC_BUILTINS
73
72
 
74
- #ifndef MRB_WORD_BOXING
75
- # define WBCHK(x) 0
76
- #else
77
- # define WBCHK(x) !FIXABLE(x)
78
- #endif
79
-
80
73
  static inline mrb_bool
81
74
  mrb_int_add_overflow(mrb_int augend, mrb_int addend, mrb_int *sum)
82
75
  {
83
- return __builtin_add_overflow(augend, addend, sum) || WBCHK(*sum);
76
+ return __builtin_add_overflow(augend, addend, sum);
84
77
  }
85
78
 
86
79
  static inline mrb_bool
87
80
  mrb_int_sub_overflow(mrb_int minuend, mrb_int subtrahend, mrb_int *difference)
88
81
  {
89
- return __builtin_sub_overflow(minuend, subtrahend, difference) || WBCHK(*difference);
82
+ return __builtin_sub_overflow(minuend, subtrahend, difference);
90
83
  }
91
84
 
92
85
  static inline mrb_bool
93
86
  mrb_int_mul_overflow(mrb_int multiplier, mrb_int multiplicand, mrb_int *product)
94
87
  {
95
- return __builtin_mul_overflow(multiplier, multiplicand, product) || WBCHK(*product);
88
+ return __builtin_mul_overflow(multiplier, multiplicand, product);
96
89
  }
97
90
 
98
- #undef WBCHK
99
-
100
91
  #else
101
92
 
102
- #define MRB_UINT_MAKE2(n) uint ## n ## _t
103
- #define MRB_UINT_MAKE(n) MRB_UINT_MAKE2(n)
104
- #define mrb_uint MRB_UINT_MAKE(MRB_INT_BIT)
105
-
106
- #define MRB_INT_OVERFLOW_MASK ((mrb_uint)1 << (MRB_INT_BIT - 1 - MRB_FIXNUM_SHIFT))
93
+ #define MRB_INT_OVERFLOW_MASK ((mrb_uint)1 << (MRB_INT_BIT - 1))
107
94
 
108
95
  static inline mrb_bool
109
- mrb_int_add_overflow(mrb_int augend, mrb_int addend, mrb_int *sum)
96
+ mrb_int_add_overflow(mrb_int a, mrb_int b, mrb_int *c)
110
97
  {
111
- mrb_uint x = (mrb_uint)augend;
112
- mrb_uint y = (mrb_uint)addend;
98
+ mrb_uint x = (mrb_uint)a;
99
+ mrb_uint y = (mrb_uint)b;
113
100
  mrb_uint z = (mrb_uint)(x + y);
114
- *sum = (mrb_int)z;
101
+ *c = (mrb_int)z;
115
102
  return !!(((x ^ z) & (y ^ z)) & MRB_INT_OVERFLOW_MASK);
116
103
  }
117
104
 
118
105
  static inline mrb_bool
119
- mrb_int_sub_overflow(mrb_int minuend, mrb_int subtrahend, mrb_int *difference)
106
+ mrb_int_sub_overflow(mrb_int a, mrb_int b, mrb_int *c)
120
107
  {
121
- mrb_uint x = (mrb_uint)minuend;
122
- mrb_uint y = (mrb_uint)subtrahend;
108
+ mrb_uint x = (mrb_uint)a;
109
+ mrb_uint y = (mrb_uint)b;
123
110
  mrb_uint z = (mrb_uint)(x - y);
124
- *difference = (mrb_int)z;
111
+ *c = (mrb_int)z;
125
112
  return !!(((x ^ z) & (~y ^ z)) & MRB_INT_OVERFLOW_MASK);
126
113
  }
127
114
 
128
115
  static inline mrb_bool
129
- mrb_int_mul_overflow(mrb_int multiplier, mrb_int multiplicand, mrb_int *product)
116
+ mrb_int_mul_overflow(mrb_int a, mrb_int b, mrb_int *c)
130
117
  {
131
- #if MRB_INT_BIT == 32
132
- int64_t n = (int64_t)multiplier * multiplicand;
133
- *product = (mrb_int)n;
134
- return !FIXABLE(n);
135
- #else
136
- if (multiplier > 0) {
137
- if (multiplicand > 0) {
138
- if (multiplier > MRB_INT_MAX / multiplicand) return TRUE;
139
- }
140
- else {
141
- if (multiplicand < MRB_INT_MAX / multiplier) return TRUE;
142
- }
143
- }
144
- else {
145
- if (multiplicand > 0) {
146
- if (multiplier < MRB_INT_MAX / multiplicand) return TRUE;
147
- }
148
- else {
149
- if (multiplier != 0 && multiplicand < MRB_INT_MAX / multiplier) return TRUE;
150
- }
151
- }
152
- *product = multiplier * multiplicand;
118
+ #ifdef MRB_INT32
119
+ int64_t n = (int64_t)a * b;
120
+ *c = (mrb_int)n;
121
+ return n > MRB_INT_MAX || n < MRB_INT_MIN;
122
+ #else /* MRB_INT64 */
123
+ if (a > 0 && b > 0 && a > MRB_INT_MAX / b) return TRUE;
124
+ if (a < 0 && b > 0 && a < MRB_INT_MIN / b) return TRUE;
125
+ if (a > 0 && b < 0 && b < MRB_INT_MIN / a) return TRUE;
126
+ if (a < 0 && b < 0 && (a <= MRB_INT_MIN || b <= MRB_INT_MIN || -a > MRB_INT_MAX / -b))
127
+ return TRUE;
128
+ *c = a * b;
153
129
  return FALSE;
154
130
  #endif
155
131
  }
156
132
 
157
133
  #undef MRB_INT_OVERFLOW_MASK
158
- #undef mrb_uint
159
- #undef MRB_UINT_MAKE
160
- #undef MRB_UINT_MAKE2
161
134
 
162
135
  #endif
163
136
 
164
- #ifndef MRB_WITHOUT_FLOAT
137
+ #ifndef MRB_NO_FLOAT
165
138
  # include <stdint.h>
166
139
  # include <float.h>
167
140
 
168
141
  # define MRB_FLT_RADIX FLT_RADIX
169
142
 
170
- # ifdef MRB_USE_FLOAT
143
+ # ifdef MRB_USE_FLOAT32
171
144
  # define MRB_FLT_MANT_DIG FLT_MANT_DIG
172
145
  # define MRB_FLT_EPSILON FLT_EPSILON
173
146
  # define MRB_FLT_DIG FLT_DIG
@@ -178,7 +151,7 @@ mrb_int_mul_overflow(mrb_int multiplier, mrb_int multiplicand, mrb_int *product)
178
151
  # define MRB_FLT_MAX FLT_MAX
179
152
  # define MRB_FLT_MAX_10_EXP FLT_MAX_10_EXP
180
153
 
181
- # else /* not MRB_USE_FLOAT */
154
+ # else /* not MRB_USE_FLOAT32 */
182
155
  # define MRB_FLT_MANT_DIG DBL_MANT_DIG
183
156
  # define MRB_FLT_EPSILON DBL_EPSILON
184
157
  # define MRB_FLT_DIG DBL_DIG
@@ -188,8 +161,8 @@ mrb_int_mul_overflow(mrb_int multiplier, mrb_int multiplicand, mrb_int *product)
188
161
  # define MRB_FLT_MAX_EXP DBL_MAX_EXP
189
162
  # define MRB_FLT_MAX DBL_MAX
190
163
  # define MRB_FLT_MAX_10_EXP DBL_MAX_10_EXP
191
- # endif /* MRB_USE_FLOAT */
192
- #endif /* MRB_WITHOUT_FLOAT */
164
+ # endif /* MRB_USE_FLOAT32 */
165
+ #endif /* MRB_NO_FLOAT */
193
166
 
194
167
  MRB_END_DECL
195
168
 
@@ -36,34 +36,8 @@ enum mrb_insn {
36
36
  #define FETCH_BB() do {a=READ_B(); b=READ_B();} while (0)
37
37
  #define FETCH_BBB() do {a=READ_B(); b=READ_B(); c=READ_B();} while (0)
38
38
  #define FETCH_BS() do {a=READ_B(); b=READ_S();} while (0)
39
+ #define FETCH_BSS() do {a=READ_B(); b=READ_S(); c=READ_S();} while (0)
39
40
  #define FETCH_S() do {a=READ_S();} while (0)
40
41
  #define FETCH_W() do {a=READ_W();} while (0)
41
42
 
42
- /* with OP_EXT1 (1st 16bit) */
43
- #define FETCH_Z_1() FETCH_Z()
44
- #define FETCH_B_1() FETCH_S()
45
- #define FETCH_BB_1() do {a=READ_S(); b=READ_B();} while (0)
46
- #define FETCH_BBB_1() do {a=READ_S(); b=READ_B(); c=READ_B();} while (0)
47
- #define FETCH_BS_1() do {a=READ_S(); b=READ_S();} while (0)
48
- #define FETCH_S_1() FETCH_S()
49
- #define FETCH_W_1() FETCH_W()
50
-
51
- /* with OP_EXT2 (2nd 16bit) */
52
- #define FETCH_Z_2() FETCH_Z()
53
- #define FETCH_B_2() FETCH_B()
54
- #define FETCH_BB_2() do {a=READ_B(); b=READ_S();} while (0)
55
- #define FETCH_BBB_2() do {a=READ_B(); b=READ_S(); c=READ_B();} while (0)
56
- #define FETCH_BS_2() FETCH_BS()
57
- #define FETCH_S_2() FETCH_S()
58
- #define FETCH_W_2() FETCH_W()
59
-
60
- /* with OP_EXT3 (1st & 2nd 16bit) */
61
- #define FETCH_Z_3() FETCH_Z()
62
- #define FETCH_B_3() FETCH_B()
63
- #define FETCH_BB_3() do {a=READ_S(); b=READ_S();} while (0)
64
- #define FETCH_BBB_3() do {a=READ_S(); b=READ_S(); c=READ_B();} while (0)
65
- #define FETCH_BS_3() do {a=READ_S(); b=READ_S();} while (0)
66
- #define FETCH_S_3() FETCH_S()
67
- #define FETCH_W_3() FETCH_W()
68
-
69
43
  #endif /* MRUBY_OPCODE_H */
@@ -1,11 +1,12 @@
1
1
  /* operand types:
2
- + Z: no operand (Z,Z,Z,Z)
3
- + B: 8bit (B,S,B,B)
4
- + BB: 8+8bit (BB,SB,BS,SS)
5
- + BBB: 8+8+8bit (BBB,SBB,BSB,SSB)
6
- + BS: 8+16bit (BS,SS,BS,BS)
7
- + S: 16bit (S,S,S,S)
8
- + W: 24bit (W,W,W,W)
2
+ + Z: no operand
3
+ + B: 8bit
4
+ + BB: 8+8bit
5
+ + BBB: 8+8+8bit
6
+ + BS: 8+16bit
7
+ + BSS: 8+16+16bit
8
+ + S: 16bit
9
+ + W: 24bit
9
10
  */
10
11
 
11
12
  /*-----------------------------------------------------------------------
@@ -14,6 +15,7 @@ operation code operands semantics
14
15
  OPCODE(NOP, Z) /* no operation */
15
16
  OPCODE(MOVE, BB) /* R(a) = R(b) */
16
17
  OPCODE(LOADL, BB) /* R(a) = Pool(b) */
18
+ OPCODE(LOADL16, BS) /* R(a) = Pool(b) */
17
19
  OPCODE(LOADI, BB) /* R(a) = mrb_int(b) */
18
20
  OPCODE(LOADINEG, BB) /* R(a) = mrb_int(-b) */
19
21
  OPCODE(LOADI__1, B) /* R(a) = mrb_int(-1) */
@@ -25,7 +27,10 @@ OPCODE(LOADI_4, B) /* R(a) = mrb_int(4) */
25
27
  OPCODE(LOADI_5, B) /* R(a) = mrb_int(5) */
26
28
  OPCODE(LOADI_6, B) /* R(a) = mrb_int(6) */
27
29
  OPCODE(LOADI_7, B) /* R(a) = mrb_int(7) */
30
+ OPCODE(LOADI16, BS) /* R(a) = mrb_int(b) */
31
+ OPCODE(LOADI32, BSS) /* R(a) = mrb_int((b<<16)+c) */
28
32
  OPCODE(LOADSYM, BB) /* R(a) = Syms(b) */
33
+ OPCODE(LOADSYM16, BS) /* R(a) = Syms(b) */
29
34
  OPCODE(LOADNIL, B) /* R(a) = nil */
30
35
  OPCODE(LOADSELF, B) /* R(a) = self */
31
36
  OPCODE(LOADT, B) /* R(a) = true */
@@ -44,28 +49,26 @@ OPCODE(GETMCNST, BB) /* R(a) = R(a)::Syms(b) */
44
49
  OPCODE(SETMCNST, BB) /* R(a+1)::Syms(b) = R(a) */
45
50
  OPCODE(GETUPVAR, BBB) /* R(a) = uvget(b,c) */
46
51
  OPCODE(SETUPVAR, BBB) /* uvset(b,c,R(a)) */
47
- OPCODE(JMP, S) /* pc=a */
48
- OPCODE(JMPIF, BS) /* if R(a) pc=b */
49
- OPCODE(JMPNOT, BS) /* if !R(a) pc=b */
50
- OPCODE(JMPNIL, BS) /* if R(a)==nil pc=b */
51
- OPCODE(ONERR, S) /* rescue_push(a) */
52
+ OPCODE(JMP, S) /* pc+=a */
53
+ OPCODE(JMPIF, BS) /* if R(a) pc+=b */
54
+ OPCODE(JMPNOT, BS) /* if !R(a) pc+=b */
55
+ OPCODE(JMPNIL, BS) /* if R(a)==nil pc+=b */
56
+ OPCODE(JMPUW, S) /* unwind_and_jump_to(a) */
52
57
  OPCODE(EXCEPT, B) /* R(a) = exc */
53
58
  OPCODE(RESCUE, BB) /* R(b) = R(a).isa?(R(b)) */
54
- OPCODE(POPERR, B) /* a.times{rescue_pop()} */
55
- OPCODE(RAISE, B) /* raise(R(a)) */
56
- OPCODE(EPUSH, B) /* ensure_push(SEQ[a]) */
57
- OPCODE(EPOP, B) /* A.times{ensure_pop().call} */
59
+ OPCODE(RAISEIF, B) /* raise(R(a)) if R(a) */
58
60
  OPCODE(SENDV, BB) /* R(a) = call(R(a),Syms(b),*R(a+1)) */
59
61
  OPCODE(SENDVB, BB) /* R(a) = call(R(a),Syms(b),*R(a+1),&R(a+2)) */
60
62
  OPCODE(SEND, BBB) /* R(a) = call(R(a),Syms(b),R(a+1),...,R(a+c)) */
61
63
  OPCODE(SENDB, BBB) /* R(a) = call(R(a),Syms(b),R(a+1),...,R(a+c),&R(a+c+1)) */
64
+ OPCODE(SENDVK, BB) /* R(a) = call(R(a),Syms(b),*R(a+1),**(a+2),&R(a+3)) # todo */
62
65
  OPCODE(CALL, Z) /* R(0) = self.call(frame.argc, frame.argv) */
63
66
  OPCODE(SUPER, BB) /* R(a) = super(R(a+1),... ,R(a+b+1)) */
64
67
  OPCODE(ARGARY, BS) /* R(a) = argument array (16=m5:r1:m5:d1:lv4) */
65
68
  OPCODE(ENTER, W) /* arg setup according to flags (23=m5:o5:r1:m5:k5:d1:b1) */
66
- OPCODE(KEY_P, BB) /* R(a) = kdict.key?(Syms(b)) # todo */
67
- OPCODE(KEYEND, Z) /* raise unless kdict.empty? # todo */
68
- OPCODE(KARG, BB) /* R(a) = kdict[Syms(b)]; kdict.delete(Syms(b)) # todo */
69
+ OPCODE(KEY_P, BB) /* R(a) = kdict.key?(Syms(b)) */
70
+ OPCODE(KEYEND, Z) /* raise unless kdict.empty? */
71
+ OPCODE(KARG, BB) /* R(a) = kdict[Syms(b)]; kdict.delete(Syms(b)) */
69
72
  OPCODE(RETURN, B) /* return R(a) (normal) */
70
73
  OPCODE(RETURN_BLK, B) /* return R(a) (in-block return) */
71
74
  OPCODE(BREAK, B) /* break R(a) */
@@ -91,19 +94,24 @@ OPCODE(ASET, BBB) /* R(a)[c] = R(b) */
91
94
  OPCODE(APOST, BBB) /* *R(a),R(a+1)..R(a+c) = R(a)[b..] */
92
95
  OPCODE(INTERN, B) /* R(a) = intern(R(a)) */
93
96
  OPCODE(STRING, BB) /* R(a) = str_dup(Lit(b)) */
97
+ OPCODE(STRING16, BS) /* R(a) = str_dup(Lit(b)) */
94
98
  OPCODE(STRCAT, B) /* str_cat(R(a),R(a+1)) */
95
99
  OPCODE(HASH, BB) /* R(a) = hash_new(R(a),R(a+1)..R(a+b*2-1)) */
96
100
  OPCODE(HASHADD, BB) /* R(a) = hash_push(R(a),R(a+1)..R(a+b*2)) */
97
101
  OPCODE(HASHCAT, B) /* R(a) = hash_cat(R(a),R(a+1)) */
98
102
  OPCODE(LAMBDA, BB) /* R(a) = lambda(SEQ[b],L_LAMBDA) */
103
+ OPCODE(LAMBDA16, BS) /* R(a) = lambda(SEQ[b],L_LAMBDA) */
99
104
  OPCODE(BLOCK, BB) /* R(a) = lambda(SEQ[b],L_BLOCK) */
105
+ OPCODE(BLOCK16, BS) /* R(a) = lambda(SEQ[b],L_BLOCK) */
100
106
  OPCODE(METHOD, BB) /* R(a) = lambda(SEQ[b],L_METHOD) */
107
+ OPCODE(METHOD16, BS) /* R(a) = lambda(SEQ[b],L_METHOD) */
101
108
  OPCODE(RANGE_INC, B) /* R(a) = range_new(R(a),R(a+1),FALSE) */
102
109
  OPCODE(RANGE_EXC, B) /* R(a) = range_new(R(a),R(a+1),TRUE) */
103
110
  OPCODE(OCLASS, B) /* R(a) = ::Object */
104
111
  OPCODE(CLASS, BB) /* R(a) = newclass(R(a),Syms(b),R(a+1)) */
105
112
  OPCODE(MODULE, BB) /* R(a) = newmodule(R(a),Syms(b)) */
106
113
  OPCODE(EXEC, BB) /* R(a) = blockexec(R(a),SEQ[b]) */
114
+ OPCODE(EXEC16, BS) /* R(a) = blockexec(R(a),SEQ[b]) */
107
115
  OPCODE(DEF, BB) /* R(a).newmethod(Syms(b),R(a+1)) */
108
116
  OPCODE(ALIAS, BB) /* alias_method(target_class,Syms(a),Syms(b)) */
109
117
  OPCODE(UNDEF, B) /* undef_method(target_class,Syms(a)) */
@@ -111,8 +119,4 @@ OPCODE(SCLASS, B) /* R(a) = R(a).singleton_class */
111
119
  OPCODE(TCLASS, B) /* R(a) = target_class */
112
120
  OPCODE(DEBUG, BBB) /* print a,b,c */
113
121
  OPCODE(ERR, B) /* raise(LocalJumpError, Lit(a)) */
114
- OPCODE(EXT1, Z) /* make 1st operand 16bit */
115
- OPCODE(EXT2, Z) /* make 2nd operand 16bit */
116
- OPCODE(EXT3, Z) /* make 1st and 2nd operands 16bit */
117
122
  OPCODE(STOP, Z) /* stop VM */
118
- OPCODE(LOADI16, BS) /* R(a) = mrb_int(b) */