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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +2 -2
- data/ext/enterprise_script_service/Rakefile +1 -1
- data/ext/enterprise_script_service/mruby/.github/workflows/build.yml +117 -74
- data/ext/enterprise_script_service/mruby/.github/workflows/codeql-analysis.yml +41 -37
- data/ext/enterprise_script_service/mruby/.github/workflows/lint.yml +23 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/oss-fuzz.yml +27 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/spell-checker.yml +17 -0
- data/ext/enterprise_script_service/mruby/.gitlab-ci.yml +3 -3
- data/ext/enterprise_script_service/mruby/.markdownlint.yml +16 -0
- data/ext/enterprise_script_service/mruby/.travis.yml +2 -2
- data/ext/enterprise_script_service/mruby/.yamllint +8 -0
- data/ext/enterprise_script_service/mruby/AUTHORS +3 -0
- data/ext/enterprise_script_service/mruby/CODEOWNERS +1 -0
- data/ext/enterprise_script_service/mruby/CONTRIBUTING.md +6 -13
- data/ext/enterprise_script_service/mruby/Doxyfile +4 -4
- data/ext/enterprise_script_service/mruby/LICENSE +1 -1
- data/ext/enterprise_script_service/mruby/Makefile +1 -1
- data/ext/enterprise_script_service/mruby/README.md +4 -14
- data/ext/enterprise_script_service/mruby/Rakefile +18 -108
- data/ext/enterprise_script_service/mruby/TODO.md +17 -0
- data/ext/enterprise_script_service/mruby/appveyor.yml +31 -25
- data/ext/enterprise_script_service/mruby/benchmark/bm_ao_render.rb +1 -1
- data/ext/enterprise_script_service/mruby/build_config.rb +9 -152
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_ArduinoDue.rb → build_config/ArduinoDue.rb} +2 -19
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_IntelEdison.rb → build_config/IntelEdison.rb} +2 -2
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_IntelGalileo.rb → build_config/IntelGalileo.rb} +1 -18
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_RX630.rb → build_config/RX630.rb} +2 -19
- data/ext/enterprise_script_service/mruby/build_config/android_arm64-v8a.rb +11 -0
- data/ext/enterprise_script_service/mruby/build_config/android_armeabi.rb +11 -0
- 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
- data/ext/enterprise_script_service/mruby/build_config/bench.rb +11 -0
- data/ext/enterprise_script_service/mruby/build_config/boxing.rb +21 -0
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_chipKITMax32.rb → build_config/chipKITMax32.rb} +2 -19
- data/ext/enterprise_script_service/mruby/{travis_config.rb → build_config/ci/gcc-clang.rb} +10 -10
- data/ext/enterprise_script_service/mruby/build_config/ci/msvc.rb +20 -0
- data/ext/enterprise_script_service/mruby/build_config/clang-asan.rb +11 -0
- data/ext/enterprise_script_service/mruby/build_config/cross-32bit.rb +14 -0
- data/ext/enterprise_script_service/mruby/build_config/default.rb +80 -0
- data/ext/enterprise_script_service/mruby/{examples/targets/build_config_dreamcast_shelf.rb → build_config/dreamcast_shelf.rb} +5 -19
- data/ext/enterprise_script_service/mruby/build_config/gameboyadvance.rb +73 -0
- data/ext/enterprise_script_service/mruby/build_config/host-cxx.rb +12 -0
- data/ext/enterprise_script_service/mruby/build_config/host-debug.rb +20 -0
- data/ext/enterprise_script_service/mruby/build_config/host-gprof.rb +14 -0
- data/ext/enterprise_script_service/mruby/build_config/host-m32.rb +15 -0
- data/ext/enterprise_script_service/mruby/build_config/host-shared.rb +36 -0
- data/ext/enterprise_script_service/mruby/build_config/mrbc.rb +11 -0
- data/ext/enterprise_script_service/mruby/build_config/no-float.rb +17 -0
- data/ext/enterprise_script_service/mruby/doc/guides/compile.md +138 -49
- data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +5 -4
- data/ext/enterprise_script_service/mruby/doc/guides/gc-arena-howto.md +1 -1
- data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +49 -22
- data/ext/enterprise_script_service/mruby/doc/guides/mrbgems.md +31 -14
- data/ext/enterprise_script_service/mruby/doc/guides/symbol.md +83 -0
- data/ext/enterprise_script_service/mruby/doc/limitations.md +35 -36
- data/ext/enterprise_script_service/mruby/doc/mruby3.md +163 -0
- data/ext/enterprise_script_service/mruby/doc/opcode.md +93 -107
- data/ext/enterprise_script_service/mruby/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb +1 -1
- data/ext/enterprise_script_service/mruby/examples/mrbgems/c_and_ruby_extension_example/src/example.c +5 -1
- data/ext/enterprise_script_service/mruby/examples/mrbgems/c_extension_example/src/example.c +5 -1
- data/ext/enterprise_script_service/mruby/examples/mrbgems/ruby_extension_example/mrblib/example.rb +1 -1
- data/ext/enterprise_script_service/mruby/include/mrbconf.h +81 -62
- data/ext/enterprise_script_service/mruby/include/mruby.h +137 -96
- data/ext/enterprise_script_service/mruby/include/mruby/array.h +23 -6
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +73 -48
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_no.h +8 -8
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +79 -48
- data/ext/enterprise_script_service/mruby/include/mruby/class.h +10 -8
- data/ext/enterprise_script_service/mruby/include/mruby/common.h +4 -1
- data/ext/enterprise_script_service/mruby/include/mruby/compile.h +13 -7
- data/ext/enterprise_script_service/mruby/include/mruby/debug.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/dump.h +17 -35
- data/ext/enterprise_script_service/mruby/include/mruby/endian.h +44 -0
- data/ext/enterprise_script_service/mruby/include/mruby/error.h +39 -5
- data/ext/enterprise_script_service/mruby/include/mruby/gc.h +1 -0
- data/ext/enterprise_script_service/mruby/include/mruby/hash.h +33 -13
- data/ext/enterprise_script_service/mruby/include/mruby/irep.h +64 -14
- data/ext/enterprise_script_service/mruby/include/mruby/khash.h +6 -14
- data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +36 -63
- data/ext/enterprise_script_service/mruby/include/mruby/opcode.h +1 -27
- data/ext/enterprise_script_service/mruby/include/mruby/ops.h +27 -23
- data/ext/enterprise_script_service/mruby/include/mruby/presym.h +40 -0
- data/ext/enterprise_script_service/mruby/include/mruby/presym/disable.h +70 -0
- data/ext/enterprise_script_service/mruby/include/mruby/presym/enable.h +37 -0
- data/ext/enterprise_script_service/mruby/include/mruby/presym/scanning.h +73 -0
- data/ext/enterprise_script_service/mruby/include/mruby/proc.h +80 -13
- data/ext/enterprise_script_service/mruby/include/mruby/string.h +10 -15
- data/ext/enterprise_script_service/mruby/include/mruby/throw.h +14 -3
- data/ext/enterprise_script_service/mruby/include/mruby/value.h +29 -19
- data/ext/enterprise_script_service/mruby/include/mruby/variable.h +1 -0
- data/ext/enterprise_script_service/mruby/include/mruby/version.h +26 -7
- data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +198 -44
- data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +55 -37
- data/ext/enterprise_script_service/mruby/lib/mruby/build/load_gems.rb +12 -10
- data/ext/enterprise_script_service/mruby/lib/{mruby-core-ext.rb → mruby/core_ext.rb} +10 -3
- data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +75 -32
- data/ext/enterprise_script_service/mruby/lib/mruby/lockfile.rb +1 -1
- data/ext/enterprise_script_service/mruby/lib/mruby/presym.rb +132 -0
- data/ext/enterprise_script_service/mruby/mrbgems/default-no-fpu.gembox +3 -0
- data/ext/enterprise_script_service/mruby/mrbgems/default-no-stdio.gembox +4 -0
- data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +9 -88
- data/ext/enterprise_script_service/mruby/mrbgems/full-core.gembox +1 -4
- data/ext/enterprise_script_service/mruby/mrbgems/math.gembox +10 -0
- data/ext/enterprise_script_service/mruby/mrbgems/metaprog.gembox +15 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +5 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-config/mrbgem.rake +28 -19
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-config/mruby-config +18 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/bintest/mrdb.rb +3 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/bintest/print.rb +10 -10
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +14 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +3 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +4 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +2 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/bintest/mirb.rb +23 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/mrbgem.rake +11 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +41 -34
- data/ext/enterprise_script_service/mruby/mrbgems/{mruby-compiler → mruby-bin-mrbc}/bintest/mrbc.rb +0 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/mrbgem.rake +3 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +19 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +25 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +22 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/bintest/mruby-strip.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-catch/mrbgem.rake +5 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-catch/mrblib/catch.rb +27 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +2 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +430 -399
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/keywords +5 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/lex.def +49 -44
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +559 -217
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/y.tab.c +4774 -4193
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/mrbgem.rake +18 -19
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +8 -7
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/test/complex.rb +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +1 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/mrbgem.rake +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +17 -25
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +18 -13
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +30 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/test/hash.rb +7 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-inline-struct/test/inline.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/README.md +18 -16
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/include/mruby/ext/io.h +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file.rb +9 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +55 -52
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +4 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +99 -87
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +2 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +2 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +7 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/src/math.c +13 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/test/math.rb +5 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +43 -58
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/README.md +4 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +77 -74
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/test/method.rb +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +14 -13
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +5 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +18 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/mrbgem.rake +10 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/src/memsize.c +231 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-os-memsize/test/memsize.rb +63 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/README.md +15 -18
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +38 -88
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/mrblib/print.rb +1 -30
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/src/print.c +62 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +32 -19
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/test/proc.c +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.c +98 -43
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/test/random.rb +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/mrblib/range.rb +39 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +20 -40
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/test/range.rb +27 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +11 -17
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +216 -38
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/test/rational.rb +6 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/README.md +6 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/src/mrb_sleep.c +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/README.md +3 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/src/socket.c +47 -45
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +102 -71
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/test/sprintf.rb +4 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +23 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +13 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/mrblib/struct.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +18 -25
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +6 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/README.md +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/driver.c +5 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +16 -44
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/vformat.c +4 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +27 -27
- data/ext/enterprise_script_service/mruby/mrbgems/stdlib-ext.gembox +18 -0
- data/ext/enterprise_script_service/mruby/mrbgems/stdlib-io.gembox +12 -0
- data/ext/enterprise_script_service/mruby/mrbgems/stdlib.gembox +54 -0
- data/ext/enterprise_script_service/mruby/mrblib/10error.rb +4 -0
- data/ext/enterprise_script_service/mruby/mrblib/array.rb +17 -9
- data/ext/enterprise_script_service/mruby/mrblib/enum.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrblib/hash.rb +0 -20
- data/ext/enterprise_script_service/mruby/mrblib/init_mrblib.c +0 -11
- data/ext/enterprise_script_service/mruby/mrblib/numeric.rb +36 -11
- data/ext/enterprise_script_service/mruby/mrblib/range.rb +25 -3
- data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_proto_fuzzer.cpp +2 -2
- data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.h +1 -1
- data/ext/enterprise_script_service/mruby/src/array.c +43 -80
- data/ext/enterprise_script_service/mruby/src/backtrace.c +16 -17
- data/ext/enterprise_script_service/mruby/src/class.c +774 -182
- data/ext/enterprise_script_service/mruby/src/codedump.c +223 -198
- data/ext/enterprise_script_service/mruby/src/debug.c +6 -6
- data/ext/enterprise_script_service/mruby/src/dump.c +466 -141
- data/ext/enterprise_script_service/mruby/src/enum.c +1 -1
- data/ext/enterprise_script_service/mruby/src/error.c +36 -13
- data/ext/enterprise_script_service/mruby/src/etc.c +43 -34
- data/ext/enterprise_script_service/mruby/src/fmt_fp.c +5 -6
- data/ext/enterprise_script_service/mruby/src/gc.c +73 -71
- data/ext/enterprise_script_service/mruby/src/hash.c +1050 -707
- data/ext/enterprise_script_service/mruby/src/kernel.c +75 -220
- data/ext/enterprise_script_service/mruby/src/load.c +196 -166
- data/ext/enterprise_script_service/mruby/src/numeric.c +352 -314
- data/ext/enterprise_script_service/mruby/src/object.c +97 -90
- data/ext/enterprise_script_service/mruby/src/print.c +4 -3
- data/ext/enterprise_script_service/mruby/src/proc.c +48 -56
- data/ext/enterprise_script_service/mruby/src/range.c +45 -21
- data/ext/enterprise_script_service/mruby/src/state.c +25 -32
- data/ext/enterprise_script_service/mruby/src/string.c +59 -101
- data/ext/enterprise_script_service/mruby/src/symbol.c +121 -56
- data/ext/enterprise_script_service/mruby/src/value_array.h +1 -0
- data/ext/enterprise_script_service/mruby/src/variable.c +158 -158
- data/ext/enterprise_script_service/mruby/src/vm.c +617 -602
- data/ext/enterprise_script_service/mruby/tasks/benchmark.rake +6 -6
- data/ext/enterprise_script_service/mruby/tasks/bin.rake +23 -0
- data/ext/enterprise_script_service/mruby/tasks/core.rake +12 -0
- data/ext/enterprise_script_service/mruby/tasks/doc.rake +50 -38
- data/ext/enterprise_script_service/mruby/tasks/gitlab.rake +83 -77
- data/ext/enterprise_script_service/mruby/tasks/libmruby.rake +10 -1
- data/ext/enterprise_script_service/mruby/tasks/mrbgems.rake +13 -1
- data/ext/enterprise_script_service/mruby/tasks/mrblib.rake +40 -0
- data/ext/enterprise_script_service/mruby/tasks/presym.rake +44 -0
- data/ext/enterprise_script_service/mruby/tasks/test.rake +68 -0
- data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +6 -5
- data/ext/enterprise_script_service/mruby/tasks/toolchains/openwrt.rake +10 -14
- data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +17 -21
- data/ext/enterprise_script_service/mruby/test/bintest.rb +5 -5
- data/ext/enterprise_script_service/mruby/test/t/argumenterror.rb +16 -0
- data/ext/enterprise_script_service/mruby/test/t/array.rb +7 -3
- data/ext/enterprise_script_service/mruby/test/t/bs_literal.rb +1 -1
- data/ext/enterprise_script_service/mruby/test/t/float.rb +18 -8
- data/ext/enterprise_script_service/mruby/test/t/hash.rb +903 -281
- data/ext/enterprise_script_service/mruby/test/t/integer.rb +10 -38
- data/ext/enterprise_script_service/mruby/test/t/kernel.rb +1 -1
- data/ext/enterprise_script_service/mruby/test/t/literals.rb +50 -0
- data/ext/enterprise_script_service/mruby/test/t/module.rb +2 -2
- data/ext/enterprise_script_service/mruby/test/t/numeric.rb +1 -1
- data/ext/enterprise_script_service/mruby/test/t/range.rb +83 -1
- data/ext/enterprise_script_service/mruby/test/t/string.rb +4 -0
- data/ext/enterprise_script_service/mruby/test/t/superclass.rb +10 -10
- data/ext/enterprise_script_service/mruby/test/t/syntax.rb +24 -0
- data/ext/enterprise_script_service/mruby/test/t/vformat.rb +3 -3
- data/ext/enterprise_script_service/mruby_config.rb +2 -5
- data/ext/enterprise_script_service/mruby_engine.cpp +1 -1
- data/lib/script_core/version.rb +1 -1
- data/spec/script_core_spec.rb +13 -0
- metadata +61 -23
- data/ext/enterprise_script_service/mruby/.github/workflows/main.yml +0 -24
- data/ext/enterprise_script_service/mruby/TODO +0 -8
- data/ext/enterprise_script_service/mruby/appveyor_config.rb +0 -46
- data/ext/enterprise_script_service/mruby/benchmark/build_config_boxing.rb +0 -28
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_android_arm64-v8a.rb +0 -26
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_android_armeabi.rb +0 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/kernel.c +0 -30
- data/ext/enterprise_script_service/mruby/mrblib/mrblib.rake +0 -18
- data/ext/enterprise_script_service/mruby/src/crc.c +0 -39
- data/ext/enterprise_script_service/mruby/src/mruby_core.rake +0 -19
@@ -16,6 +16,7 @@
|
|
16
16
|
#include <mruby/error.h>
|
17
17
|
#include <mruby/class.h>
|
18
18
|
#include <mruby/throw.h>
|
19
|
+
#include <mruby/presym.h>
|
19
20
|
|
20
21
|
MRB_API mrb_value
|
21
22
|
mrb_exc_new(mrb_state *mrb, struct RClass *c, const char *ptr, size_t len)
|
@@ -45,7 +46,7 @@ exc_initialize(mrb_state *mrb, mrb_value exc)
|
|
45
46
|
mrb_value mesg;
|
46
47
|
|
47
48
|
if (mrb_get_args(mrb, "|o", &mesg) == 1) {
|
48
|
-
mrb_iv_set(mrb, exc,
|
49
|
+
mrb_iv_set(mrb, exc, MRB_SYM(mesg), mesg);
|
49
50
|
}
|
50
51
|
return exc;
|
51
52
|
}
|
@@ -74,7 +75,7 @@ exc_exception(mrb_state *mrb, mrb_value self)
|
|
74
75
|
if (argc == 0) return self;
|
75
76
|
if (mrb_obj_equal(mrb, self, a)) return self;
|
76
77
|
exc = mrb_obj_clone(mrb, self);
|
77
|
-
mrb_iv_set(mrb, exc,
|
78
|
+
mrb_iv_set(mrb, exc, MRB_SYM(mesg), a);
|
78
79
|
|
79
80
|
return exc;
|
80
81
|
}
|
@@ -90,7 +91,7 @@ exc_exception(mrb_state *mrb, mrb_value self)
|
|
90
91
|
mrb_value
|
91
92
|
exc_to_s(mrb_state *mrb, mrb_value exc)
|
92
93
|
{
|
93
|
-
mrb_value mesg = mrb_attr_get(mrb, exc,
|
94
|
+
mrb_value mesg = mrb_attr_get(mrb, exc, MRB_SYM(mesg));
|
94
95
|
struct RObject *p;
|
95
96
|
|
96
97
|
if (!mrb_string_p(mesg)) {
|
@@ -114,7 +115,7 @@ exc_to_s(mrb_state *mrb, mrb_value exc)
|
|
114
115
|
static mrb_value
|
115
116
|
exc_message(mrb_state *mrb, mrb_value exc)
|
116
117
|
{
|
117
|
-
return
|
118
|
+
return mrb_funcall_id(mrb, exc, MRB_SYM(to_s), 0);
|
118
119
|
}
|
119
120
|
|
120
121
|
/*
|
@@ -130,7 +131,7 @@ exc_message(mrb_state *mrb, mrb_value exc)
|
|
130
131
|
mrb_value
|
131
132
|
mrb_exc_inspect(mrb_state *mrb, mrb_value exc)
|
132
133
|
{
|
133
|
-
mrb_value mesg = mrb_attr_get(mrb, exc,
|
134
|
+
mrb_value mesg = mrb_attr_get(mrb, exc, MRB_SYM(mesg));
|
134
135
|
mrb_value cname = mrb_mod_to_s(mrb, mrb_obj_value(mrb_obj_class(mrb, exc)));
|
135
136
|
mesg = mrb_obj_as_string(mrb, mesg);
|
136
137
|
return RSTRING_LEN(mesg) == 0 ? cname : mrb_format(mrb, "%v (%v)", mesg, cname);
|
@@ -154,7 +155,7 @@ set_backtrace(mrb_state *mrb, mrb_value exc, mrb_value backtrace)
|
|
154
155
|
p++;
|
155
156
|
}
|
156
157
|
}
|
157
|
-
mrb_iv_set(mrb, exc,
|
158
|
+
mrb_iv_set(mrb, exc, MRB_SYM(backtrace), backtrace);
|
158
159
|
}
|
159
160
|
|
160
161
|
static mrb_value
|
@@ -288,7 +289,7 @@ mrb_vformat(mrb_state *mrb, const char *format, va_list ap)
|
|
288
289
|
#endif
|
289
290
|
obj = mrb_fixnum_value(i);
|
290
291
|
goto L_cat_obj;
|
291
|
-
#ifndef
|
292
|
+
#ifndef MRB_NO_FLOAT
|
292
293
|
case 'f':
|
293
294
|
obj = mrb_float_value(mrb, (mrb_float)va_arg(ap, double));
|
294
295
|
goto L_cat_obj;
|
@@ -420,7 +421,7 @@ mrb_name_error(mrb_state *mrb, mrb_sym id, const char *fmt, ...)
|
|
420
421
|
MRB_API void
|
421
422
|
mrb_warn(mrb_state *mrb, const char *fmt, ...)
|
422
423
|
{
|
423
|
-
#ifndef
|
424
|
+
#ifndef MRB_NO_STDIO
|
424
425
|
va_list ap;
|
425
426
|
mrb_value str;
|
426
427
|
|
@@ -436,7 +437,7 @@ mrb_warn(mrb_state *mrb, const char *fmt, ...)
|
|
436
437
|
MRB_API mrb_noreturn void
|
437
438
|
mrb_bug(mrb_state *mrb, const char *fmt, ...)
|
438
439
|
{
|
439
|
-
#ifndef
|
440
|
+
#ifndef MRB_NO_STDIO
|
440
441
|
va_list ap;
|
441
442
|
mrb_value str;
|
442
443
|
|
@@ -474,7 +475,7 @@ mrb_make_exception(mrb_state *mrb, mrb_int argc, const mrb_value *argv)
|
|
474
475
|
n = 1;
|
475
476
|
exception_call:
|
476
477
|
{
|
477
|
-
mrb_sym exc =
|
478
|
+
mrb_sym exc = MRB_SYM(exception);
|
478
479
|
if (mrb_respond_to(mrb, argv[0], exc)) {
|
479
480
|
mesg = mrb_funcall_argv(mrb, argv[0], exc, n, argv+1);
|
480
481
|
}
|
@@ -590,6 +591,28 @@ mrb_core_init_abort(mrb_state *mrb)
|
|
590
591
|
exc_throw(mrb, mrb_nil_value());
|
591
592
|
}
|
592
593
|
|
594
|
+
void
|
595
|
+
mrb_protect_atexit(mrb_state *mrb)
|
596
|
+
{
|
597
|
+
if (mrb->atexit_stack_len > 0) {
|
598
|
+
struct mrb_jmpbuf *prev_jmp = mrb->jmp;
|
599
|
+
struct mrb_jmpbuf c_jmp;
|
600
|
+
for (int i = mrb->atexit_stack_len; i > 0; --i) {
|
601
|
+
MRB_TRY(&c_jmp) {
|
602
|
+
mrb->jmp = &c_jmp;
|
603
|
+
mrb->atexit_stack[i - 1](mrb);
|
604
|
+
mrb->jmp = prev_jmp;
|
605
|
+
} MRB_CATCH(&c_jmp) {
|
606
|
+
/* ignore atexit errors */
|
607
|
+
} MRB_END_EXC(&c_jmp);
|
608
|
+
}
|
609
|
+
#ifndef MRB_FIXED_STATE_ATEXIT_STACK
|
610
|
+
mrb_free(mrb, mrb->atexit_stack);
|
611
|
+
#endif
|
612
|
+
mrb->jmp = prev_jmp;
|
613
|
+
}
|
614
|
+
}
|
615
|
+
|
593
616
|
mrb_noreturn void
|
594
617
|
mrb_raise_nomemory(mrb_state *mrb)
|
595
618
|
{
|
@@ -622,11 +645,11 @@ mrb_init_exception(mrb_state *mrb)
|
|
622
645
|
script_error = mrb_define_class(mrb, "ScriptError", mrb->eException_class); /* 15.2.37 */
|
623
646
|
mrb_define_class(mrb, "SyntaxError", script_error); /* 15.2.38 */
|
624
647
|
stack_error = mrb_define_class(mrb, "SystemStackError", exception);
|
625
|
-
mrb->stack_err = mrb_obj_ptr(
|
648
|
+
mrb->stack_err = mrb_obj_ptr(mrb_exc_new_lit(mrb, stack_error, "stack level too deep"));
|
626
649
|
|
627
650
|
nomem_error = mrb_define_class(mrb, "NoMemoryError", exception);
|
628
|
-
mrb->nomem_err = mrb_obj_ptr(
|
651
|
+
mrb->nomem_err = mrb_obj_ptr(mrb_exc_new_lit(mrb, nomem_error, "Out of memory"));
|
629
652
|
#ifdef MRB_GC_FIXED_ARENA
|
630
|
-
mrb->arena_err = mrb_obj_ptr(
|
653
|
+
mrb->arena_err = mrb_obj_ptr(mrb_exc_new_lit(mrb, nomem_error, "arena overflow error"));
|
631
654
|
#endif
|
632
655
|
}
|
@@ -8,6 +8,7 @@
|
|
8
8
|
#include <mruby/string.h>
|
9
9
|
#include <mruby/data.h>
|
10
10
|
#include <mruby/class.h>
|
11
|
+
#include <mruby/numeric.h>
|
11
12
|
|
12
13
|
MRB_API struct RData*
|
13
14
|
mrb_data_object_alloc(mrb_state *mrb, struct RClass *klass, void *ptr, const mrb_data_type *type)
|
@@ -69,21 +70,11 @@ mrb_obj_to_sym(mrb_state *mrb, mrb_value name)
|
|
69
70
|
return 0; /* not reached */
|
70
71
|
}
|
71
72
|
|
72
|
-
|
73
|
-
|
74
|
-
mrb_fixnum_id(mrb_int f)
|
75
|
-
#else
|
76
|
-
mrb_float_id(mrb_float f)
|
77
|
-
#endif
|
73
|
+
static mrb_int
|
74
|
+
make_num_id(const char *p, size_t len)
|
78
75
|
{
|
79
|
-
const char *p = (const char*)&f;
|
80
|
-
int len = sizeof(f);
|
81
76
|
uint32_t id = 0;
|
82
77
|
|
83
|
-
#ifndef MRB_WITHOUT_FLOAT
|
84
|
-
/* normalize -0.0 to 0.0 */
|
85
|
-
if (f == 0) f = 0.0;
|
86
|
-
#endif
|
87
78
|
while (len--) {
|
88
79
|
id = id*65599 + *p;
|
89
80
|
p++;
|
@@ -93,6 +84,22 @@ mrb_float_id(mrb_float f)
|
|
93
84
|
return (mrb_int)id;
|
94
85
|
}
|
95
86
|
|
87
|
+
MRB_API mrb_int
|
88
|
+
mrb_int_id(mrb_int n)
|
89
|
+
{
|
90
|
+
return make_num_id((const char*)&n, sizeof(n));
|
91
|
+
}
|
92
|
+
|
93
|
+
#ifndef MRB_NO_FLOAT
|
94
|
+
MRB_API mrb_int
|
95
|
+
mrb_float_id(mrb_float f)
|
96
|
+
{
|
97
|
+
/* normalize -0.0 to 0.0 */
|
98
|
+
if (f == 0) f = 0.0;
|
99
|
+
return make_num_id((const char*)&f, sizeof(f));
|
100
|
+
}
|
101
|
+
#endif
|
102
|
+
|
96
103
|
MRB_API mrb_int
|
97
104
|
mrb_obj_id(mrb_value obj)
|
98
105
|
{
|
@@ -107,17 +114,16 @@ mrb_obj_id(mrb_value obj)
|
|
107
114
|
return MakeID(0); /* not define */
|
108
115
|
case MRB_TT_FALSE:
|
109
116
|
if (mrb_nil_p(obj))
|
110
|
-
return MakeID(
|
111
|
-
|
117
|
+
return MakeID(4);
|
118
|
+
else
|
119
|
+
return MakeID(0);
|
112
120
|
case MRB_TT_TRUE:
|
113
|
-
return MakeID(
|
121
|
+
return MakeID(2);
|
114
122
|
case MRB_TT_SYMBOL:
|
115
123
|
return MakeID(mrb_symbol(obj));
|
116
|
-
case
|
117
|
-
|
118
|
-
|
119
|
-
#else
|
120
|
-
return MakeID2(mrb_float_id((mrb_float)mrb_fixnum(obj)), MRB_TT_FLOAT);
|
124
|
+
case MRB_TT_INTEGER:
|
125
|
+
return MakeID(mrb_int_id(mrb_integer(obj)));
|
126
|
+
#ifndef MRB_NO_FLOAT
|
121
127
|
case MRB_TT_FLOAT:
|
122
128
|
return MakeID(mrb_float_id(mrb_float(obj)));
|
123
129
|
#endif
|
@@ -146,29 +152,32 @@ mrb_obj_id(mrb_value obj)
|
|
146
152
|
#ifdef MRB_WORD_BOXING
|
147
153
|
#define mrb_xxx_boxing_cptr_value mrb_word_boxing_cptr_value
|
148
154
|
|
149
|
-
#ifndef
|
155
|
+
#ifndef MRB_NO_FLOAT
|
150
156
|
MRB_API mrb_value
|
151
157
|
mrb_word_boxing_float_value(mrb_state *mrb, mrb_float f)
|
152
158
|
{
|
153
|
-
|
159
|
+
union mrb_value_ v;
|
154
160
|
|
155
|
-
v.
|
156
|
-
v.
|
157
|
-
MRB_SET_FROZEN_FLAG(v.
|
158
|
-
return v;
|
161
|
+
v.p = mrb_obj_alloc(mrb, MRB_TT_FLOAT, mrb->float_class);
|
162
|
+
v.fp->f = f;
|
163
|
+
MRB_SET_FROZEN_FLAG(v.bp);
|
164
|
+
return v.value;
|
159
165
|
}
|
166
|
+
#endif /* MRB_NO_FLOAT */
|
160
167
|
|
161
168
|
MRB_API mrb_value
|
162
|
-
|
169
|
+
mrb_word_boxing_int_value(mrb_state *mrb, mrb_int n)
|
163
170
|
{
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
171
|
+
if (FIXABLE(n)) return mrb_fixnum_value(n);
|
172
|
+
else {
|
173
|
+
union mrb_value_ v;
|
174
|
+
|
175
|
+
v.p = mrb_obj_alloc(mrb, MRB_TT_INTEGER, mrb->integer_class);
|
176
|
+
v.ip->i = n;
|
177
|
+
MRB_SET_FROZEN_FLAG(v.ip);
|
178
|
+
return v.value;
|
179
|
+
}
|
170
180
|
}
|
171
|
-
#endif /* MRB_WITHOUT_FLOAT */
|
172
181
|
#endif /* MRB_WORD_BOXING */
|
173
182
|
|
174
183
|
#if defined(MRB_WORD_BOXING) || (defined(MRB_NAN_BOXING) && defined(MRB_64BIT))
|
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
#if defined(
|
1
|
+
#include <mruby.h>
|
2
|
+
#if !defined(MRB_NO_FLOAT)
|
3
|
+
#if defined(MRB_NO_STDIO) || defined(_WIN32) || defined(_WIN64)
|
3
4
|
/*
|
4
5
|
|
5
6
|
Most code in this file originates from musl (src/stdio/vfprintf.c)
|
@@ -34,7 +35,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
34
35
|
#include <float.h>
|
35
36
|
#include <ctype.h>
|
36
37
|
|
37
|
-
#include <mruby.h>
|
38
38
|
#include <mruby/string.h>
|
39
39
|
|
40
40
|
struct fmt_args;
|
@@ -442,8 +442,7 @@ mrb_float_to_cstr(mrb_state *mrb, char *buf, size_t len, const char *fmt, mrb_fl
|
|
442
442
|
*cstr.buf = '\0';
|
443
443
|
return (int)(cstr.buf - buf);
|
444
444
|
}
|
445
|
-
#else /*
|
446
|
-
#include <mruby.h>
|
445
|
+
#else /* MRB_NO_STDIO || _WIN32 || _WIN64 */
|
447
446
|
#include <stdio.h>
|
448
447
|
|
449
448
|
MRB_API mrb_value
|
@@ -460,5 +459,5 @@ mrb_float_to_cstr(mrb_state *mrb, char *buf, size_t len, const char *fmt, mrb_fl
|
|
460
459
|
{
|
461
460
|
return snprintf(buf, len, fmt, fval);
|
462
461
|
}
|
463
|
-
#endif /*
|
462
|
+
#endif /* MRB_NO_STDIO || _WIN32 || _WIN64 */
|
464
463
|
#endif
|
@@ -6,6 +6,9 @@
|
|
6
6
|
|
7
7
|
#include <string.h>
|
8
8
|
#include <stdlib.h>
|
9
|
+
#ifdef MRB_USE_MALLOC_TRIM
|
10
|
+
#include <malloc.h>
|
11
|
+
#endif
|
9
12
|
#include <mruby.h>
|
10
13
|
#include <mruby/array.h>
|
11
14
|
#include <mruby/class.h>
|
@@ -19,6 +22,7 @@
|
|
19
22
|
#include <mruby/gc.h>
|
20
23
|
#include <mruby/error.h>
|
21
24
|
#include <mruby/throw.h>
|
25
|
+
#include <mruby/presym.h>
|
22
26
|
|
23
27
|
/*
|
24
28
|
= Tri-color Incremental Garbage Collection
|
@@ -35,9 +39,14 @@
|
|
35
39
|
* Gray - Marked, But the child objects are unmarked.
|
36
40
|
* Black - Marked, the child objects are also marked.
|
37
41
|
|
42
|
+
Extra color
|
43
|
+
|
44
|
+
* Red - Static (ROM object) no need to be collected.
|
45
|
+
- All child objects should be Red as well.
|
46
|
+
|
38
47
|
== Two White Types
|
39
48
|
|
40
|
-
There
|
49
|
+
There are two white color types in a flip-flop fashion: White-A and White-B,
|
41
50
|
which respectively represent the Current White color (the newly allocated
|
42
51
|
objects in the current GC cycle) and the Sweep Target White color (the
|
43
52
|
dead objects to be swept).
|
@@ -99,8 +108,14 @@ struct free_obj {
|
|
99
108
|
struct RBasic *next;
|
100
109
|
};
|
101
110
|
|
111
|
+
struct RVALUE_initializer {
|
112
|
+
MRB_OBJECT_HEADER;
|
113
|
+
char padding[sizeof(void*) * 4 - sizeof(uint32_t)];
|
114
|
+
};
|
115
|
+
|
102
116
|
typedef struct {
|
103
117
|
union {
|
118
|
+
struct RVALUE_initializer init; /* must be first member to ensure initialization */
|
104
119
|
struct free_obj free;
|
105
120
|
struct RBasic basic;
|
106
121
|
struct RObject object;
|
@@ -117,7 +132,7 @@ typedef struct {
|
|
117
132
|
struct RException exc;
|
118
133
|
struct RBreak brk;
|
119
134
|
#ifdef MRB_WORD_BOXING
|
120
|
-
#ifndef
|
135
|
+
#ifndef MRB_NO_FLOAT
|
121
136
|
struct RFloat floatv;
|
122
137
|
#endif
|
123
138
|
struct RCptr cptr;
|
@@ -185,6 +200,7 @@ gettimeofday_time(void)
|
|
185
200
|
#define GC_WHITE_A 1
|
186
201
|
#define GC_WHITE_B (1 << 1)
|
187
202
|
#define GC_BLACK (1 << 2)
|
203
|
+
#define GC_RED 7
|
188
204
|
#define GC_WHITES (GC_WHITE_A | GC_WHITE_B)
|
189
205
|
#define GC_COLOR_MASK 7
|
190
206
|
|
@@ -194,7 +210,8 @@ gettimeofday_time(void)
|
|
194
210
|
#define paint_partial_white(s, o) ((o)->color = (s)->current_white_part)
|
195
211
|
#define is_gray(o) ((o)->color == GC_GRAY)
|
196
212
|
#define is_white(o) ((o)->color & GC_WHITES)
|
197
|
-
#define is_black(o) ((o)->color
|
213
|
+
#define is_black(o) ((o)->color == GC_BLACK)
|
214
|
+
#define is_red(o) ((o)->color == GC_RED)
|
198
215
|
#define flip_white_part(s) ((s)->current_white_part = other_white_part(s))
|
199
216
|
#define other_white_part(s) ((s)->current_white_part ^ GC_WHITES)
|
200
217
|
#define is_dead(s, o) (((o)->color & other_white_part(s) & GC_WHITES) || (o)->tt == MRB_TT_FREE)
|
@@ -225,14 +242,8 @@ mrb_realloc(mrb_state *mrb, void *p, size_t len)
|
|
225
242
|
p2 = mrb_realloc_simple(mrb, p, len);
|
226
243
|
if (len == 0) return p2;
|
227
244
|
if (p2 == NULL) {
|
228
|
-
|
229
|
-
|
230
|
-
/* mrb_panic(mrb); */
|
231
|
-
}
|
232
|
-
else {
|
233
|
-
mrb->gc.out_of_memory = TRUE;
|
234
|
-
mrb_raise_nomemory(mrb);
|
235
|
-
}
|
245
|
+
mrb->gc.out_of_memory = TRUE;
|
246
|
+
mrb_raise_nomemory(mrb);
|
236
247
|
}
|
237
248
|
else {
|
238
249
|
mrb->gc.out_of_memory = FALSE;
|
@@ -463,7 +474,7 @@ mrb_gc_protect(mrb_state *mrb, mrb_value obj)
|
|
463
474
|
gc_protect(mrb, &mrb->gc, mrb_basic_ptr(obj));
|
464
475
|
}
|
465
476
|
|
466
|
-
#define
|
477
|
+
#define GC_ROOT_SYM MRB_SYM(_gc_root_)
|
467
478
|
|
468
479
|
/* mrb_gc_register() keeps the object from GC.
|
469
480
|
|
@@ -480,7 +491,7 @@ mrb_gc_register(mrb_state *mrb, mrb_value obj)
|
|
480
491
|
mrb_value table;
|
481
492
|
|
482
493
|
if (mrb_immediate_p(obj)) return;
|
483
|
-
root =
|
494
|
+
root = GC_ROOT_SYM;
|
484
495
|
table = mrb_gv_get(mrb, root);
|
485
496
|
if (mrb_nil_p(table) || !mrb_array_p(table)) {
|
486
497
|
table = mrb_ary_new(mrb);
|
@@ -499,7 +510,7 @@ mrb_gc_unregister(mrb_state *mrb, mrb_value obj)
|
|
499
510
|
mrb_int i;
|
500
511
|
|
501
512
|
if (mrb_immediate_p(obj)) return;
|
502
|
-
root =
|
513
|
+
root = GC_ROOT_SYM;
|
503
514
|
table = mrb_gv_get(mrb, root);
|
504
515
|
if (mrb_nil_p(table)) return;
|
505
516
|
if (!mrb_array_p(table)) {
|
@@ -587,11 +598,11 @@ add_gray_list(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
|
|
587
598
|
gc->gray_list = obj;
|
588
599
|
}
|
589
600
|
|
590
|
-
static
|
601
|
+
static mrb_int
|
591
602
|
ci_nregs(mrb_callinfo *ci)
|
592
603
|
{
|
593
|
-
struct RProc *p = ci->proc;
|
594
|
-
|
604
|
+
const struct RProc *p = ci->proc;
|
605
|
+
mrb_int n = 0;
|
595
606
|
|
596
607
|
if (!p) {
|
597
608
|
if (ci->argc < 0) return 3;
|
@@ -616,11 +627,14 @@ mark_context_stack(mrb_state *mrb, struct mrb_context *c)
|
|
616
627
|
size_t e;
|
617
628
|
mrb_value nil;
|
618
629
|
|
619
|
-
if (c->
|
620
|
-
e = c->stack - c->stbase;
|
630
|
+
if (c->stbase == NULL) return;
|
621
631
|
if (c->ci) {
|
632
|
+
e = (c->ci->stack ? c->ci->stack - c->stbase : 0);
|
622
633
|
e += ci_nregs(c->ci);
|
623
634
|
}
|
635
|
+
else {
|
636
|
+
e = 0;
|
637
|
+
}
|
624
638
|
if (c->stbase + e > c->stend) e = c->stend - c->stbase;
|
625
639
|
for (i=0; i<e; i++) {
|
626
640
|
mrb_value v = c->stbase[i];
|
@@ -639,7 +653,6 @@ mark_context_stack(mrb_state *mrb, struct mrb_context *c)
|
|
639
653
|
static void
|
640
654
|
mark_context(mrb_state *mrb, struct mrb_context *c)
|
641
655
|
{
|
642
|
-
int i;
|
643
656
|
mrb_callinfo *ci;
|
644
657
|
|
645
658
|
start:
|
@@ -651,15 +664,10 @@ mark_context(mrb_state *mrb, struct mrb_context *c)
|
|
651
664
|
/* mark call stack */
|
652
665
|
if (c->cibase) {
|
653
666
|
for (ci = c->cibase; ci <= c->ci; ci++) {
|
654
|
-
mrb_gc_mark(mrb, (struct RBasic*)ci->env);
|
655
667
|
mrb_gc_mark(mrb, (struct RBasic*)ci->proc);
|
656
|
-
mrb_gc_mark(mrb, (struct RBasic*)ci->target_class);
|
668
|
+
mrb_gc_mark(mrb, (struct RBasic*)ci->u.target_class);
|
657
669
|
}
|
658
670
|
}
|
659
|
-
/* mark ensure stack */
|
660
|
-
for (i=0; i<c->eidx; i++) {
|
661
|
-
mrb_gc_mark(mrb, (struct RBasic*)c->ensure[i]);
|
662
|
-
}
|
663
671
|
/* mark fibers */
|
664
672
|
mrb_gc_mark(mrb, (struct RBasic*)c->fib);
|
665
673
|
if (c->prev) {
|
@@ -673,7 +681,6 @@ gc_mark_children(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
|
|
673
681
|
{
|
674
682
|
mrb_assert(is_gray(obj));
|
675
683
|
paint_black(obj);
|
676
|
-
gc->gray_list = obj->gcnext;
|
677
684
|
mrb_gc_mark(mrb, (struct RBasic*)obj->c);
|
678
685
|
switch (obj->tt) {
|
679
686
|
case MRB_TT_ICLASS:
|
@@ -737,10 +744,11 @@ gc_mark_children(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
|
|
737
744
|
case MRB_TT_ARRAY:
|
738
745
|
{
|
739
746
|
struct RArray *a = (struct RArray*)obj;
|
740
|
-
size_t i, e;
|
747
|
+
size_t i, e=ARY_LEN(a);
|
748
|
+
mrb_value *p = ARY_PTR(a);
|
741
749
|
|
742
|
-
for (i=0
|
743
|
-
mrb_gc_mark_value(mrb,
|
750
|
+
for (i=0; i<e; i++) {
|
751
|
+
mrb_gc_mark_value(mrb, p[i]);
|
744
752
|
}
|
745
753
|
}
|
746
754
|
break;
|
@@ -761,6 +769,14 @@ gc_mark_children(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
|
|
761
769
|
mrb_gc_mark_range(mrb, (struct RRange*)obj);
|
762
770
|
break;
|
763
771
|
|
772
|
+
case MRB_TT_BREAK:
|
773
|
+
{
|
774
|
+
struct RBreak *brk = (struct RBreak*)obj;
|
775
|
+
mrb_gc_mark(mrb, (struct RBasic*)mrb_break_proc_get(brk));
|
776
|
+
mrb_gc_mark_value(mrb, mrb_break_value_get(brk));
|
777
|
+
}
|
778
|
+
break;
|
779
|
+
|
764
780
|
default:
|
765
781
|
break;
|
766
782
|
}
|
@@ -771,6 +787,7 @@ mrb_gc_mark(mrb_state *mrb, struct RBasic *obj)
|
|
771
787
|
{
|
772
788
|
if (obj == 0) return;
|
773
789
|
if (!is_white(obj)) return;
|
790
|
+
if (is_red(obj)) return;
|
774
791
|
mrb_assert((obj)->tt != MRB_TT_FREE);
|
775
792
|
add_gray_list(mrb, &mrb->gc, obj);
|
776
793
|
}
|
@@ -780,22 +797,6 @@ obj_free(mrb_state *mrb, struct RBasic *obj, int end)
|
|
780
797
|
{
|
781
798
|
DEBUG(fprintf(stderr, "obj_free(%p,tt=%d)\n",obj,obj->tt));
|
782
799
|
switch (obj->tt) {
|
783
|
-
/* immediate - no mark */
|
784
|
-
case MRB_TT_TRUE:
|
785
|
-
case MRB_TT_FIXNUM:
|
786
|
-
case MRB_TT_SYMBOL:
|
787
|
-
/* cannot happen */
|
788
|
-
return;
|
789
|
-
|
790
|
-
#ifndef MRB_WITHOUT_FLOAT
|
791
|
-
case MRB_TT_FLOAT:
|
792
|
-
#ifdef MRB_WORD_BOXING
|
793
|
-
break;
|
794
|
-
#else
|
795
|
-
return;
|
796
|
-
#endif
|
797
|
-
#endif
|
798
|
-
|
799
800
|
case MRB_TT_OBJECT:
|
800
801
|
mrb_gc_free_iv(mrb, (struct RObject*)obj);
|
801
802
|
break;
|
@@ -809,12 +810,14 @@ obj_free(mrb_state *mrb, struct RBasic *obj, int end)
|
|
809
810
|
case MRB_TT_SCLASS:
|
810
811
|
mrb_gc_free_mt(mrb, (struct RClass*)obj);
|
811
812
|
mrb_gc_free_iv(mrb, (struct RObject*)obj);
|
812
|
-
|
813
|
+
if (!end)
|
814
|
+
mrb_mc_clear_by_class(mrb, (struct RClass*)obj);
|
813
815
|
break;
|
814
816
|
case MRB_TT_ICLASS:
|
815
817
|
if (MRB_FLAG_TEST(obj, MRB_FL_CLASS_IS_ORIGIN))
|
816
818
|
mrb_gc_free_mt(mrb, (struct RClass*)obj);
|
817
|
-
|
819
|
+
if (!end)
|
820
|
+
mrb_mc_clear_by_class(mrb, (struct RClass*)obj);
|
818
821
|
break;
|
819
822
|
case MRB_TT_ENV:
|
820
823
|
{
|
@@ -840,7 +843,7 @@ obj_free(mrb_state *mrb, struct RBasic *obj, int end)
|
|
840
843
|
mrb_callinfo *ce = c->cibase;
|
841
844
|
|
842
845
|
while (ce <= ci) {
|
843
|
-
struct REnv *e = ci->env;
|
846
|
+
struct REnv *e = ci->u.env;
|
844
847
|
if (e && !mrb_object_dead_p(mrb, (struct RBasic*)e) &&
|
845
848
|
e->tt == MRB_TT_ENV && MRB_ENV_ONSTACK_P(e)) {
|
846
849
|
mrb_env_unshare(mrb, e);
|
@@ -874,7 +877,7 @@ obj_free(mrb_state *mrb, struct RBasic *obj, int end)
|
|
874
877
|
struct RProc *p = (struct RProc*)obj;
|
875
878
|
|
876
879
|
if (!MRB_PROC_CFUNC_P(p) && p->body.irep) {
|
877
|
-
mrb_irep *irep = p->body.irep;
|
880
|
+
mrb_irep *irep = (mrb_irep*)p->body.irep;
|
878
881
|
if (end) {
|
879
882
|
mrb_irep_cutref(mrb, irep);
|
880
883
|
}
|
@@ -930,10 +933,10 @@ root_scan_phase(mrb_state *mrb, mrb_gc *gc)
|
|
930
933
|
mrb_gc_mark(mrb, (struct RBasic*)mrb->hash_class);
|
931
934
|
mrb_gc_mark(mrb, (struct RBasic*)mrb->range_class);
|
932
935
|
|
933
|
-
#ifndef
|
936
|
+
#ifndef MRB_NO_FLOAT
|
934
937
|
mrb_gc_mark(mrb, (struct RBasic*)mrb->float_class);
|
935
938
|
#endif
|
936
|
-
mrb_gc_mark(mrb, (struct RBasic*)mrb->
|
939
|
+
mrb_gc_mark(mrb, (struct RBasic*)mrb->integer_class);
|
937
940
|
mrb_gc_mark(mrb, (struct RBasic*)mrb->true_class);
|
938
941
|
mrb_gc_mark(mrb, (struct RBasic*)mrb->false_class);
|
939
942
|
mrb_gc_mark(mrb, (struct RBasic*)mrb->nil_class);
|
@@ -1002,7 +1005,7 @@ gc_gray_counts(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
|
|
1002
1005
|
if (!c || c->status == MRB_FIBER_TERMINATED) break;
|
1003
1006
|
|
1004
1007
|
/* mark stack */
|
1005
|
-
i = c->stack - c->stbase;
|
1008
|
+
i = c->ci->stack - c->stbase;
|
1006
1009
|
|
1007
1010
|
if (c->ci) {
|
1008
1011
|
i += ci_nregs(c->ci);
|
@@ -1010,9 +1013,6 @@ gc_gray_counts(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
|
|
1010
1013
|
if (c->stbase + i > c->stend) i = c->stend - c->stbase;
|
1011
1014
|
children += i;
|
1012
1015
|
|
1013
|
-
/* mark ensure stack */
|
1014
|
-
children += c->eidx;
|
1015
|
-
|
1016
1016
|
/* mark closure */
|
1017
1017
|
if (c->cibase) {
|
1018
1018
|
for (i=0, ci = c->cibase; ci <= c->ci; i++, ci++)
|
@@ -1036,6 +1036,7 @@ gc_gray_counts(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
|
|
1036
1036
|
|
1037
1037
|
case MRB_TT_PROC:
|
1038
1038
|
case MRB_TT_RANGE:
|
1039
|
+
case MRB_TT_BREAK:
|
1039
1040
|
children+=2;
|
1040
1041
|
break;
|
1041
1042
|
|
@@ -1049,10 +1050,9 @@ gc_gray_counts(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
|
|
1049
1050
|
static void
|
1050
1051
|
gc_mark_gray_list(mrb_state *mrb, mrb_gc *gc) {
|
1051
1052
|
while (gc->gray_list) {
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
gc->gray_list = gc->gray_list->gcnext;
|
1053
|
+
struct RBasic *obj = gc->gray_list;
|
1054
|
+
gc->gray_list = obj->gcnext;
|
1055
|
+
gc_mark_children(mrb, gc, obj);
|
1056
1056
|
}
|
1057
1057
|
}
|
1058
1058
|
|
@@ -1064,6 +1064,7 @@ incremental_marking_phase(mrb_state *mrb, mrb_gc *gc, size_t limit)
|
|
1064
1064
|
|
1065
1065
|
while (gc->gray_list && tried_marks < limit) {
|
1066
1066
|
struct RBasic *obj = gc->gray_list;
|
1067
|
+
gc->gray_list = obj->gcnext;
|
1067
1068
|
gc_mark_children(mrb, gc, obj);
|
1068
1069
|
tried_marks += gc_gray_counts(mrb, gc, obj);
|
1069
1070
|
}
|
@@ -1082,7 +1083,9 @@ final_marking_phase(mrb_state *mrb, mrb_gc *gc)
|
|
1082
1083
|
}
|
1083
1084
|
mrb_gc_mark_gv(mrb);
|
1084
1085
|
mark_context(mrb, mrb->c);
|
1085
|
-
|
1086
|
+
if (mrb->c != mrb->root_c) {
|
1087
|
+
mark_context(mrb, mrb->root_c);
|
1088
|
+
}
|
1086
1089
|
mrb_gc_mark(mrb, (struct RBasic*)mrb->exc);
|
1087
1090
|
gc_mark_gray_list(mrb, gc);
|
1088
1091
|
mrb_assert(gc->gray_list == NULL);
|
@@ -1321,6 +1324,9 @@ mrb_full_gc(mrb_state *mrb)
|
|
1321
1324
|
gc->full = FALSE;
|
1322
1325
|
}
|
1323
1326
|
|
1327
|
+
#ifdef MRB_USE_MALLOC_TRIM
|
1328
|
+
malloc_trim(0);
|
1329
|
+
#endif
|
1324
1330
|
GC_TIME_STOP_AND_REPORT;
|
1325
1331
|
}
|
1326
1332
|
|
@@ -1605,11 +1611,12 @@ mrb_objspace_each_objects(mrb_state *mrb, mrb_each_object_callback *callback, vo
|
|
1605
1611
|
}
|
1606
1612
|
}
|
1607
1613
|
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1614
|
+
size_t
|
1615
|
+
mrb_objspace_page_slot_size(void)
|
1616
|
+
{
|
1617
|
+
return sizeof(RVALUE);
|
1618
|
+
}
|
1619
|
+
|
1613
1620
|
|
1614
1621
|
void
|
1615
1622
|
mrb_init_gc(mrb_state *mrb)
|
@@ -1630,9 +1637,4 @@ mrb_init_gc(mrb_state *mrb)
|
|
1630
1637
|
mrb_define_class_method(mrb, gc, "step_ratio=", gc_step_ratio_set, MRB_ARGS_REQ(1));
|
1631
1638
|
mrb_define_class_method(mrb, gc, "generational_mode=", gc_generational_mode_set, MRB_ARGS_REQ(1));
|
1632
1639
|
mrb_define_class_method(mrb, gc, "generational_mode", gc_generational_mode_get, MRB_ARGS_NONE());
|
1633
|
-
#ifdef GC_TEST
|
1634
|
-
#ifdef GC_DEBUG
|
1635
|
-
mrb_define_class_method(mrb, gc, "test", gc_test, MRB_ARGS_NONE());
|
1636
|
-
#endif
|
1637
|
-
#endif
|
1638
1640
|
}
|