debase-ruby_core_source 0.10.9 → 0.10.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/Rakefile +6 -3
- data/debase-ruby_core_source.gemspec +2 -1
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/addr2line.h +2 -3
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/builtin.h +17 -2
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/ccan/list/list.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/constant.h +10 -5
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/debug_counter.h +127 -48
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/dln.h +3 -18
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/encindex.h +3 -2
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/eval_intern.h +16 -7
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/gc.h +13 -2
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/hrtime.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/id.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/id_table.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/insns.inc +0 -4
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/insns_info.inc +323 -536
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/array.h +119 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/bignum.h +246 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/bits.h +566 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/class.h +174 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/compar.h +50 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/compile.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/compilers.h +108 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/complex.h +29 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/cont.h +25 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/dir.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/enc.h +20 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/encoding.h +28 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/enum.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/enumerator.h +22 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/error.h +124 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/eval.h +33 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/file.h +39 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/fixnum.h +185 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/gc.h +161 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/hash.h +241 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/imemo.h +243 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/inits.h +51 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/io.h +35 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/load.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/loadpath.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/math.h +24 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/missing.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/numeric.h +255 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/object.h +83 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/parse.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/proc.h +33 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/process.h +136 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/random.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/range.h +41 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/rational.h +71 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/re.h +29 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/sanitizers.h +191 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/scheduler.h +44 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/serial.h +24 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/signal.h +22 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/static_assert.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/string.h +140 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/struct.h +154 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/symbol.h +41 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/thread.h +54 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/time.h +35 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/transcode.h +21 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/util.h +31 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/variable.h +84 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/vm.h +136 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/warnings.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal.h +107 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/iseq.h +11 -18
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/known_errors.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/method.h +21 -8
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/mjit.h +89 -48
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/mjit_compile.inc +2746 -2288
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/node.h +32 -24
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/node_name.inc +2 -2
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/opt_sc.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/optinsn.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/optunifs.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/parse.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/probes_helper.h +2 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ractor_core.h +343 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/regenc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/regint.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/regparse.h +0 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/revision.h +2 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ruby_assert.h +15 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ruby_atomic.h +23 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/siphash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/symbol.h +4 -4
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/thread_pthread.h +45 -5
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/thread_win32.h +28 -3
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/timev.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/transcode_data.h +2 -3
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/transient_heap.h +6 -3
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/variable.h +22 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/version.h +23 -11
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/vm.inc +707 -671
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/vm_call_iseq_optimized.inc +93 -86
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_callinfo.h +456 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/vm_core.h +262 -194
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_debug.h +116 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/vm_exec.h +9 -6
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/vm_insnhelper.h +28 -26
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/vm_opts.h +6 -5
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_sync.h +136 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.0.0-p0}/vmtc.inc +0 -4
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/addr2line.h +2 -3
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/builtin.h +83 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/ccan/build_assert/build_assert.h +13 -13
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/ccan/check_type/check_type.h +17 -17
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/ccan/container_of/container_of.h +63 -63
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/ccan/list/list.h +262 -262
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/ccan/str/str.h +4 -4
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/constant.h +10 -9
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/darray.h +198 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/debug_counter.h +137 -48
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/dln.h +3 -23
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/encindex.h +3 -2
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/eval_intern.h +34 -41
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/gc.h +24 -11
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/hrtime.h +9 -9
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/id.h +4 -3
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/id_table.h +3 -1
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/insns.inc +6 -8
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/insns_info.inc +1907 -2543
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/array.h +113 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/bignum.h +246 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/bits.h +565 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/class.h +188 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/compar.h +49 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/compile.h +35 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/compilers.h +107 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/complex.h +29 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/cont.h +24 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/dir.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/enc.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/encoding.h +30 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/enum.h +18 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/enumerator.h +21 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/error.h +191 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/eval.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/file.h +38 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/fixnum.h +184 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/gc.h +175 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/hash.h +243 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/imemo.h +243 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/inits.h +50 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/io.h +38 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/load.h +18 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/loadpath.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/math.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/missing.h +18 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/numeric.h +271 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/object.h +83 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/parse.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/proc.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/process.h +137 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/random.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/range.h +40 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/rational.h +72 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/re.h +30 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/sanitizers.h +190 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/serial.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/signal.h +21 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/static_assert.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/string.h +141 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/struct.h +153 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/symbol.h +40 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/thread.h +53 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/time.h +34 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/transcode.h +20 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/util.h +27 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/variable.h +83 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/vm.h +132 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/warnings.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal.h +109 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/iseq.h +44 -35
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/known_errors.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/method.h +21 -4
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/mjit.h +231 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/mjit_compile.inc +3322 -2940
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/node.h +39 -23
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/node_name.inc +210 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/opt_sc.inc +0 -2
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/optinsn.inc +7 -7
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/optunifs.inc +1 -1
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/parse.h +9 -5
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/probes_helper.h +9 -7
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ractor_core.h +346 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/regenc.h +8 -8
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/regint.h +16 -12
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/regparse.h +2 -2
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/revision.h +2 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ruby_assert.h +14 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ruby_atomic.h +23 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/siphash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/symbol.h +14 -14
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/thread_pthread.h +45 -5
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/thread_win32.h +30 -5
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/timev.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/transcode_data.h +49 -50
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/transient_heap.h +6 -3
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/variable.h +21 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/version.h +15 -4
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/vm.inc +1033 -887
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_call_iseq_optimized.inc +244 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_callinfo.h +454 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/vm_core.h +508 -362
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_debug.h +119 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/vm_exec.h +22 -18
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview3 → ruby-3.1.0-preview1}/vm_insnhelper.h +42 -32
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/vm_opts.h +8 -5
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_sync.h +137 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.1.0-preview1}/vmtc.inc +6 -8
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit.h +63 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit_asm.h +392 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit_codegen.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit_core.h +302 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit_iface.h +38 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- data/lib/debase/ruby_core_source.rb +0 -2
- metadata +240 -110
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/internal.h +0 -2682
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/revision.h +0 -2
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ruby_assert.h +0 -15
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/ruby_atomic.h +0 -244
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_call_iseq_optimized.inc +0 -237
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/vm_debug.h +0 -34
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/internal.h +0 -2657
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/mjit.h +0 -175
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/node_name.inc +0 -208
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/revision.h +0 -2
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/ruby_assert.h +0 -15
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/ruby_atomic.h +0 -244
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview3/vm_debug.h +0 -34
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
#ifndef RUBY_VM_CORE_H
|
|
2
|
+
#define RUBY_VM_CORE_H
|
|
1
3
|
/**********************************************************************
|
|
2
4
|
|
|
3
5
|
vm_core.h -
|
|
@@ -9,9 +11,6 @@
|
|
|
9
11
|
|
|
10
12
|
**********************************************************************/
|
|
11
13
|
|
|
12
|
-
#ifndef RUBY_VM_CORE_H
|
|
13
|
-
#define RUBY_VM_CORE_H
|
|
14
|
-
|
|
15
14
|
/*
|
|
16
15
|
* Enable check mode.
|
|
17
16
|
* 1: enable local assertions.
|
|
@@ -46,6 +45,12 @@
|
|
|
46
45
|
#define VMDEBUG 3
|
|
47
46
|
#endif
|
|
48
47
|
|
|
48
|
+
#include "ruby/internal/config.h"
|
|
49
|
+
|
|
50
|
+
#include <stddef.h>
|
|
51
|
+
#include <signal.h>
|
|
52
|
+
#include <stdarg.h>
|
|
53
|
+
|
|
49
54
|
#include "ruby_assert.h"
|
|
50
55
|
|
|
51
56
|
#if VM_CHECK_MODE > 0
|
|
@@ -57,6 +62,26 @@
|
|
|
57
62
|
#define VM_UNREACHABLE(func) UNREACHABLE
|
|
58
63
|
#endif
|
|
59
64
|
|
|
65
|
+
#include <setjmp.h>
|
|
66
|
+
|
|
67
|
+
#include "ruby/internal/stdbool.h"
|
|
68
|
+
#include "ccan/list/list.h"
|
|
69
|
+
#include "id.h"
|
|
70
|
+
#include "internal.h"
|
|
71
|
+
#include "internal/array.h"
|
|
72
|
+
#include "internal/serial.h"
|
|
73
|
+
#include "internal/vm.h"
|
|
74
|
+
#include "method.h"
|
|
75
|
+
#include "node.h"
|
|
76
|
+
#include "ruby/ruby.h"
|
|
77
|
+
#include "ruby/st.h"
|
|
78
|
+
#include "ruby_atomic.h"
|
|
79
|
+
#include "vm_opts.h"
|
|
80
|
+
#include "darray.h"
|
|
81
|
+
|
|
82
|
+
#include "ruby/thread_native.h"
|
|
83
|
+
#include THREAD_IMPL_H
|
|
84
|
+
|
|
60
85
|
#define RUBY_VM_THREAD_MODEL 2
|
|
61
86
|
|
|
62
87
|
/*
|
|
@@ -69,26 +94,6 @@
|
|
|
69
94
|
# define VM_INSN_INFO_TABLE_IMPL 2
|
|
70
95
|
#endif
|
|
71
96
|
|
|
72
|
-
#include "ruby/ruby.h"
|
|
73
|
-
#include "ruby/st.h"
|
|
74
|
-
|
|
75
|
-
#include "node.h"
|
|
76
|
-
#include "vm_opts.h"
|
|
77
|
-
#include "id.h"
|
|
78
|
-
#include "method.h"
|
|
79
|
-
#include "ruby_atomic.h"
|
|
80
|
-
#include "ccan/list/list.h"
|
|
81
|
-
|
|
82
|
-
#include "ruby/thread_native.h"
|
|
83
|
-
#if defined(_WIN32)
|
|
84
|
-
#include "thread_win32.h"
|
|
85
|
-
#elif defined(HAVE_PTHREAD_H)
|
|
86
|
-
#include "thread_pthread.h"
|
|
87
|
-
#endif
|
|
88
|
-
|
|
89
|
-
#include <setjmp.h>
|
|
90
|
-
#include <signal.h>
|
|
91
|
-
|
|
92
97
|
#if defined(NSIG_MAX) /* POSIX issue 8 */
|
|
93
98
|
# undef NSIG
|
|
94
99
|
# define NSIG NSIG_MAX
|
|
@@ -123,22 +128,15 @@
|
|
|
123
128
|
/* define to 0 to test old code path */
|
|
124
129
|
#define WAITPID_USE_SIGCHLD (RUBY_SIGCHLD || SIGCHLD_LOSSY)
|
|
125
130
|
|
|
126
|
-
#ifdef HAVE_STDARG_PROTOTYPES
|
|
127
|
-
#include <stdarg.h>
|
|
128
|
-
#define va_init_list(a,b) va_start((a),(b))
|
|
129
|
-
#else
|
|
130
|
-
#include <varargs.h>
|
|
131
|
-
#define va_init_list(a,b) va_start((a))
|
|
132
|
-
#endif
|
|
133
|
-
|
|
134
131
|
#if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK) && defined(SA_SIGINFO) && !defined(__NetBSD__)
|
|
135
132
|
# define USE_SIGALTSTACK
|
|
136
|
-
void *
|
|
137
|
-
|
|
138
|
-
# define
|
|
133
|
+
void *rb_allocate_sigaltstack(void);
|
|
134
|
+
void *rb_register_sigaltstack(void *);
|
|
135
|
+
# define RB_ALTSTACK_INIT(var, altstack) var = rb_register_sigaltstack(altstack)
|
|
136
|
+
# define RB_ALTSTACK_FREE(var) free(var)
|
|
139
137
|
# define RB_ALTSTACK(var) var
|
|
140
138
|
#else /* noop */
|
|
141
|
-
# define RB_ALTSTACK_INIT(var)
|
|
139
|
+
# define RB_ALTSTACK_INIT(var, altstack)
|
|
142
140
|
# define RB_ALTSTACK_FREE(var)
|
|
143
141
|
# define RB_ALTSTACK(var) (0)
|
|
144
142
|
#endif
|
|
@@ -182,28 +180,28 @@ typedef unsigned long rb_num_t;
|
|
|
182
180
|
typedef signed long rb_snum_t;
|
|
183
181
|
|
|
184
182
|
enum ruby_tag_type {
|
|
185
|
-
RUBY_TAG_NONE
|
|
186
|
-
RUBY_TAG_RETURN
|
|
187
|
-
RUBY_TAG_BREAK
|
|
188
|
-
RUBY_TAG_NEXT
|
|
189
|
-
RUBY_TAG_RETRY
|
|
190
|
-
RUBY_TAG_REDO
|
|
191
|
-
RUBY_TAG_RAISE
|
|
192
|
-
RUBY_TAG_THROW
|
|
193
|
-
RUBY_TAG_FATAL
|
|
194
|
-
RUBY_TAG_MASK
|
|
183
|
+
RUBY_TAG_NONE = 0x0,
|
|
184
|
+
RUBY_TAG_RETURN = 0x1,
|
|
185
|
+
RUBY_TAG_BREAK = 0x2,
|
|
186
|
+
RUBY_TAG_NEXT = 0x3,
|
|
187
|
+
RUBY_TAG_RETRY = 0x4,
|
|
188
|
+
RUBY_TAG_REDO = 0x5,
|
|
189
|
+
RUBY_TAG_RAISE = 0x6,
|
|
190
|
+
RUBY_TAG_THROW = 0x7,
|
|
191
|
+
RUBY_TAG_FATAL = 0x8,
|
|
192
|
+
RUBY_TAG_MASK = 0xf
|
|
195
193
|
};
|
|
196
194
|
|
|
197
|
-
#define TAG_NONE
|
|
198
|
-
#define TAG_RETURN
|
|
199
|
-
#define TAG_BREAK
|
|
200
|
-
#define TAG_NEXT
|
|
201
|
-
#define TAG_RETRY
|
|
202
|
-
#define TAG_REDO
|
|
203
|
-
#define TAG_RAISE
|
|
204
|
-
#define TAG_THROW
|
|
205
|
-
#define TAG_FATAL
|
|
206
|
-
#define TAG_MASK
|
|
195
|
+
#define TAG_NONE RUBY_TAG_NONE
|
|
196
|
+
#define TAG_RETURN RUBY_TAG_RETURN
|
|
197
|
+
#define TAG_BREAK RUBY_TAG_BREAK
|
|
198
|
+
#define TAG_NEXT RUBY_TAG_NEXT
|
|
199
|
+
#define TAG_RETRY RUBY_TAG_RETRY
|
|
200
|
+
#define TAG_REDO RUBY_TAG_REDO
|
|
201
|
+
#define TAG_RAISE RUBY_TAG_RAISE
|
|
202
|
+
#define TAG_THROW RUBY_TAG_THROW
|
|
203
|
+
#define TAG_FATAL RUBY_TAG_FATAL
|
|
204
|
+
#define TAG_MASK RUBY_TAG_MASK
|
|
207
205
|
|
|
208
206
|
enum ruby_vm_throw_flags {
|
|
209
207
|
VM_THROW_NO_ESCAPE_FLAG = 0x8000,
|
|
@@ -217,47 +215,88 @@ struct rb_control_frame_struct;
|
|
|
217
215
|
/* iseq data type */
|
|
218
216
|
typedef struct rb_compile_option_struct rb_compile_option_t;
|
|
219
217
|
|
|
220
|
-
|
|
221
|
-
rb_serial_t
|
|
222
|
-
|
|
223
|
-
union {
|
|
224
|
-
size_t index;
|
|
225
|
-
VALUE value;
|
|
226
|
-
} ic_value;
|
|
218
|
+
union ic_serial_entry {
|
|
219
|
+
rb_serial_t raw;
|
|
220
|
+
VALUE data[2];
|
|
227
221
|
};
|
|
228
222
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
223
|
+
// imemo_constcache
|
|
224
|
+
struct iseq_inline_constant_cache_entry {
|
|
225
|
+
VALUE flags;
|
|
226
|
+
|
|
227
|
+
VALUE value; // v0
|
|
228
|
+
union ic_serial_entry ic_serial; // v1, v2
|
|
229
|
+
const rb_cref_t *ic_cref; // v3
|
|
230
|
+
};
|
|
231
|
+
STATIC_ASSERT(sizeof_iseq_inline_constant_cache_entry,
|
|
232
|
+
(offsetof(struct iseq_inline_constant_cache_entry, ic_cref) +
|
|
233
|
+
sizeof(const rb_cref_t *)) <= sizeof(struct RObject));
|
|
234
|
+
|
|
235
|
+
#if SIZEOF_SERIAL_T <= SIZEOF_VALUE
|
|
236
|
+
|
|
237
|
+
#define GET_IC_SERIAL(ice) (ice)->ic_serial.raw
|
|
238
|
+
#define SET_IC_SERIAL(ice, v) (ice)->ic_serial.raw = (v)
|
|
239
|
+
|
|
240
|
+
#else
|
|
241
|
+
|
|
242
|
+
static inline rb_serial_t
|
|
243
|
+
get_ic_serial(const struct iseq_inline_constant_cache_entry *ice)
|
|
244
|
+
{
|
|
245
|
+
union ic_serial_entry tmp;
|
|
246
|
+
tmp.data[0] = ice->ic_serial.data[0];
|
|
247
|
+
tmp.data[1] = ice->ic_serial.data[1];
|
|
248
|
+
return tmp.raw;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
#define GET_IC_SERIAL(ice) get_ic_serial(ice)
|
|
252
|
+
|
|
253
|
+
static inline void
|
|
254
|
+
set_ic_serial(struct iseq_inline_constant_cache_entry *ice, rb_serial_t v)
|
|
255
|
+
{
|
|
256
|
+
union ic_serial_entry tmp;
|
|
257
|
+
tmp.raw = v;
|
|
258
|
+
ice->ic_serial.data[0] = tmp.data[0];
|
|
259
|
+
ice->ic_serial.data[1] = tmp.data[1];
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
#define SET_IC_SERIAL(ice, v) set_ic_serial((ice), (v))
|
|
263
|
+
|
|
264
|
+
#endif
|
|
265
|
+
|
|
266
|
+
struct iseq_inline_constant_cache {
|
|
267
|
+
struct iseq_inline_constant_cache_entry *entry;
|
|
268
|
+
// For YJIT: the index to the opt_getinlinecache instruction in the same iseq.
|
|
269
|
+
// It's set during compile time and constant once set.
|
|
270
|
+
unsigned get_insn_idx;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
struct iseq_inline_iv_cache_entry {
|
|
274
|
+
struct rb_iv_index_tbl_entry *entry;
|
|
235
275
|
};
|
|
236
276
|
|
|
237
|
-
struct
|
|
238
|
-
|
|
239
|
-
VALUE keywords[1];
|
|
277
|
+
struct iseq_inline_cvar_cache_entry {
|
|
278
|
+
struct rb_cvar_class_tbl_entry *entry;
|
|
240
279
|
};
|
|
241
280
|
|
|
242
|
-
|
|
243
|
-
struct
|
|
244
|
-
|
|
281
|
+
union iseq_inline_storage_entry {
|
|
282
|
+
struct {
|
|
283
|
+
struct rb_thread_struct *running_thread;
|
|
284
|
+
VALUE value;
|
|
285
|
+
} once;
|
|
286
|
+
struct iseq_inline_constant_cache ic_cache;
|
|
287
|
+
struct iseq_inline_iv_cache_entry iv_cache;
|
|
245
288
|
};
|
|
246
289
|
|
|
247
290
|
struct rb_calling_info {
|
|
291
|
+
const struct rb_callinfo *ci;
|
|
292
|
+
const struct rb_callcache *cc;
|
|
248
293
|
VALUE block_handler;
|
|
249
294
|
VALUE recv;
|
|
250
295
|
int argc;
|
|
251
296
|
int kw_splat;
|
|
252
297
|
};
|
|
253
298
|
|
|
254
|
-
struct rb_kwarg_call_data {
|
|
255
|
-
struct rb_call_cache cc;
|
|
256
|
-
struct rb_call_info_with_kwarg ci_kw;
|
|
257
|
-
};
|
|
258
|
-
|
|
259
299
|
struct rb_execution_context_struct;
|
|
260
|
-
typedef VALUE (*vm_call_handler)(struct rb_execution_context_struct *ec, struct rb_control_frame_struct *cfp, struct rb_calling_info *calling, struct rb_call_data *cd);
|
|
261
300
|
|
|
262
301
|
#if 1
|
|
263
302
|
#define CoreDataFromValue(obj, type) (type*)DATA_PTR(obj)
|
|
@@ -282,11 +321,11 @@ static inline VALUE
|
|
|
282
321
|
pathobj_path(VALUE pathobj)
|
|
283
322
|
{
|
|
284
323
|
if (RB_TYPE_P(pathobj, T_STRING)) {
|
|
285
|
-
|
|
324
|
+
return pathobj;
|
|
286
325
|
}
|
|
287
326
|
else {
|
|
288
|
-
|
|
289
|
-
|
|
327
|
+
VM_ASSERT(RB_TYPE_P(pathobj, T_ARRAY));
|
|
328
|
+
return RARRAY_AREF(pathobj, PATHOBJ_PATH);
|
|
290
329
|
}
|
|
291
330
|
}
|
|
292
331
|
|
|
@@ -294,28 +333,32 @@ static inline VALUE
|
|
|
294
333
|
pathobj_realpath(VALUE pathobj)
|
|
295
334
|
{
|
|
296
335
|
if (RB_TYPE_P(pathobj, T_STRING)) {
|
|
297
|
-
|
|
336
|
+
return pathobj;
|
|
298
337
|
}
|
|
299
338
|
else {
|
|
300
|
-
|
|
301
|
-
|
|
339
|
+
VM_ASSERT(RB_TYPE_P(pathobj, T_ARRAY));
|
|
340
|
+
return RARRAY_AREF(pathobj, PATHOBJ_REALPATH);
|
|
302
341
|
}
|
|
303
342
|
}
|
|
304
343
|
|
|
305
344
|
/* Forward declarations */
|
|
306
345
|
struct rb_mjit_unit;
|
|
307
346
|
|
|
347
|
+
// List of YJIT block versions
|
|
348
|
+
typedef rb_darray(struct yjit_block_version *) rb_yjit_block_array_t;
|
|
349
|
+
typedef rb_darray(rb_yjit_block_array_t) rb_yjit_block_array_array_t;
|
|
350
|
+
|
|
308
351
|
struct rb_iseq_constant_body {
|
|
309
352
|
enum iseq_type {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
353
|
+
ISEQ_TYPE_TOP,
|
|
354
|
+
ISEQ_TYPE_METHOD,
|
|
355
|
+
ISEQ_TYPE_BLOCK,
|
|
356
|
+
ISEQ_TYPE_CLASS,
|
|
357
|
+
ISEQ_TYPE_RESCUE,
|
|
358
|
+
ISEQ_TYPE_ENSURE,
|
|
359
|
+
ISEQ_TYPE_EVAL,
|
|
360
|
+
ISEQ_TYPE_MAIN,
|
|
361
|
+
ISEQ_TYPE_PLAIN
|
|
319
362
|
} type; /* instruction sequence type */
|
|
320
363
|
|
|
321
364
|
unsigned int iseq_size;
|
|
@@ -345,67 +388,67 @@ struct rb_iseq_constant_body {
|
|
|
345
388
|
*/
|
|
346
389
|
|
|
347
390
|
struct {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
391
|
+
struct {
|
|
392
|
+
unsigned int has_lead : 1;
|
|
393
|
+
unsigned int has_opt : 1;
|
|
394
|
+
unsigned int has_rest : 1;
|
|
395
|
+
unsigned int has_post : 1;
|
|
396
|
+
unsigned int has_kw : 1;
|
|
397
|
+
unsigned int has_kwrest : 1;
|
|
398
|
+
unsigned int has_block : 1;
|
|
399
|
+
|
|
400
|
+
unsigned int ambiguous_param0 : 1; /* {|a|} */
|
|
401
|
+
unsigned int accepts_no_kwarg : 1;
|
|
359
402
|
unsigned int ruby2_keywords: 1;
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
403
|
+
} flags;
|
|
404
|
+
|
|
405
|
+
unsigned int size;
|
|
406
|
+
|
|
407
|
+
int lead_num;
|
|
408
|
+
int opt_num;
|
|
409
|
+
int rest_start;
|
|
410
|
+
int post_start;
|
|
411
|
+
int post_num;
|
|
412
|
+
int block_start;
|
|
413
|
+
|
|
414
|
+
const VALUE *opt_table; /* (opt_num + 1) entries. */
|
|
415
|
+
/* opt_num and opt_table:
|
|
416
|
+
*
|
|
417
|
+
* def foo o1=e1, o2=e2, ..., oN=eN
|
|
418
|
+
* #=>
|
|
419
|
+
* # prologue code
|
|
420
|
+
* A1: e1
|
|
421
|
+
* A2: e2
|
|
422
|
+
* ...
|
|
423
|
+
* AN: eN
|
|
424
|
+
* AL: body
|
|
425
|
+
* opt_num = N
|
|
426
|
+
* opt_table = [A1, A2, ..., AN, AL]
|
|
427
|
+
*/
|
|
428
|
+
|
|
429
|
+
const struct rb_iseq_param_keyword {
|
|
430
|
+
int num;
|
|
431
|
+
int required_num;
|
|
432
|
+
int bits_start;
|
|
433
|
+
int rest_start;
|
|
434
|
+
const ID *table;
|
|
392
435
|
VALUE *default_values;
|
|
393
|
-
|
|
436
|
+
} *keyword;
|
|
394
437
|
} param;
|
|
395
438
|
|
|
396
439
|
rb_iseq_location_t location;
|
|
397
440
|
|
|
398
441
|
/* insn info, must be freed */
|
|
399
442
|
struct iseq_insn_info {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
443
|
+
const struct iseq_insn_info_entry *body;
|
|
444
|
+
unsigned int *positions;
|
|
445
|
+
unsigned int size;
|
|
403
446
|
#if VM_INSN_INFO_TABLE_IMPL == 2
|
|
404
|
-
|
|
447
|
+
struct succ_index_table *succ_index_table;
|
|
405
448
|
#endif
|
|
406
449
|
} insns_info;
|
|
407
450
|
|
|
408
|
-
const ID *local_table;
|
|
451
|
+
const ID *local_table; /* must free */
|
|
409
452
|
|
|
410
453
|
/* catch table */
|
|
411
454
|
struct iseq_catch_table *catch_table;
|
|
@@ -415,27 +458,29 @@ struct rb_iseq_constant_body {
|
|
|
415
458
|
struct rb_iseq_struct *local_iseq; /* local_iseq->flip_cnt can be modified */
|
|
416
459
|
|
|
417
460
|
union iseq_inline_storage_entry *is_entries;
|
|
418
|
-
struct rb_call_data *call_data;
|
|
419
|
-
* struct rb_call_data calls[ci_size];
|
|
420
|
-
* struct rb_kwarg_call_data kw_calls[ci_kw_size];
|
|
421
|
-
* Such that:
|
|
422
|
-
* struct rb_kwarg_call_data *kw_calls = &body->call_data[ci_size];
|
|
423
|
-
*/
|
|
461
|
+
struct rb_call_data *call_data; //struct rb_call_data calls[ci_size];
|
|
424
462
|
|
|
425
463
|
struct {
|
|
426
|
-
|
|
427
|
-
|
|
464
|
+
rb_snum_t flip_count;
|
|
465
|
+
VALUE script_lines;
|
|
466
|
+
VALUE coverage;
|
|
428
467
|
VALUE pc2branchindex;
|
|
429
|
-
|
|
468
|
+
VALUE *original_iseq;
|
|
430
469
|
} variable;
|
|
431
470
|
|
|
432
471
|
unsigned int local_table_size;
|
|
433
472
|
unsigned int is_size;
|
|
434
473
|
unsigned int ci_size;
|
|
435
|
-
unsigned int ci_kw_size;
|
|
436
474
|
unsigned int stack_max; /* for stack overflow check */
|
|
437
475
|
|
|
438
476
|
char catch_except_p; /* If a frame of this ISeq may catch exception, set TRUE */
|
|
477
|
+
// If true, this ISeq is leaf *and* backtraces are not used, for example,
|
|
478
|
+
// by rb_profile_frames. We verify only leafness on VM_CHECK_MODE though.
|
|
479
|
+
// Note that GC allocations might use backtraces due to
|
|
480
|
+
// ObjectSpace#trace_object_allocations.
|
|
481
|
+
// For more details, see: https://bugs.ruby-lang.org/issues/16956
|
|
482
|
+
bool builtin_inline_p;
|
|
483
|
+
struct rb_id_table *outer_variables;
|
|
439
484
|
|
|
440
485
|
#if USE_MJIT
|
|
441
486
|
/* The following fields are MJIT related info. */
|
|
@@ -444,6 +489,8 @@ struct rb_iseq_constant_body {
|
|
|
444
489
|
long unsigned total_calls; /* number of total calls with `mjit_exec()` */
|
|
445
490
|
struct rb_mjit_unit *jit_unit;
|
|
446
491
|
#endif
|
|
492
|
+
|
|
493
|
+
rb_yjit_block_array_array_t yjit_blocks; // empty, or has a size equal to iseq_size
|
|
447
494
|
};
|
|
448
495
|
|
|
449
496
|
/* T_IMEMO/iseq */
|
|
@@ -455,12 +502,12 @@ struct rb_iseq_struct {
|
|
|
455
502
|
struct rb_iseq_constant_body *body; /* 3 */
|
|
456
503
|
|
|
457
504
|
union { /* 4, 5 words */
|
|
458
|
-
|
|
505
|
+
struct iseq_compile_data *compile_data; /* used at compile time */
|
|
459
506
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
507
|
+
struct {
|
|
508
|
+
VALUE obj;
|
|
509
|
+
int index;
|
|
510
|
+
} loader;
|
|
464
511
|
|
|
465
512
|
struct {
|
|
466
513
|
struct rb_hook_list_struct *local_hooks;
|
|
@@ -482,7 +529,7 @@ rb_iseq_check(const rb_iseq_t *iseq)
|
|
|
482
529
|
{
|
|
483
530
|
#if USE_LAZY_LOAD
|
|
484
531
|
if (iseq->body == NULL) {
|
|
485
|
-
|
|
532
|
+
rb_iseq_complete((rb_iseq_t *)iseq);
|
|
486
533
|
}
|
|
487
534
|
#endif
|
|
488
535
|
return iseq;
|
|
@@ -492,7 +539,7 @@ static inline const rb_iseq_t *
|
|
|
492
539
|
def_iseq_ptr(rb_method_definition_t *def)
|
|
493
540
|
{
|
|
494
541
|
//TODO: re-visit. to check the bug, enable this assertion.
|
|
495
|
-
#if
|
|
542
|
+
#if VM_CHECK_MODE > 0
|
|
496
543
|
if (def->type != VM_METHOD_TYPE_ISEQ) rb_bug("def_iseq_ptr: not iseq (%d)", def->type);
|
|
497
544
|
#endif
|
|
498
545
|
return rb_iseq_check(def->body.iseq.iseqptr);
|
|
@@ -571,12 +618,30 @@ typedef const struct rb_builtin_function *RB_BUILTIN;
|
|
|
571
618
|
typedef struct rb_vm_struct {
|
|
572
619
|
VALUE self;
|
|
573
620
|
|
|
574
|
-
|
|
621
|
+
struct {
|
|
622
|
+
struct list_head set;
|
|
623
|
+
unsigned int cnt;
|
|
624
|
+
unsigned int blocking_cnt;
|
|
575
625
|
|
|
576
|
-
|
|
626
|
+
struct rb_ractor_struct *main_ractor;
|
|
627
|
+
struct rb_thread_struct *main_thread; // == vm->ractor.main_ractor->threads.main
|
|
577
628
|
|
|
578
|
-
|
|
579
|
-
|
|
629
|
+
struct {
|
|
630
|
+
// monitor
|
|
631
|
+
rb_nativethread_lock_t lock;
|
|
632
|
+
struct rb_ractor_struct *lock_owner;
|
|
633
|
+
unsigned int lock_rec;
|
|
634
|
+
|
|
635
|
+
// barrier
|
|
636
|
+
bool barrier_waiting;
|
|
637
|
+
unsigned int barrier_cnt;
|
|
638
|
+
rb_nativethread_cond_t barrier_cond;
|
|
639
|
+
|
|
640
|
+
// join at exit
|
|
641
|
+
rb_nativethread_cond_t terminate_cond;
|
|
642
|
+
bool terminate_waiting;
|
|
643
|
+
} sync;
|
|
644
|
+
} ractor;
|
|
580
645
|
|
|
581
646
|
#ifdef USE_SIGALTSTACK
|
|
582
647
|
void *main_altstack;
|
|
@@ -587,9 +652,6 @@ typedef struct rb_vm_struct {
|
|
|
587
652
|
struct list_head waiting_pids; /* PID > 0: <=> struct waitpid_state */
|
|
588
653
|
struct list_head waiting_grps; /* PID <= 0: <=> struct waitpid_state */
|
|
589
654
|
struct list_head waiting_fds; /* <=> struct waiting_fd */
|
|
590
|
-
struct list_head living_threads;
|
|
591
|
-
VALUE thgroup_default;
|
|
592
|
-
int living_thread_num;
|
|
593
655
|
|
|
594
656
|
/* set in single-threaded processes only: */
|
|
595
657
|
volatile int ubf_async_safe;
|
|
@@ -597,9 +659,7 @@ typedef struct rb_vm_struct {
|
|
|
597
659
|
unsigned int running: 1;
|
|
598
660
|
unsigned int thread_abort_on_exception: 1;
|
|
599
661
|
unsigned int thread_report_on_exception: 1;
|
|
600
|
-
|
|
601
|
-
unsigned int safe_level_: 1;
|
|
602
|
-
int sleeper;
|
|
662
|
+
unsigned int thread_ignore_deadlock: 1;
|
|
603
663
|
|
|
604
664
|
/* object management */
|
|
605
665
|
VALUE mark_object_ary;
|
|
@@ -613,23 +673,21 @@ typedef struct rb_vm_struct {
|
|
|
613
673
|
VALUE expanded_load_path;
|
|
614
674
|
VALUE loaded_features;
|
|
615
675
|
VALUE loaded_features_snapshot;
|
|
676
|
+
VALUE loaded_features_realpaths;
|
|
616
677
|
struct st_table *loaded_features_index;
|
|
617
678
|
struct st_table *loading_table;
|
|
618
679
|
|
|
619
680
|
/* signal */
|
|
620
681
|
struct {
|
|
621
|
-
|
|
682
|
+
VALUE cmd[RUBY_NSIG];
|
|
622
683
|
} trap_list;
|
|
623
684
|
|
|
624
|
-
/* hook */
|
|
625
|
-
rb_hook_list_t global_hooks;
|
|
626
|
-
|
|
627
685
|
/* relation table of ensure - rollback for callcc */
|
|
628
686
|
struct st_table *ensure_rollback_table;
|
|
629
687
|
|
|
630
688
|
/* postponed_job (async-signal-safe, NOT thread-safe) */
|
|
631
689
|
struct rb_postponed_job_struct *postponed_job_buffer;
|
|
632
|
-
|
|
690
|
+
rb_atomic_t postponed_job_index;
|
|
633
691
|
|
|
634
692
|
int src_encoding_index;
|
|
635
693
|
|
|
@@ -637,8 +695,8 @@ typedef struct rb_vm_struct {
|
|
|
637
695
|
struct list_head workqueue; /* <=> rb_workqueue_job.jnode */
|
|
638
696
|
rb_nativethread_lock_t workqueue_lock;
|
|
639
697
|
|
|
640
|
-
VALUE
|
|
641
|
-
VALUE coverages;
|
|
698
|
+
VALUE orig_progname, progname;
|
|
699
|
+
VALUE coverages, me2counter;
|
|
642
700
|
int coverage_mode;
|
|
643
701
|
|
|
644
702
|
st_table * defined_module_hash;
|
|
@@ -647,18 +705,28 @@ typedef struct rb_vm_struct {
|
|
|
647
705
|
|
|
648
706
|
rb_at_exit_list *at_exit;
|
|
649
707
|
|
|
650
|
-
VALUE *defined_strings;
|
|
651
708
|
st_table *frozen_strings;
|
|
652
709
|
|
|
653
710
|
const struct rb_builtin_function *builtin_function_table;
|
|
654
711
|
int builtin_inline_index;
|
|
655
712
|
|
|
713
|
+
struct rb_id_table *negative_cme_table;
|
|
714
|
+
|
|
715
|
+
#ifndef VM_GLOBAL_CC_CACHE_TABLE_SIZE
|
|
716
|
+
#define VM_GLOBAL_CC_CACHE_TABLE_SIZE 1023
|
|
717
|
+
#endif
|
|
718
|
+
const struct rb_callcache *global_cc_cache_table[VM_GLOBAL_CC_CACHE_TABLE_SIZE]; // vm_eval.c
|
|
719
|
+
|
|
720
|
+
#if defined(USE_VM_CLOCK) && USE_VM_CLOCK
|
|
721
|
+
uint32_t clock;
|
|
722
|
+
#endif
|
|
723
|
+
|
|
656
724
|
/* params */
|
|
657
725
|
struct { /* size in byte */
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
726
|
+
size_t thread_vm_stack_size;
|
|
727
|
+
size_t thread_machine_stack_size;
|
|
728
|
+
size_t fiber_vm_stack_size;
|
|
729
|
+
size_t fiber_machine_stack_size;
|
|
662
730
|
} default_params;
|
|
663
731
|
|
|
664
732
|
short redefined_flag[BOP_LAST_];
|
|
@@ -723,9 +791,9 @@ struct rb_captured_block {
|
|
|
723
791
|
VALUE self;
|
|
724
792
|
const VALUE *ep;
|
|
725
793
|
union {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
794
|
+
const rb_iseq_t *iseq;
|
|
795
|
+
const struct vm_ifunc *ifunc;
|
|
796
|
+
VALUE val;
|
|
729
797
|
} code;
|
|
730
798
|
};
|
|
731
799
|
|
|
@@ -745,25 +813,27 @@ enum rb_block_type {
|
|
|
745
813
|
|
|
746
814
|
struct rb_block {
|
|
747
815
|
union {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
816
|
+
struct rb_captured_block captured;
|
|
817
|
+
VALUE symbol;
|
|
818
|
+
VALUE proc;
|
|
751
819
|
} as;
|
|
752
820
|
enum rb_block_type type;
|
|
753
821
|
};
|
|
754
822
|
|
|
755
823
|
typedef struct rb_control_frame_struct {
|
|
756
|
-
const VALUE *pc;
|
|
757
|
-
VALUE *sp;
|
|
758
|
-
const rb_iseq_t *iseq;
|
|
759
|
-
VALUE self;
|
|
760
|
-
const VALUE *ep;
|
|
761
|
-
const void *block_code; /* cfp[5] / block[2] */ /* iseq or ifunc */
|
|
824
|
+
const VALUE *pc; /* cfp[0] */
|
|
825
|
+
VALUE *sp; /* cfp[1] */
|
|
826
|
+
const rb_iseq_t *iseq; /* cfp[2] */
|
|
827
|
+
VALUE self; /* cfp[3] / block[0] */
|
|
828
|
+
const VALUE *ep; /* cfp[4] / block[1] */
|
|
829
|
+
const void *block_code; /* cfp[5] / block[2] */ /* iseq or ifunc or forwarded block handler */
|
|
762
830
|
VALUE *__bp__; /* cfp[6] */ /* outside vm_push_frame, use vm_base_ptr instead. */
|
|
763
831
|
|
|
764
832
|
#if VM_DEBUG_BP_CHECK
|
|
765
|
-
VALUE *bp_check;
|
|
833
|
+
VALUE *bp_check; /* cfp[7] */
|
|
766
834
|
#endif
|
|
835
|
+
// Return address for YJIT code
|
|
836
|
+
void *jit_return;
|
|
767
837
|
} rb_control_frame_t;
|
|
768
838
|
|
|
769
839
|
extern const rb_data_type_t ruby_threadptr_data_type;
|
|
@@ -797,16 +867,13 @@ struct rb_vm_tag {
|
|
|
797
867
|
rb_jmpbuf_t buf;
|
|
798
868
|
struct rb_vm_tag *prev;
|
|
799
869
|
enum ruby_tag_type state;
|
|
870
|
+
unsigned int lock_rec;
|
|
800
871
|
};
|
|
801
872
|
|
|
802
873
|
STATIC_ASSERT(rb_vm_tag_buf_offset, offsetof(struct rb_vm_tag, buf) > 0);
|
|
803
874
|
STATIC_ASSERT(rb_vm_tag_buf_end,
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
struct rb_vm_protect_tag {
|
|
808
|
-
struct rb_vm_protect_tag *prev;
|
|
809
|
-
};
|
|
875
|
+
offsetof(struct rb_vm_tag, buf) + sizeof(rb_jmpbuf_t) <
|
|
876
|
+
sizeof(struct rb_vm_tag));
|
|
810
877
|
|
|
811
878
|
struct rb_unblock_callback {
|
|
812
879
|
rb_unblock_function_t *func;
|
|
@@ -815,11 +882,6 @@ struct rb_unblock_callback {
|
|
|
815
882
|
|
|
816
883
|
struct rb_mutex_struct;
|
|
817
884
|
|
|
818
|
-
typedef struct rb_thread_list_struct{
|
|
819
|
-
struct rb_thread_list_struct *next;
|
|
820
|
-
struct rb_thread_struct *th;
|
|
821
|
-
} rb_thread_list_t;
|
|
822
|
-
|
|
823
885
|
typedef struct rb_ensure_entry {
|
|
824
886
|
VALUE marker;
|
|
825
887
|
VALUE (*e_proc)(VALUE);
|
|
@@ -835,24 +897,32 @@ typedef char rb_thread_id_string_t[sizeof(rb_nativethread_id_t) * 2 + 3];
|
|
|
835
897
|
|
|
836
898
|
typedef struct rb_fiber_struct rb_fiber_t;
|
|
837
899
|
|
|
838
|
-
|
|
900
|
+
struct rb_waiting_list {
|
|
901
|
+
struct rb_waiting_list *next;
|
|
902
|
+
struct rb_thread_struct *thread;
|
|
903
|
+
struct rb_fiber_struct *fiber;
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
struct rb_execution_context_struct {
|
|
839
907
|
/* execution information */
|
|
840
|
-
VALUE *vm_stack;
|
|
908
|
+
VALUE *vm_stack; /* must free, must mark */
|
|
841
909
|
size_t vm_stack_size; /* size in word (byte size / sizeof(VALUE)) */
|
|
842
910
|
rb_control_frame_t *cfp;
|
|
843
911
|
|
|
844
912
|
struct rb_vm_tag *tag;
|
|
845
|
-
struct rb_vm_protect_tag *protect_tag;
|
|
846
913
|
|
|
847
914
|
/* interrupt flags */
|
|
848
915
|
rb_atomic_t interrupt_flag;
|
|
849
916
|
rb_atomic_t interrupt_mask; /* size should match flag */
|
|
917
|
+
#if defined(USE_VM_CLOCK) && USE_VM_CLOCK
|
|
918
|
+
uint32_t checked_clock;
|
|
919
|
+
#endif
|
|
850
920
|
|
|
851
921
|
rb_fiber_t *fiber_ptr;
|
|
852
922
|
struct rb_thread_struct *thread_ptr;
|
|
853
923
|
|
|
854
924
|
/* storage (ec (fiber) local) */
|
|
855
|
-
|
|
925
|
+
struct rb_id_table *local_storage;
|
|
856
926
|
VALUE local_storage_recursive_hash;
|
|
857
927
|
VALUE local_storage_recursive_hash_for_trace;
|
|
858
928
|
|
|
@@ -879,12 +949,17 @@ typedef struct rb_execution_context_struct {
|
|
|
879
949
|
|
|
880
950
|
/* for GC */
|
|
881
951
|
struct {
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
952
|
+
VALUE *stack_start;
|
|
953
|
+
VALUE *stack_end;
|
|
954
|
+
size_t stack_maxsize;
|
|
955
|
+
RUBY_ALIGNAS(SIZEOF_VALUE) jmp_buf regs;
|
|
886
956
|
} machine;
|
|
887
|
-
}
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
#ifndef rb_execution_context_t
|
|
960
|
+
typedef struct rb_execution_context_struct rb_execution_context_t;
|
|
961
|
+
#define rb_execution_context_t rb_execution_context_t
|
|
962
|
+
#endif
|
|
888
963
|
|
|
889
964
|
// for builtin.h
|
|
890
965
|
#define VM_CORE_H_EC_DEFINED 1
|
|
@@ -902,9 +977,20 @@ void rb_ec_initialize_vm_stack(rb_execution_context_t *ec, VALUE *stack, size_t
|
|
|
902
977
|
// @param ec the execution context to update.
|
|
903
978
|
void rb_ec_clear_vm_stack(rb_execution_context_t *ec);
|
|
904
979
|
|
|
980
|
+
struct rb_ext_config {
|
|
981
|
+
bool ractor_safe;
|
|
982
|
+
};
|
|
983
|
+
|
|
984
|
+
typedef struct rb_ractor_struct rb_ractor_t;
|
|
985
|
+
|
|
986
|
+
#if defined(__linux__) || defined(__FreeBSD__)
|
|
987
|
+
# define RB_THREAD_T_HAS_NATIVE_ID
|
|
988
|
+
#endif
|
|
989
|
+
|
|
905
990
|
typedef struct rb_thread_struct {
|
|
906
|
-
struct list_node
|
|
991
|
+
struct list_node lt_node; // managed by a ractor
|
|
907
992
|
VALUE self;
|
|
993
|
+
rb_ractor_t *ractor;
|
|
908
994
|
rb_vm_t *vm;
|
|
909
995
|
|
|
910
996
|
rb_execution_context_t *ec;
|
|
@@ -922,6 +1008,9 @@ typedef struct rb_thread_struct {
|
|
|
922
1008
|
rb_nativethread_id_t thread_id;
|
|
923
1009
|
#ifdef NON_SCALAR_THREAD_ID
|
|
924
1010
|
rb_thread_id_string_t thread_id_string;
|
|
1011
|
+
#endif
|
|
1012
|
+
#ifdef RB_THREAD_T_HAS_NATIVE_ID
|
|
1013
|
+
int tid;
|
|
925
1014
|
#endif
|
|
926
1015
|
BITFIELD(enum rb_thread_status, status, 2);
|
|
927
1016
|
/* bit flags */
|
|
@@ -953,7 +1042,7 @@ typedef struct rb_thread_struct {
|
|
|
953
1042
|
VALUE locking_mutex;
|
|
954
1043
|
struct rb_mutex_struct *keeping_mutexes;
|
|
955
1044
|
|
|
956
|
-
|
|
1045
|
+
struct rb_waiting_list *join_list;
|
|
957
1046
|
|
|
958
1047
|
union {
|
|
959
1048
|
struct {
|
|
@@ -967,9 +1056,10 @@ typedef struct rb_thread_struct {
|
|
|
967
1056
|
} func;
|
|
968
1057
|
} invoke_arg;
|
|
969
1058
|
|
|
970
|
-
enum {
|
|
1059
|
+
enum thread_invoke_type {
|
|
971
1060
|
thread_invoke_type_none = 0,
|
|
972
1061
|
thread_invoke_type_proc,
|
|
1062
|
+
thread_invoke_type_ractor_proc,
|
|
973
1063
|
thread_invoke_type_func
|
|
974
1064
|
} invoke_type;
|
|
975
1065
|
|
|
@@ -978,11 +1068,18 @@ typedef struct rb_thread_struct {
|
|
|
978
1068
|
|
|
979
1069
|
/* fiber */
|
|
980
1070
|
rb_fiber_t *root_fiber;
|
|
981
|
-
|
|
1071
|
+
|
|
1072
|
+
VALUE scheduler;
|
|
1073
|
+
unsigned blocking;
|
|
982
1074
|
|
|
983
1075
|
/* misc */
|
|
984
1076
|
VALUE name;
|
|
985
1077
|
|
|
1078
|
+
struct rb_ext_config ext_config;
|
|
1079
|
+
|
|
1080
|
+
#ifdef USE_SIGALTSTACK
|
|
1081
|
+
void *altstack;
|
|
1082
|
+
#endif
|
|
986
1083
|
} rb_thread_t;
|
|
987
1084
|
|
|
988
1085
|
typedef enum {
|
|
@@ -1004,11 +1101,13 @@ typedef enum {
|
|
|
1004
1101
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
1005
1102
|
|
|
1006
1103
|
/* node -> iseq */
|
|
1007
|
-
rb_iseq_t *rb_iseq_new (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath,
|
|
1008
|
-
rb_iseq_t *rb_iseq_new_top (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath,
|
|
1009
|
-
rb_iseq_t *rb_iseq_new_main (const rb_ast_body_t *ast, VALUE path, VALUE realpath,
|
|
1010
|
-
rb_iseq_t *
|
|
1011
|
-
|
|
1104
|
+
rb_iseq_t *rb_iseq_new (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, enum iseq_type);
|
|
1105
|
+
rb_iseq_t *rb_iseq_new_top (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent);
|
|
1106
|
+
rb_iseq_t *rb_iseq_new_main (const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_iseq_t *parent);
|
|
1107
|
+
rb_iseq_t *rb_iseq_new_eval (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth);
|
|
1108
|
+
rb_iseq_t *rb_iseq_new_with_opt(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth,
|
|
1109
|
+
enum iseq_type, const rb_compile_option_t*);
|
|
1110
|
+
|
|
1012
1111
|
struct iseq_link_anchor;
|
|
1013
1112
|
struct rb_iseq_new_with_callback_callback_func {
|
|
1014
1113
|
VALUE flags;
|
|
@@ -1043,10 +1142,17 @@ RUBY_SYMBOL_EXPORT_END
|
|
|
1043
1142
|
|
|
1044
1143
|
typedef struct {
|
|
1045
1144
|
const struct rb_block block;
|
|
1046
|
-
unsigned int is_from_method: 1;
|
|
1047
|
-
unsigned int is_lambda: 1;
|
|
1145
|
+
unsigned int is_from_method: 1; /* bool */
|
|
1146
|
+
unsigned int is_lambda: 1; /* bool */
|
|
1147
|
+
unsigned int is_isolated: 1; /* bool */
|
|
1048
1148
|
} rb_proc_t;
|
|
1049
1149
|
|
|
1150
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
|
1151
|
+
VALUE rb_proc_isolate(VALUE self);
|
|
1152
|
+
VALUE rb_proc_isolate_bang(VALUE self);
|
|
1153
|
+
VALUE rb_proc_ractor_make_shareable(VALUE self);
|
|
1154
|
+
RUBY_SYMBOL_EXPORT_END
|
|
1155
|
+
|
|
1050
1156
|
typedef struct {
|
|
1051
1157
|
VALUE flags; /* imemo header */
|
|
1052
1158
|
rb_iseq_t *iseq;
|
|
@@ -1077,35 +1183,6 @@ enum vm_check_match_type {
|
|
|
1077
1183
|
#define VM_CHECKMATCH_TYPE_MASK 0x03
|
|
1078
1184
|
#define VM_CHECKMATCH_ARRAY 0x04
|
|
1079
1185
|
|
|
1080
|
-
enum vm_call_flag_bits {
|
|
1081
|
-
VM_CALL_ARGS_SPLAT_bit, /* m(*args) */
|
|
1082
|
-
VM_CALL_ARGS_BLOCKARG_bit, /* m(&block) */
|
|
1083
|
-
VM_CALL_FCALL_bit, /* m(...) */
|
|
1084
|
-
VM_CALL_VCALL_bit, /* m */
|
|
1085
|
-
VM_CALL_ARGS_SIMPLE_bit, /* (ci->flag & (SPLAT|BLOCKARG)) && blockiseq == NULL && ci->kw_arg == NULL */
|
|
1086
|
-
VM_CALL_BLOCKISEQ_bit, /* has blockiseq */
|
|
1087
|
-
VM_CALL_KWARG_bit, /* has kwarg */
|
|
1088
|
-
VM_CALL_KW_SPLAT_bit, /* m(**opts) */
|
|
1089
|
-
VM_CALL_TAILCALL_bit, /* located at tail position */
|
|
1090
|
-
VM_CALL_SUPER_bit, /* super */
|
|
1091
|
-
VM_CALL_ZSUPER_bit, /* zsuper */
|
|
1092
|
-
VM_CALL_OPT_SEND_bit, /* internal flag */
|
|
1093
|
-
VM_CALL__END
|
|
1094
|
-
};
|
|
1095
|
-
|
|
1096
|
-
#define VM_CALL_ARGS_SPLAT (0x01 << VM_CALL_ARGS_SPLAT_bit)
|
|
1097
|
-
#define VM_CALL_ARGS_BLOCKARG (0x01 << VM_CALL_ARGS_BLOCKARG_bit)
|
|
1098
|
-
#define VM_CALL_FCALL (0x01 << VM_CALL_FCALL_bit)
|
|
1099
|
-
#define VM_CALL_VCALL (0x01 << VM_CALL_VCALL_bit)
|
|
1100
|
-
#define VM_CALL_ARGS_SIMPLE (0x01 << VM_CALL_ARGS_SIMPLE_bit)
|
|
1101
|
-
#define VM_CALL_BLOCKISEQ (0x01 << VM_CALL_BLOCKISEQ_bit)
|
|
1102
|
-
#define VM_CALL_KWARG (0x01 << VM_CALL_KWARG_bit)
|
|
1103
|
-
#define VM_CALL_KW_SPLAT (0x01 << VM_CALL_KW_SPLAT_bit)
|
|
1104
|
-
#define VM_CALL_TAILCALL (0x01 << VM_CALL_TAILCALL_bit)
|
|
1105
|
-
#define VM_CALL_SUPER (0x01 << VM_CALL_SUPER_bit)
|
|
1106
|
-
#define VM_CALL_ZSUPER (0x01 << VM_CALL_ZSUPER_bit)
|
|
1107
|
-
#define VM_CALL_OPT_SEND (0x01 << VM_CALL_OPT_SEND_bit)
|
|
1108
|
-
|
|
1109
1186
|
enum vm_special_object_type {
|
|
1110
1187
|
VM_SPECIAL_OBJECT_VMCORE = 1,
|
|
1111
1188
|
VM_SPECIAL_OBJECT_CBASE,
|
|
@@ -1121,10 +1198,12 @@ enum vm_svar_index {
|
|
|
1121
1198
|
};
|
|
1122
1199
|
|
|
1123
1200
|
/* inline cache */
|
|
1124
|
-
typedef struct
|
|
1201
|
+
typedef struct iseq_inline_constant_cache *IC;
|
|
1202
|
+
typedef struct iseq_inline_iv_cache_entry *IVC;
|
|
1203
|
+
typedef struct iseq_inline_cvar_cache_entry *ICVARC;
|
|
1125
1204
|
typedef union iseq_inline_storage_entry *ISE;
|
|
1126
|
-
typedef struct
|
|
1127
|
-
typedef struct
|
|
1205
|
+
typedef const struct rb_callinfo *CALL_INFO;
|
|
1206
|
+
typedef const struct rb_callcache *CALL_CACHE;
|
|
1128
1207
|
typedef struct rb_call_data *CALL_DATA;
|
|
1129
1208
|
|
|
1130
1209
|
typedef VALUE CDHASH;
|
|
@@ -1145,11 +1224,11 @@ typedef rb_control_frame_t *
|
|
|
1145
1224
|
|
|
1146
1225
|
enum {
|
|
1147
1226
|
/* Frame/Environment flag bits:
|
|
1148
|
-
* MMMM MMMM MMMM MMMM ____
|
|
1227
|
+
* MMMM MMMM MMMM MMMM ____ _FFF FFFF EEEX (LSB)
|
|
1149
1228
|
*
|
|
1150
1229
|
* X : tag for GC marking (It seems as Fixnum)
|
|
1151
1230
|
* EEE : 3 bits Env flags
|
|
1152
|
-
* FF..:
|
|
1231
|
+
* FF..: 7 bits Frame flags
|
|
1153
1232
|
* MM..: 15 bits frame magic (to check frame corruption)
|
|
1154
1233
|
*/
|
|
1155
1234
|
|
|
@@ -1167,19 +1246,19 @@ enum {
|
|
|
1167
1246
|
VM_FRAME_MAGIC_MASK = 0x7fff0001,
|
|
1168
1247
|
|
|
1169
1248
|
/* frame flag */
|
|
1170
|
-
VM_FRAME_FLAG_PASSED = 0x0010,
|
|
1171
1249
|
VM_FRAME_FLAG_FINISH = 0x0020,
|
|
1172
1250
|
VM_FRAME_FLAG_BMETHOD = 0x0040,
|
|
1173
1251
|
VM_FRAME_FLAG_CFRAME = 0x0080,
|
|
1174
1252
|
VM_FRAME_FLAG_LAMBDA = 0x0100,
|
|
1175
1253
|
VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM = 0x0200,
|
|
1176
1254
|
VM_FRAME_FLAG_CFRAME_KW = 0x0400,
|
|
1177
|
-
|
|
1255
|
+
VM_FRAME_FLAG_PASSED = 0x0800,
|
|
1178
1256
|
|
|
1179
1257
|
/* env flag */
|
|
1180
1258
|
VM_ENV_FLAG_LOCAL = 0x0002,
|
|
1181
1259
|
VM_ENV_FLAG_ESCAPED = 0x0004,
|
|
1182
|
-
VM_ENV_FLAG_WB_REQUIRED = 0x0008
|
|
1260
|
+
VM_ENV_FLAG_WB_REQUIRED = 0x0008,
|
|
1261
|
+
VM_ENV_FLAG_ISOLATED = 0x0010,
|
|
1183
1262
|
};
|
|
1184
1263
|
|
|
1185
1264
|
#define VM_ENV_DATA_SIZE ( 3)
|
|
@@ -1235,13 +1314,6 @@ VM_FRAME_CFRAME_KW_P(const rb_control_frame_t *cfp)
|
|
|
1235
1314
|
return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_CFRAME_KW) != 0;
|
|
1236
1315
|
}
|
|
1237
1316
|
|
|
1238
|
-
/* -- Remove In 3.0 -- */
|
|
1239
|
-
static inline int
|
|
1240
|
-
VM_FRAME_CFRAME_EMPTY_KW_P(const rb_control_frame_t *cfp)
|
|
1241
|
-
{
|
|
1242
|
-
return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_CFRAME_EMPTY_KW) != 0;
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
1317
|
static inline int
|
|
1246
1318
|
VM_FRAME_FINISHED_P(const rb_control_frame_t *cfp)
|
|
1247
1319
|
{
|
|
@@ -1324,6 +1396,7 @@ vm_assert_env(VALUE obj)
|
|
|
1324
1396
|
}
|
|
1325
1397
|
#endif
|
|
1326
1398
|
|
|
1399
|
+
RBIMPL_ATTR_NONNULL((1))
|
|
1327
1400
|
static inline VALUE
|
|
1328
1401
|
VM_ENV_ENVVAL(const VALUE *ep)
|
|
1329
1402
|
{
|
|
@@ -1333,6 +1406,7 @@ VM_ENV_ENVVAL(const VALUE *ep)
|
|
|
1333
1406
|
return envval;
|
|
1334
1407
|
}
|
|
1335
1408
|
|
|
1409
|
+
RBIMPL_ATTR_NONNULL((1))
|
|
1336
1410
|
static inline const rb_env_t *
|
|
1337
1411
|
VM_ENV_ENVVAL_PTR(const VALUE *ep)
|
|
1338
1412
|
{
|
|
@@ -1398,13 +1472,13 @@ VM_BH_ISEQ_BLOCK_P(VALUE block_handler)
|
|
|
1398
1472
|
{
|
|
1399
1473
|
if ((block_handler & 0x03) == 0x01) {
|
|
1400
1474
|
#if VM_CHECK_MODE > 0
|
|
1401
|
-
|
|
1402
|
-
|
|
1475
|
+
struct rb_captured_block *captured = VM_TAGGED_PTR_REF(block_handler, 0x03);
|
|
1476
|
+
VM_ASSERT(imemo_type_p(captured->code.val, imemo_iseq));
|
|
1403
1477
|
#endif
|
|
1404
|
-
|
|
1478
|
+
return 1;
|
|
1405
1479
|
}
|
|
1406
1480
|
else {
|
|
1407
|
-
|
|
1481
|
+
return 0;
|
|
1408
1482
|
}
|
|
1409
1483
|
}
|
|
1410
1484
|
|
|
@@ -1429,13 +1503,13 @@ VM_BH_IFUNC_P(VALUE block_handler)
|
|
|
1429
1503
|
{
|
|
1430
1504
|
if ((block_handler & 0x03) == 0x03) {
|
|
1431
1505
|
#if VM_CHECK_MODE > 0
|
|
1432
|
-
|
|
1433
|
-
|
|
1506
|
+
struct rb_captured_block *captured = (void *)(block_handler & ~0x03);
|
|
1507
|
+
VM_ASSERT(imemo_type_p(captured->code.val, imemo_ifunc));
|
|
1434
1508
|
#endif
|
|
1435
|
-
|
|
1509
|
+
return 1;
|
|
1436
1510
|
}
|
|
1437
1511
|
else {
|
|
1438
|
-
|
|
1512
|
+
return 0;
|
|
1439
1513
|
}
|
|
1440
1514
|
}
|
|
1441
1515
|
|
|
@@ -1467,17 +1541,17 @@ static inline enum rb_block_handler_type
|
|
|
1467
1541
|
vm_block_handler_type(VALUE block_handler)
|
|
1468
1542
|
{
|
|
1469
1543
|
if (VM_BH_ISEQ_BLOCK_P(block_handler)) {
|
|
1470
|
-
|
|
1544
|
+
return block_handler_type_iseq;
|
|
1471
1545
|
}
|
|
1472
1546
|
else if (VM_BH_IFUNC_P(block_handler)) {
|
|
1473
|
-
|
|
1547
|
+
return block_handler_type_ifunc;
|
|
1474
1548
|
}
|
|
1475
1549
|
else if (SYMBOL_P(block_handler)) {
|
|
1476
|
-
|
|
1550
|
+
return block_handler_type_symbol;
|
|
1477
1551
|
}
|
|
1478
1552
|
else {
|
|
1479
|
-
|
|
1480
|
-
|
|
1553
|
+
VM_ASSERT(rb_obj_is_proc(block_handler));
|
|
1554
|
+
return block_handler_type_proc;
|
|
1481
1555
|
}
|
|
1482
1556
|
}
|
|
1483
1557
|
|
|
@@ -1485,7 +1559,13 @@ static inline void
|
|
|
1485
1559
|
vm_block_handler_verify(MAYBE_UNUSED(VALUE block_handler))
|
|
1486
1560
|
{
|
|
1487
1561
|
VM_ASSERT(block_handler == VM_BLOCK_HANDLER_NONE ||
|
|
1488
|
-
|
|
1562
|
+
(vm_block_handler_type(block_handler), 1));
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
static inline int
|
|
1566
|
+
vm_cfp_forwarded_bh_p(const rb_control_frame_t *cfp, VALUE block_handler)
|
|
1567
|
+
{
|
|
1568
|
+
return ((VALUE) cfp->block_code) == block_handler;
|
|
1489
1569
|
}
|
|
1490
1570
|
|
|
1491
1571
|
static inline enum rb_block_type
|
|
@@ -1494,17 +1574,17 @@ vm_block_type(const struct rb_block *block)
|
|
|
1494
1574
|
#if VM_CHECK_MODE > 0
|
|
1495
1575
|
switch (block->type) {
|
|
1496
1576
|
case block_type_iseq:
|
|
1497
|
-
|
|
1498
|
-
|
|
1577
|
+
VM_ASSERT(imemo_type_p(block->as.captured.code.val, imemo_iseq));
|
|
1578
|
+
break;
|
|
1499
1579
|
case block_type_ifunc:
|
|
1500
|
-
|
|
1501
|
-
|
|
1580
|
+
VM_ASSERT(imemo_type_p(block->as.captured.code.val, imemo_ifunc));
|
|
1581
|
+
break;
|
|
1502
1582
|
case block_type_symbol:
|
|
1503
|
-
|
|
1504
|
-
|
|
1583
|
+
VM_ASSERT(SYMBOL_P(block->as.symbol));
|
|
1584
|
+
break;
|
|
1505
1585
|
case block_type_proc:
|
|
1506
|
-
|
|
1507
|
-
|
|
1586
|
+
VM_ASSERT(rb_obj_is_proc(block->as.proc));
|
|
1587
|
+
break;
|
|
1508
1588
|
}
|
|
1509
1589
|
#endif
|
|
1510
1590
|
return block->type;
|
|
@@ -1571,11 +1651,11 @@ vm_block_self(const struct rb_block *block)
|
|
|
1571
1651
|
switch (vm_block_type(block)) {
|
|
1572
1652
|
case block_type_iseq:
|
|
1573
1653
|
case block_type_ifunc:
|
|
1574
|
-
|
|
1654
|
+
return block->as.captured.self;
|
|
1575
1655
|
case block_type_proc:
|
|
1576
|
-
|
|
1656
|
+
return vm_block_self(vm_proc_block(block->as.proc));
|
|
1577
1657
|
case block_type_symbol:
|
|
1578
|
-
|
|
1658
|
+
return Qundef;
|
|
1579
1659
|
}
|
|
1580
1660
|
VM_UNREACHABLE(vm_block_self);
|
|
1581
1661
|
return Qundef;
|
|
@@ -1627,7 +1707,8 @@ extern void rb_vmdebug_debug_print_post(const rb_execution_context_t *ec, const
|
|
|
1627
1707
|
#define SDR() rb_vmdebug_stack_dump_raw(GET_EC(), GET_EC()->cfp)
|
|
1628
1708
|
#define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_EC(), (cfp))
|
|
1629
1709
|
void rb_vm_bugreport(const void *);
|
|
1630
|
-
typedef
|
|
1710
|
+
typedef void (*ruby_sighandler_t)(int);
|
|
1711
|
+
RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 4, 5)
|
|
1631
1712
|
NORETURN(void rb_bug_for_fatal_signal(ruby_sighandler_t default_sighandler, int sig, const void *, const char *fmt, ...));
|
|
1632
1713
|
|
|
1633
1714
|
/* functions about thread/vm execution */
|
|
@@ -1664,13 +1745,12 @@ VALUE rb_vm_env_local_variables(const rb_env_t *env);
|
|
|
1664
1745
|
const rb_env_t *rb_vm_env_prev_env(const rb_env_t *env);
|
|
1665
1746
|
const VALUE *rb_binding_add_dynavars(VALUE bindval, rb_binding_t *bind, int dyncount, const ID *dynvars);
|
|
1666
1747
|
void rb_vm_inc_const_missing_count(void);
|
|
1667
|
-
void rb_vm_gvl_destroy(rb_vm_t *vm);
|
|
1668
|
-
VALUE rb_vm_call(rb_execution_context_t *ec, VALUE recv, VALUE id, int argc,
|
|
1669
|
-
const VALUE *argv, const rb_callable_method_entry_t *me);
|
|
1670
1748
|
VALUE rb_vm_call_kw(rb_execution_context_t *ec, VALUE recv, VALUE id, int argc,
|
|
1671
1749
|
const VALUE *argv, const rb_callable_method_entry_t *me, int kw_splat);
|
|
1672
1750
|
MJIT_STATIC void rb_vm_pop_frame(rb_execution_context_t *ec);
|
|
1673
1751
|
|
|
1752
|
+
void rb_gvl_destroy(rb_global_vm_lock_t *gvl);
|
|
1753
|
+
|
|
1674
1754
|
void rb_thread_start_timer_thread(void);
|
|
1675
1755
|
void rb_thread_stop_timer_thread(void);
|
|
1676
1756
|
void rb_thread_reset_timer_thread(void);
|
|
@@ -1683,22 +1763,7 @@ rb_vm_living_threads_init(rb_vm_t *vm)
|
|
|
1683
1763
|
list_head_init(&vm->waiting_pids);
|
|
1684
1764
|
list_head_init(&vm->workqueue);
|
|
1685
1765
|
list_head_init(&vm->waiting_grps);
|
|
1686
|
-
list_head_init(&vm->
|
|
1687
|
-
vm->living_thread_num = 0;
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
static inline void
|
|
1691
|
-
rb_vm_living_threads_insert(rb_vm_t *vm, rb_thread_t *th)
|
|
1692
|
-
{
|
|
1693
|
-
list_add_tail(&vm->living_threads, &th->vmlt_node);
|
|
1694
|
-
vm->living_thread_num++;
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
|
-
static inline void
|
|
1698
|
-
rb_vm_living_threads_remove(rb_vm_t *vm, rb_thread_t *th)
|
|
1699
|
-
{
|
|
1700
|
-
list_del(&th->vmlt_node);
|
|
1701
|
-
vm->living_thread_num--;
|
|
1766
|
+
list_head_init(&vm->ractor.set);
|
|
1702
1767
|
}
|
|
1703
1768
|
|
|
1704
1769
|
typedef int rb_backtrace_iter_func(void *, VALUE, int, VALUE);
|
|
@@ -1707,6 +1772,8 @@ rb_control_frame_t *rb_vm_get_binding_creatable_next_cfp(const rb_execution_cont
|
|
|
1707
1772
|
int rb_vm_get_sourceline(const rb_control_frame_t *);
|
|
1708
1773
|
void rb_vm_stack_to_heap(rb_execution_context_t *ec);
|
|
1709
1774
|
void ruby_thread_init_stack(rb_thread_t *th);
|
|
1775
|
+
rb_thread_t * ruby_thread_from_native(void);
|
|
1776
|
+
int ruby_thread_set_native(rb_thread_t *th);
|
|
1710
1777
|
int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, ID *called_idp, VALUE *klassp);
|
|
1711
1778
|
void rb_vm_rewind_cfp(rb_execution_context_t *ec, rb_control_frame_t *cfp);
|
|
1712
1779
|
MJIT_STATIC VALUE rb_vm_bh_to_procval(const rb_execution_context_t *ec, VALUE block_handler);
|
|
@@ -1724,36 +1791,39 @@ MJIT_STATIC const rb_callable_method_entry_t *rb_vm_frame_method_entry(const rb_
|
|
|
1724
1791
|
|
|
1725
1792
|
#define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]
|
|
1726
1793
|
|
|
1727
|
-
#define
|
|
1728
|
-
|
|
1729
|
-
(
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1794
|
+
#define CHECK_VM_STACK_OVERFLOW0(cfp, sp, margin) do { \
|
|
1795
|
+
STATIC_ASSERT(sizeof_sp, sizeof(*(sp)) == sizeof(VALUE)); \
|
|
1796
|
+
STATIC_ASSERT(sizeof_cfp, sizeof(*(cfp)) == sizeof(rb_control_frame_t)); \
|
|
1797
|
+
const struct rb_control_frame_struct *bound = (void *)&(sp)[(margin)]; \
|
|
1798
|
+
if (UNLIKELY((cfp) <= &bound[1])) { \
|
|
1799
|
+
vm_stackoverflow(); \
|
|
1800
|
+
} \
|
|
1801
|
+
} while (0)
|
|
1802
|
+
|
|
1736
1803
|
#define CHECK_VM_STACK_OVERFLOW(cfp, margin) \
|
|
1737
|
-
|
|
1804
|
+
CHECK_VM_STACK_OVERFLOW0((cfp), (cfp)->sp, (margin))
|
|
1738
1805
|
|
|
1739
1806
|
VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, enum ruby_tag_type *stateptr);
|
|
1740
1807
|
|
|
1808
|
+
rb_execution_context_t *rb_vm_main_ractor_ec(rb_vm_t *vm); // ractor.c
|
|
1809
|
+
|
|
1741
1810
|
/* for thread */
|
|
1742
1811
|
|
|
1743
1812
|
#if RUBY_VM_THREAD_MODEL == 2
|
|
1744
|
-
|
|
1813
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
|
1745
1814
|
|
|
1815
|
+
RUBY_EXTERN struct rb_ractor_struct *ruby_single_main_ractor; // ractor.c
|
|
1746
1816
|
RUBY_EXTERN rb_vm_t *ruby_current_vm_ptr;
|
|
1747
|
-
RUBY_EXTERN rb_execution_context_t *ruby_current_execution_context_ptr;
|
|
1748
1817
|
RUBY_EXTERN rb_event_flag_t ruby_vm_event_flags;
|
|
1749
1818
|
RUBY_EXTERN rb_event_flag_t ruby_vm_event_enabled_global_flags;
|
|
1750
1819
|
RUBY_EXTERN unsigned int ruby_vm_event_local_num;
|
|
1751
1820
|
|
|
1752
|
-
|
|
1821
|
+
MJIT_SYMBOL_EXPORT_END
|
|
1753
1822
|
|
|
1754
1823
|
#define GET_VM() rb_current_vm()
|
|
1824
|
+
#define GET_RACTOR() rb_current_ractor()
|
|
1755
1825
|
#define GET_THREAD() rb_current_thread()
|
|
1756
|
-
#define GET_EC() rb_current_execution_context()
|
|
1826
|
+
#define GET_EC() rb_current_execution_context(true)
|
|
1757
1827
|
|
|
1758
1828
|
static inline rb_thread_t *
|
|
1759
1829
|
rb_ec_thread_ptr(const rb_execution_context_t *ec)
|
|
@@ -1761,22 +1831,45 @@ rb_ec_thread_ptr(const rb_execution_context_t *ec)
|
|
|
1761
1831
|
return ec->thread_ptr;
|
|
1762
1832
|
}
|
|
1763
1833
|
|
|
1834
|
+
static inline rb_ractor_t *
|
|
1835
|
+
rb_ec_ractor_ptr(const rb_execution_context_t *ec)
|
|
1836
|
+
{
|
|
1837
|
+
const rb_thread_t *th = rb_ec_thread_ptr(ec);
|
|
1838
|
+
if (th) {
|
|
1839
|
+
VM_ASSERT(th->ractor != NULL);
|
|
1840
|
+
return th->ractor;
|
|
1841
|
+
}
|
|
1842
|
+
else {
|
|
1843
|
+
return NULL;
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1764
1847
|
static inline rb_vm_t *
|
|
1765
1848
|
rb_ec_vm_ptr(const rb_execution_context_t *ec)
|
|
1766
1849
|
{
|
|
1767
1850
|
const rb_thread_t *th = rb_ec_thread_ptr(ec);
|
|
1768
1851
|
if (th) {
|
|
1769
|
-
|
|
1852
|
+
return th->vm;
|
|
1770
1853
|
}
|
|
1771
1854
|
else {
|
|
1772
|
-
|
|
1855
|
+
return NULL;
|
|
1773
1856
|
}
|
|
1774
1857
|
}
|
|
1775
1858
|
|
|
1776
1859
|
static inline rb_execution_context_t *
|
|
1777
|
-
rb_current_execution_context(
|
|
1778
|
-
{
|
|
1779
|
-
|
|
1860
|
+
rb_current_execution_context(bool expect_ec)
|
|
1861
|
+
{
|
|
1862
|
+
#ifdef RB_THREAD_LOCAL_SPECIFIER
|
|
1863
|
+
#ifdef __APPLE__
|
|
1864
|
+
rb_execution_context_t *ec = rb_current_ec();
|
|
1865
|
+
#else
|
|
1866
|
+
rb_execution_context_t *ec = ruby_current_ec;
|
|
1867
|
+
#endif
|
|
1868
|
+
#else
|
|
1869
|
+
rb_execution_context_t *ec = native_tls_get(ruby_current_ec_key);
|
|
1870
|
+
#endif
|
|
1871
|
+
VM_ASSERT(!expect_ec || ec != NULL);
|
|
1872
|
+
return ec;
|
|
1780
1873
|
}
|
|
1781
1874
|
|
|
1782
1875
|
static inline rb_thread_t *
|
|
@@ -1786,30 +1879,47 @@ rb_current_thread(void)
|
|
|
1786
1879
|
return rb_ec_thread_ptr(ec);
|
|
1787
1880
|
}
|
|
1788
1881
|
|
|
1882
|
+
static inline rb_ractor_t *
|
|
1883
|
+
rb_current_ractor(void)
|
|
1884
|
+
{
|
|
1885
|
+
if (ruby_single_main_ractor) {
|
|
1886
|
+
return ruby_single_main_ractor;
|
|
1887
|
+
}
|
|
1888
|
+
else {
|
|
1889
|
+
const rb_execution_context_t *ec = GET_EC();
|
|
1890
|
+
return rb_ec_ractor_ptr(ec);
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1789
1894
|
static inline rb_vm_t *
|
|
1790
1895
|
rb_current_vm(void)
|
|
1791
1896
|
{
|
|
1897
|
+
#if 0 // TODO: reconsider the assertions
|
|
1792
1898
|
VM_ASSERT(ruby_current_vm_ptr == NULL ||
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1899
|
+
ruby_current_execution_context_ptr == NULL ||
|
|
1900
|
+
rb_ec_thread_ptr(GET_EC()) == NULL ||
|
|
1901
|
+
rb_ec_thread_ptr(GET_EC())->status == THREAD_KILLED ||
|
|
1902
|
+
rb_ec_vm_ptr(GET_EC()) == ruby_current_vm_ptr);
|
|
1903
|
+
#endif
|
|
1904
|
+
|
|
1796
1905
|
return ruby_current_vm_ptr;
|
|
1797
1906
|
}
|
|
1798
1907
|
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
ruby_current_execution_context_ptr = th->ec;
|
|
1803
|
-
}
|
|
1908
|
+
void rb_ec_vm_lock_rec_release(const rb_execution_context_t *ec,
|
|
1909
|
+
unsigned int recorded_lock_rec,
|
|
1910
|
+
unsigned int current_lock_rec);
|
|
1804
1911
|
|
|
1805
|
-
static inline
|
|
1806
|
-
|
|
1912
|
+
static inline unsigned int
|
|
1913
|
+
rb_ec_vm_lock_rec(const rb_execution_context_t *ec)
|
|
1807
1914
|
{
|
|
1808
|
-
|
|
1809
|
-
|
|
1915
|
+
rb_vm_t *vm = rb_ec_vm_ptr(ec);
|
|
1916
|
+
|
|
1917
|
+
if (vm->ractor.sync.lock_owner != rb_ec_ractor_ptr(ec)) {
|
|
1918
|
+
return 0;
|
|
1919
|
+
}
|
|
1920
|
+
else {
|
|
1921
|
+
return vm->ractor.sync.lock_rec;
|
|
1810
1922
|
}
|
|
1811
|
-
rb_thread_set_current_raw(th);
|
|
1812
|
-
th->vm->running_thread = th;
|
|
1813
1923
|
}
|
|
1814
1924
|
|
|
1815
1925
|
#else
|
|
@@ -1820,16 +1930,33 @@ enum {
|
|
|
1820
1930
|
TIMER_INTERRUPT_MASK = 0x01,
|
|
1821
1931
|
PENDING_INTERRUPT_MASK = 0x02,
|
|
1822
1932
|
POSTPONED_JOB_INTERRUPT_MASK = 0x04,
|
|
1823
|
-
TRAP_INTERRUPT_MASK
|
|
1933
|
+
TRAP_INTERRUPT_MASK = 0x08,
|
|
1934
|
+
TERMINATE_INTERRUPT_MASK = 0x10,
|
|
1935
|
+
VM_BARRIER_INTERRUPT_MASK = 0x20,
|
|
1824
1936
|
};
|
|
1825
1937
|
|
|
1826
|
-
#define RUBY_VM_SET_TIMER_INTERRUPT(ec)
|
|
1827
|
-
#define RUBY_VM_SET_INTERRUPT(ec)
|
|
1828
|
-
#define RUBY_VM_SET_POSTPONED_JOB_INTERRUPT(ec)
|
|
1829
|
-
#define RUBY_VM_SET_TRAP_INTERRUPT(ec)
|
|
1830
|
-
#define
|
|
1831
|
-
|
|
1832
|
-
#define
|
|
1938
|
+
#define RUBY_VM_SET_TIMER_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, TIMER_INTERRUPT_MASK)
|
|
1939
|
+
#define RUBY_VM_SET_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, PENDING_INTERRUPT_MASK)
|
|
1940
|
+
#define RUBY_VM_SET_POSTPONED_JOB_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, POSTPONED_JOB_INTERRUPT_MASK)
|
|
1941
|
+
#define RUBY_VM_SET_TRAP_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, TRAP_INTERRUPT_MASK)
|
|
1942
|
+
#define RUBY_VM_SET_TERMINATE_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, TERMINATE_INTERRUPT_MASK)
|
|
1943
|
+
#define RUBY_VM_SET_VM_BARRIER_INTERRUPT(ec) ATOMIC_OR((ec)->interrupt_flag, VM_BARRIER_INTERRUPT_MASK)
|
|
1944
|
+
#define RUBY_VM_INTERRUPTED(ec) ((ec)->interrupt_flag & ~(ec)->interrupt_mask & \
|
|
1945
|
+
(PENDING_INTERRUPT_MASK|TRAP_INTERRUPT_MASK))
|
|
1946
|
+
|
|
1947
|
+
static inline bool
|
|
1948
|
+
RUBY_VM_INTERRUPTED_ANY(rb_execution_context_t *ec)
|
|
1949
|
+
{
|
|
1950
|
+
#if defined(USE_VM_CLOCK) && USE_VM_CLOCK
|
|
1951
|
+
uint32_t current_clock = rb_ec_vm_ptr(ec)->clock;
|
|
1952
|
+
|
|
1953
|
+
if (current_clock != ec->checked_clock) {
|
|
1954
|
+
ec->checked_clock = current_clock;
|
|
1955
|
+
RUBY_VM_SET_TIMER_INTERRUPT(ec);
|
|
1956
|
+
}
|
|
1957
|
+
#endif
|
|
1958
|
+
return ec->interrupt_flag & ~(ec)->interrupt_mask;
|
|
1959
|
+
}
|
|
1833
1960
|
|
|
1834
1961
|
VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt);
|
|
1835
1962
|
int rb_signal_buff_size(void);
|
|
@@ -1842,11 +1969,17 @@ void rb_threadptr_interrupt(rb_thread_t *th);
|
|
|
1842
1969
|
void rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th);
|
|
1843
1970
|
void rb_threadptr_pending_interrupt_clear(rb_thread_t *th);
|
|
1844
1971
|
void rb_threadptr_pending_interrupt_enque(rb_thread_t *th, VALUE v);
|
|
1972
|
+
VALUE rb_ec_get_errinfo(const rb_execution_context_t *ec);
|
|
1845
1973
|
void rb_ec_error_print(rb_execution_context_t * volatile ec, volatile VALUE errinfo);
|
|
1846
1974
|
void rb_execution_context_update(const rb_execution_context_t *ec);
|
|
1847
1975
|
void rb_execution_context_mark(const rb_execution_context_t *ec);
|
|
1848
1976
|
void rb_fiber_close(rb_fiber_t *fib);
|
|
1849
1977
|
void Init_native_thread(rb_thread_t *th);
|
|
1978
|
+
int rb_vm_check_ints_blocking(rb_execution_context_t *ec);
|
|
1979
|
+
|
|
1980
|
+
// vm_sync.h
|
|
1981
|
+
void rb_vm_cond_wait(rb_vm_t *vm, rb_nativethread_cond_t *cond);
|
|
1982
|
+
void rb_vm_cond_timedwait(rb_vm_t *vm, rb_nativethread_cond_t *cond, unsigned long msec);
|
|
1850
1983
|
|
|
1851
1984
|
#define RUBY_VM_CHECK_INTS(ec) rb_vm_check_ints(ec)
|
|
1852
1985
|
static inline void
|
|
@@ -1854,7 +1987,7 @@ rb_vm_check_ints(rb_execution_context_t *ec)
|
|
|
1854
1987
|
{
|
|
1855
1988
|
VM_ASSERT(ec == GET_EC());
|
|
1856
1989
|
if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(ec))) {
|
|
1857
|
-
|
|
1990
|
+
rb_threadptr_execute_interrupts(rb_ec_thread_ptr(ec), 0);
|
|
1858
1991
|
}
|
|
1859
1992
|
}
|
|
1860
1993
|
|
|
@@ -1915,17 +2048,24 @@ rb_exec_event_hook_orig(rb_execution_context_t *ec, rb_hook_list_t *hooks, rb_ev
|
|
|
1915
2048
|
rb_exec_event_hooks(&trace_arg, hooks, pop_p);
|
|
1916
2049
|
}
|
|
1917
2050
|
|
|
2051
|
+
struct rb_ractor_pub {
|
|
2052
|
+
VALUE self;
|
|
2053
|
+
uint32_t id;
|
|
2054
|
+
rb_hook_list_t hooks;
|
|
2055
|
+
};
|
|
2056
|
+
|
|
1918
2057
|
static inline rb_hook_list_t *
|
|
1919
|
-
|
|
2058
|
+
rb_ec_ractor_hooks(const rb_execution_context_t *ec)
|
|
1920
2059
|
{
|
|
1921
|
-
|
|
2060
|
+
struct rb_ractor_pub *cr_pub = (struct rb_ractor_pub *)rb_ec_ractor_ptr(ec);
|
|
2061
|
+
return &cr_pub->hooks;
|
|
1922
2062
|
}
|
|
1923
2063
|
|
|
1924
2064
|
#define EXEC_EVENT_HOOK(ec_, flag_, self_, id_, called_id_, klass_, data_) \
|
|
1925
|
-
EXEC_EVENT_HOOK_ORIG(ec_,
|
|
2065
|
+
EXEC_EVENT_HOOK_ORIG(ec_, rb_ec_ractor_hooks(ec_), flag_, self_, id_, called_id_, klass_, data_, 0)
|
|
1926
2066
|
|
|
1927
2067
|
#define EXEC_EVENT_HOOK_AND_POP_FRAME(ec_, flag_, self_, id_, called_id_, klass_, data_) \
|
|
1928
|
-
EXEC_EVENT_HOOK_ORIG(ec_,
|
|
2068
|
+
EXEC_EVENT_HOOK_ORIG(ec_, rb_ec_ractor_hooks(ec_), flag_, self_, id_, called_id_, klass_, data_, 1)
|
|
1929
2069
|
|
|
1930
2070
|
static inline void
|
|
1931
2071
|
rb_exec_event_hook_script_compiled(rb_execution_context_t *ec, const rb_iseq_t *iseq, VALUE eval_script)
|
|
@@ -1949,9 +2089,15 @@ extern VALUE rb_get_coverages(void);
|
|
|
1949
2089
|
extern void rb_set_coverages(VALUE, int, VALUE);
|
|
1950
2090
|
extern void rb_clear_coverages(void);
|
|
1951
2091
|
extern void rb_reset_coverages(void);
|
|
2092
|
+
extern void rb_resume_coverages(void);
|
|
2093
|
+
extern void rb_suspend_coverages(void);
|
|
1952
2094
|
|
|
1953
2095
|
void rb_postponed_job_flush(rb_vm_t *vm);
|
|
1954
2096
|
|
|
2097
|
+
// ractor.c
|
|
2098
|
+
RUBY_EXTERN VALUE rb_eRactorUnsafeError;
|
|
2099
|
+
RUBY_EXTERN VALUE rb_eRactorIsolationError;
|
|
2100
|
+
|
|
1955
2101
|
RUBY_SYMBOL_EXPORT_END
|
|
1956
2102
|
|
|
1957
2103
|
#endif /* RUBY_VM_CORE_H */
|