debase-ruby_core_source 0.10.9 → 0.10.13
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,566 @@
|
|
1
|
+
#ifndef INTERNAL_BITS_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_BITS_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @brief Internal header for bitwise integer algorithms.
|
11
|
+
* @see Henry S. Warren Jr., "Hacker's Delight" (2nd ed.), 2013.
|
12
|
+
* @see SEI CERT C Coding Standard INT32-C. "Ensure that operations on
|
13
|
+
* signed integers do not result in overflow"
|
14
|
+
* @see https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
|
15
|
+
* @see https://clang.llvm.org/docs/LanguageExtensions.html#builtin-rotateleft
|
16
|
+
* @see https://clang.llvm.org/docs/LanguageExtensions.html#builtin-rotateright
|
17
|
+
* @see https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/byteswap-uint64-byteswap-ulong-byteswap-ushort
|
18
|
+
* @see https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/rotl-rotl64-rotr-rotr64
|
19
|
+
* @see https://docs.microsoft.com/en-us/cpp/intrinsics/bitscanforward-bitscanforward64
|
20
|
+
* @see https://docs.microsoft.com/en-us/cpp/intrinsics/bitscanreverse-bitscanreverse64
|
21
|
+
* @see https://docs.microsoft.com/en-us/cpp/intrinsics/lzcnt16-lzcnt-lzcnt64
|
22
|
+
* @see https://docs.microsoft.com/en-us/cpp/intrinsics/popcnt16-popcnt-popcnt64
|
23
|
+
* @see https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_lzcnt_u32
|
24
|
+
* @see https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_tzcnt_u32
|
25
|
+
* @see https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_rotl64
|
26
|
+
* @see https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_rotr64
|
27
|
+
* @see https://stackoverflow.com/a/776523
|
28
|
+
*/
|
29
|
+
#include "ruby/internal/config.h"
|
30
|
+
#include <limits.h> /* for CHAR_BITS */
|
31
|
+
#include <stdint.h> /* for uintptr_t */
|
32
|
+
#include "internal/compilers.h" /* for MSC_VERSION_SINCE */
|
33
|
+
|
34
|
+
#if MSC_VERSION_SINCE(1310)
|
35
|
+
# include <stdlib.h> /* for _byteswap_uint64 */
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#if defined(HAVE_X86INTRIN_H) && ! defined(MJIT_HEADER)
|
39
|
+
# /* Rule out MJIT_HEADER, which does not interface well with <immintrin.h> */
|
40
|
+
# include <x86intrin.h> /* for _lzcnt_u64 */
|
41
|
+
#elif MSC_VERSION_SINCE(1310)
|
42
|
+
# include <intrin.h> /* for the following intrinsics */
|
43
|
+
#endif
|
44
|
+
|
45
|
+
#if defined(_MSC_VER) && defined(__AVX__)
|
46
|
+
# pragma intrinsic(__popcnt)
|
47
|
+
# pragma intrinsic(__popcnt64)
|
48
|
+
#endif
|
49
|
+
|
50
|
+
#if defined(_MSC_VER) && defined(__AVX2__)
|
51
|
+
# pragma intrinsic(__lzcnt)
|
52
|
+
# pragma intrinsic(__lzcnt64)
|
53
|
+
#endif
|
54
|
+
|
55
|
+
#if MSC_VERSION_SINCE(1310)
|
56
|
+
# pragma intrinsic(_rotl)
|
57
|
+
# pragma intrinsic(_rotr)
|
58
|
+
# ifdef _WIN64
|
59
|
+
# pragma intrinsic(_rotl64)
|
60
|
+
# pragma intrinsic(_rotr64)
|
61
|
+
# endif
|
62
|
+
#endif
|
63
|
+
|
64
|
+
#if MSC_VERSION_SINCE(1400)
|
65
|
+
# pragma intrinsic(_BitScanForward)
|
66
|
+
# pragma intrinsic(_BitScanReverse)
|
67
|
+
# ifdef _WIN64
|
68
|
+
# pragma intrinsic(_BitScanForward64)
|
69
|
+
# pragma intrinsic(_BitScanReverse64)
|
70
|
+
# endif
|
71
|
+
#endif
|
72
|
+
|
73
|
+
#include "ruby/ruby.h" /* for VALUE */
|
74
|
+
#include "internal/static_assert.h" /* for STATIC_ASSERT */
|
75
|
+
|
76
|
+
/* The most significant bit of the lower part of half-long integer.
|
77
|
+
* If sizeof(long) == 4, this is 0x8000.
|
78
|
+
* If sizeof(long) == 8, this is 0x80000000.
|
79
|
+
*/
|
80
|
+
#define HALF_LONG_MSB ((SIGNED_VALUE)1<<((SIZEOF_LONG*CHAR_BIT-1)/2))
|
81
|
+
|
82
|
+
#define SIGNED_INTEGER_TYPE_P(T) (0 > ((T)0)-1)
|
83
|
+
|
84
|
+
#define SIGNED_INTEGER_MIN(T) \
|
85
|
+
((sizeof(T) == sizeof(int8_t)) ? ((T)INT8_MIN) : \
|
86
|
+
((sizeof(T) == sizeof(int16_t)) ? ((T)INT16_MIN) : \
|
87
|
+
((sizeof(T) == sizeof(int32_t)) ? ((T)INT32_MIN) : \
|
88
|
+
((sizeof(T) == sizeof(int64_t)) ? ((T)INT64_MIN) : \
|
89
|
+
0))))
|
90
|
+
|
91
|
+
#define SIGNED_INTEGER_MAX(T) ((T)(SIGNED_INTEGER_MIN(T) ^ ((T)~(T)0)))
|
92
|
+
|
93
|
+
#define UNSIGNED_INTEGER_MAX(T) ((T)~(T)0)
|
94
|
+
|
95
|
+
#if __has_builtin(__builtin_mul_overflow_p)
|
96
|
+
# define MUL_OVERFLOW_P(a, b) \
|
97
|
+
__builtin_mul_overflow_p((a), (b), (__typeof__(a * b))0)
|
98
|
+
#elif __has_builtin(__builtin_mul_overflow)
|
99
|
+
# define MUL_OVERFLOW_P(a, b) \
|
100
|
+
__extension__ ({ __typeof__(a) c; __builtin_mul_overflow((a), (b), &c); })
|
101
|
+
#endif
|
102
|
+
|
103
|
+
#define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
|
104
|
+
(a) == 0 ? 0 : \
|
105
|
+
(a) == -1 ? (b) < -(max) : \
|
106
|
+
(a) > 0 ? \
|
107
|
+
((b) > 0 ? (max) / (a) < (b) : (min) / (a) > (b)) : \
|
108
|
+
((b) > 0 ? (min) / (a) < (b) : (max) / (a) > (b)))
|
109
|
+
|
110
|
+
#if __has_builtin(__builtin_mul_overflow_p)
|
111
|
+
/* __builtin_mul_overflow_p can take bitfield */
|
112
|
+
/* and GCC permits bitfields for integers other than int */
|
113
|
+
# define MUL_OVERFLOW_FIXNUM_P(a, b) \
|
114
|
+
__extension__ ({ \
|
115
|
+
struct { long fixnum : sizeof(long) * CHAR_BIT - 1; } c = { 0 }; \
|
116
|
+
__builtin_mul_overflow_p((a), (b), c.fixnum); \
|
117
|
+
})
|
118
|
+
#else
|
119
|
+
# define MUL_OVERFLOW_FIXNUM_P(a, b) \
|
120
|
+
MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
|
121
|
+
#endif
|
122
|
+
|
123
|
+
#ifdef MUL_OVERFLOW_P
|
124
|
+
# define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_P(a, b)
|
125
|
+
# define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_P(a, b)
|
126
|
+
# define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_P(a, b)
|
127
|
+
#else
|
128
|
+
# define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LLONG_MIN, LLONG_MAX)
|
129
|
+
# define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
|
130
|
+
# define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
|
131
|
+
#endif
|
132
|
+
|
133
|
+
#ifdef HAVE_UINT128_T
|
134
|
+
# define bit_length(x) \
|
135
|
+
(unsigned int) \
|
136
|
+
(sizeof(x) <= sizeof(int32_t) ? 32 - nlz_int32((uint32_t)(x)) : \
|
137
|
+
sizeof(x) <= sizeof(int64_t) ? 64 - nlz_int64((uint64_t)(x)) : \
|
138
|
+
128 - nlz_int128((uint128_t)(x)))
|
139
|
+
#else
|
140
|
+
# define bit_length(x) \
|
141
|
+
(unsigned int) \
|
142
|
+
(sizeof(x) <= sizeof(int32_t) ? 32 - nlz_int32((uint32_t)(x)) : \
|
143
|
+
64 - nlz_int64((uint64_t)(x)))
|
144
|
+
#endif
|
145
|
+
|
146
|
+
#ifndef swap16
|
147
|
+
# define swap16 ruby_swap16
|
148
|
+
#endif
|
149
|
+
|
150
|
+
#ifndef swap32
|
151
|
+
# define swap32 ruby_swap32
|
152
|
+
#endif
|
153
|
+
|
154
|
+
#ifndef swap64
|
155
|
+
# define swap64 ruby_swap64
|
156
|
+
#endif
|
157
|
+
|
158
|
+
static inline uint16_t ruby_swap16(uint16_t);
|
159
|
+
static inline uint32_t ruby_swap32(uint32_t);
|
160
|
+
static inline uint64_t ruby_swap64(uint64_t);
|
161
|
+
static inline unsigned nlz_int(unsigned x);
|
162
|
+
static inline unsigned nlz_long(unsigned long x);
|
163
|
+
static inline unsigned nlz_long_long(unsigned long long x);
|
164
|
+
static inline unsigned nlz_intptr(uintptr_t x);
|
165
|
+
static inline unsigned nlz_int32(uint32_t x);
|
166
|
+
static inline unsigned nlz_int64(uint64_t x);
|
167
|
+
#ifdef HAVE_UINT128_T
|
168
|
+
static inline unsigned nlz_int128(uint128_t x);
|
169
|
+
#endif
|
170
|
+
static inline unsigned rb_popcount32(uint32_t x);
|
171
|
+
static inline unsigned rb_popcount64(uint64_t x);
|
172
|
+
static inline unsigned rb_popcount_intptr(uintptr_t x);
|
173
|
+
static inline int ntz_int32(uint32_t x);
|
174
|
+
static inline int ntz_int64(uint64_t x);
|
175
|
+
static inline int ntz_intptr(uintptr_t x);
|
176
|
+
static inline VALUE RUBY_BIT_ROTL(VALUE, int);
|
177
|
+
static inline VALUE RUBY_BIT_ROTR(VALUE, int);
|
178
|
+
|
179
|
+
static inline uint16_t
|
180
|
+
ruby_swap16(uint16_t x)
|
181
|
+
{
|
182
|
+
#if __has_builtin(__builtin_bswap16)
|
183
|
+
return __builtin_bswap16(x);
|
184
|
+
|
185
|
+
#elif MSC_VERSION_SINCE(1310)
|
186
|
+
return _byteswap_ushort(x);
|
187
|
+
|
188
|
+
#else
|
189
|
+
return (x << 8) | (x >> 8);
|
190
|
+
|
191
|
+
#endif
|
192
|
+
}
|
193
|
+
|
194
|
+
static inline uint32_t
|
195
|
+
ruby_swap32(uint32_t x)
|
196
|
+
{
|
197
|
+
#if __has_builtin(__builtin_bswap32)
|
198
|
+
return __builtin_bswap32(x);
|
199
|
+
|
200
|
+
#elif MSC_VERSION_SINCE(1310)
|
201
|
+
return _byteswap_ulong(x);
|
202
|
+
|
203
|
+
#else
|
204
|
+
x = ((x & 0x0000FFFF) << 16) | ((x & 0xFFFF0000) >> 16);
|
205
|
+
x = ((x & 0x00FF00FF) << 8) | ((x & 0xFF00FF00) >> 8);
|
206
|
+
return x;
|
207
|
+
|
208
|
+
#endif
|
209
|
+
}
|
210
|
+
|
211
|
+
static inline uint64_t
|
212
|
+
ruby_swap64(uint64_t x)
|
213
|
+
{
|
214
|
+
#if __has_builtin(__builtin_bswap64)
|
215
|
+
return __builtin_bswap64(x);
|
216
|
+
|
217
|
+
#elif MSC_VERSION_SINCE(1310)
|
218
|
+
return _byteswap_uint64(x);
|
219
|
+
|
220
|
+
#else
|
221
|
+
x = ((x & 0x00000000FFFFFFFFULL) << 32) | ((x & 0xFFFFFFFF00000000ULL) >> 32);
|
222
|
+
x = ((x & 0x0000FFFF0000FFFFULL) << 16) | ((x & 0xFFFF0000FFFF0000ULL) >> 16);
|
223
|
+
x = ((x & 0x00FF00FF00FF00FFULL) << 8) | ((x & 0xFF00FF00FF00FF00ULL) >> 8);
|
224
|
+
return x;
|
225
|
+
|
226
|
+
#endif
|
227
|
+
}
|
228
|
+
|
229
|
+
static inline unsigned int
|
230
|
+
nlz_int32(uint32_t x)
|
231
|
+
{
|
232
|
+
#if defined(_MSC_VER) && defined(__AVX2__)
|
233
|
+
/* Note: It seems there is no such thing like __LZCNT__ predefined in MSVC.
|
234
|
+
* AMD CPUs have had this instruction for decades (since K10) but for
|
235
|
+
* Intel, Haswell is the oldest one. We need to use __AVX2__ for maximum
|
236
|
+
* safety. */
|
237
|
+
return (unsigned int)__lzcnt(x);
|
238
|
+
|
239
|
+
#elif defined(__x86_64__) && defined(__LZCNT__) && ! defined(MJIT_HEADER)
|
240
|
+
return (unsigned int)_lzcnt_u32(x);
|
241
|
+
|
242
|
+
#elif MSC_VERSION_SINCE(1400) /* &&! defined(__AVX2__) */
|
243
|
+
unsigned long r;
|
244
|
+
return _BitScanReverse(&r, x) ? (31 - (int)r) : 32;
|
245
|
+
|
246
|
+
#elif __has_builtin(__builtin_clz)
|
247
|
+
STATIC_ASSERT(sizeof_int, sizeof(int) * CHAR_BIT == 32);
|
248
|
+
return x ? (unsigned int)__builtin_clz(x) : 32;
|
249
|
+
|
250
|
+
#else
|
251
|
+
uint32_t y;
|
252
|
+
unsigned n = 32;
|
253
|
+
y = x >> 16; if (y) {n -= 16; x = y;}
|
254
|
+
y = x >> 8; if (y) {n -= 8; x = y;}
|
255
|
+
y = x >> 4; if (y) {n -= 4; x = y;}
|
256
|
+
y = x >> 2; if (y) {n -= 2; x = y;}
|
257
|
+
y = x >> 1; if (y) {return n - 2;}
|
258
|
+
return (unsigned int)(n - x);
|
259
|
+
#endif
|
260
|
+
}
|
261
|
+
|
262
|
+
static inline unsigned int
|
263
|
+
nlz_int64(uint64_t x)
|
264
|
+
{
|
265
|
+
#if defined(_MSC_VER) && defined(__AVX2__)
|
266
|
+
return (unsigned int)__lzcnt64(x);
|
267
|
+
|
268
|
+
#elif defined(__x86_64__) && defined(__LZCNT__) && ! defined(MJIT_HEADER)
|
269
|
+
return (unsigned int)_lzcnt_u64(x);
|
270
|
+
|
271
|
+
#elif defined(_WIN64) && MSC_VERSION_SINCE(1400) /* &&! defined(__AVX2__) */
|
272
|
+
unsigned long r;
|
273
|
+
return _BitScanReverse64(&r, x) ? (63u - (unsigned int)r) : 64;
|
274
|
+
|
275
|
+
#elif __has_builtin(__builtin_clzl)
|
276
|
+
if (x == 0) {
|
277
|
+
return 64;
|
278
|
+
}
|
279
|
+
else if (sizeof(long) * CHAR_BIT == 64) {
|
280
|
+
return (unsigned int)__builtin_clzl((unsigned long)x);
|
281
|
+
}
|
282
|
+
else if (sizeof(long long) * CHAR_BIT == 64) {
|
283
|
+
return (unsigned int)__builtin_clzll((unsigned long long)x);
|
284
|
+
}
|
285
|
+
else {
|
286
|
+
/* :FIXME: Is there a way to make this branch a compile-time error? */
|
287
|
+
__builtin_unreachable();
|
288
|
+
}
|
289
|
+
|
290
|
+
#else
|
291
|
+
uint64_t y;
|
292
|
+
unsigned int n = 64;
|
293
|
+
y = x >> 32; if (y) {n -= 32; x = y;}
|
294
|
+
y = x >> 16; if (y) {n -= 16; x = y;}
|
295
|
+
y = x >> 8; if (y) {n -= 8; x = y;}
|
296
|
+
y = x >> 4; if (y) {n -= 4; x = y;}
|
297
|
+
y = x >> 2; if (y) {n -= 2; x = y;}
|
298
|
+
y = x >> 1; if (y) {return n - 2;}
|
299
|
+
return (unsigned int)(n - x);
|
300
|
+
|
301
|
+
#endif
|
302
|
+
}
|
303
|
+
|
304
|
+
#ifdef HAVE_UINT128_T
|
305
|
+
static inline unsigned int
|
306
|
+
nlz_int128(uint128_t x)
|
307
|
+
{
|
308
|
+
uint64_t y = (uint64_t)(x >> 64);
|
309
|
+
|
310
|
+
if (x == 0) {
|
311
|
+
return 128;
|
312
|
+
}
|
313
|
+
else if (y == 0) {
|
314
|
+
return (unsigned int)nlz_int64(x) + 64;
|
315
|
+
}
|
316
|
+
else {
|
317
|
+
return (unsigned int)nlz_int64(y);
|
318
|
+
}
|
319
|
+
}
|
320
|
+
#endif
|
321
|
+
|
322
|
+
static inline unsigned int
|
323
|
+
nlz_int(unsigned int x)
|
324
|
+
{
|
325
|
+
if (sizeof(unsigned int) * CHAR_BIT == 32) {
|
326
|
+
return nlz_int32((uint32_t)x);
|
327
|
+
}
|
328
|
+
else if (sizeof(unsigned int) * CHAR_BIT == 64) {
|
329
|
+
return nlz_int64((uint64_t)x);
|
330
|
+
}
|
331
|
+
else {
|
332
|
+
UNREACHABLE_RETURN(~0);
|
333
|
+
}
|
334
|
+
}
|
335
|
+
|
336
|
+
static inline unsigned int
|
337
|
+
nlz_long(unsigned long x)
|
338
|
+
{
|
339
|
+
if (sizeof(unsigned long) * CHAR_BIT == 32) {
|
340
|
+
return nlz_int32((uint32_t)x);
|
341
|
+
}
|
342
|
+
else if (sizeof(unsigned long) * CHAR_BIT == 64) {
|
343
|
+
return nlz_int64((uint64_t)x);
|
344
|
+
}
|
345
|
+
else {
|
346
|
+
UNREACHABLE_RETURN(~0);
|
347
|
+
}
|
348
|
+
}
|
349
|
+
|
350
|
+
static inline unsigned int
|
351
|
+
nlz_long_long(unsigned long long x)
|
352
|
+
{
|
353
|
+
if (sizeof(unsigned long long) * CHAR_BIT == 64) {
|
354
|
+
return nlz_int64((uint64_t)x);
|
355
|
+
}
|
356
|
+
#ifdef HAVE_UINT128_T
|
357
|
+
else if (sizeof(unsigned long long) * CHAR_BIT == 128) {
|
358
|
+
return nlz_int128((uint128_t)x);
|
359
|
+
}
|
360
|
+
#endif
|
361
|
+
else {
|
362
|
+
UNREACHABLE_RETURN(~0);
|
363
|
+
}
|
364
|
+
}
|
365
|
+
|
366
|
+
static inline unsigned int
|
367
|
+
nlz_intptr(uintptr_t x)
|
368
|
+
{
|
369
|
+
if (sizeof(uintptr_t) == sizeof(unsigned int)) {
|
370
|
+
return nlz_int((unsigned int)x);
|
371
|
+
}
|
372
|
+
if (sizeof(uintptr_t) == sizeof(unsigned long)) {
|
373
|
+
return nlz_long((unsigned long)x);
|
374
|
+
}
|
375
|
+
if (sizeof(uintptr_t) == sizeof(unsigned long long)) {
|
376
|
+
return nlz_long_long((unsigned long long)x);
|
377
|
+
}
|
378
|
+
else {
|
379
|
+
UNREACHABLE_RETURN(~0);
|
380
|
+
}
|
381
|
+
}
|
382
|
+
|
383
|
+
static inline unsigned int
|
384
|
+
rb_popcount32(uint32_t x)
|
385
|
+
{
|
386
|
+
#if defined(_MSC_VER) && defined(__AVX__)
|
387
|
+
/* Note: CPUs since Nehalem and Barcelona have had this instruction so SSE
|
388
|
+
* 4.2 should suffice, but it seems there is no such thing like __SSE_4_2__
|
389
|
+
* predefined macro in MSVC. They do have __AVX__ so use it instead. */
|
390
|
+
return (unsigned int)__popcnt(x);
|
391
|
+
|
392
|
+
#elif __has_builtin(__builtin_popcount)
|
393
|
+
STATIC_ASSERT(sizeof_int, sizeof(int) * CHAR_BIT >= 32);
|
394
|
+
return (unsigned int)__builtin_popcount(x);
|
395
|
+
|
396
|
+
#else
|
397
|
+
x = (x & 0x55555555) + (x >> 1 & 0x55555555);
|
398
|
+
x = (x & 0x33333333) + (x >> 2 & 0x33333333);
|
399
|
+
x = (x & 0x0f0f0f0f) + (x >> 4 & 0x0f0f0f0f);
|
400
|
+
x = (x & 0x001f001f) + (x >> 8 & 0x001f001f);
|
401
|
+
x = (x & 0x0000003f) + (x >>16 & 0x0000003f);
|
402
|
+
return (unsigned int)x;
|
403
|
+
|
404
|
+
#endif
|
405
|
+
}
|
406
|
+
|
407
|
+
static inline unsigned int
|
408
|
+
rb_popcount64(uint64_t x)
|
409
|
+
{
|
410
|
+
#if defined(_MSC_VER) && defined(__AVX__)
|
411
|
+
return (unsigned int)__popcnt64(x);
|
412
|
+
|
413
|
+
#elif __has_builtin(__builtin_popcount)
|
414
|
+
if (sizeof(long) * CHAR_BIT == 64) {
|
415
|
+
return (unsigned int)__builtin_popcountl((unsigned long)x);
|
416
|
+
}
|
417
|
+
else if (sizeof(long long) * CHAR_BIT == 64) {
|
418
|
+
return (unsigned int)__builtin_popcountll((unsigned long long)x);
|
419
|
+
}
|
420
|
+
else {
|
421
|
+
/* :FIXME: Is there a way to make this branch a compile-time error? */
|
422
|
+
__builtin_unreachable();
|
423
|
+
}
|
424
|
+
|
425
|
+
#else
|
426
|
+
x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
|
427
|
+
x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
|
428
|
+
x = (x & 0x0707070707070707) + (x >> 4 & 0x0707070707070707);
|
429
|
+
x = (x & 0x001f001f001f001f) + (x >> 8 & 0x001f001f001f001f);
|
430
|
+
x = (x & 0x0000003f0000003f) + (x >>16 & 0x0000003f0000003f);
|
431
|
+
x = (x & 0x000000000000007f) + (x >>32 & 0x000000000000007f);
|
432
|
+
return (unsigned int)x;
|
433
|
+
|
434
|
+
#endif
|
435
|
+
}
|
436
|
+
|
437
|
+
static inline unsigned int
|
438
|
+
rb_popcount_intptr(uintptr_t x)
|
439
|
+
{
|
440
|
+
if (sizeof(uintptr_t) * CHAR_BIT == 64) {
|
441
|
+
return rb_popcount64((uint64_t)x);
|
442
|
+
}
|
443
|
+
else if (sizeof(uintptr_t) * CHAR_BIT == 32) {
|
444
|
+
return rb_popcount32((uint32_t)x);
|
445
|
+
}
|
446
|
+
else {
|
447
|
+
UNREACHABLE_RETURN(~0);
|
448
|
+
}
|
449
|
+
}
|
450
|
+
|
451
|
+
static inline int
|
452
|
+
ntz_int32(uint32_t x)
|
453
|
+
{
|
454
|
+
#if defined(__x86_64__) && defined(__BMI__) && ! defined(MJIT_HEADER)
|
455
|
+
return (unsigned)_tzcnt_u32(x);
|
456
|
+
|
457
|
+
#elif MSC_VERSION_SINCE(1400)
|
458
|
+
/* :FIXME: Is there any way to issue TZCNT instead of BSF, apart from using
|
459
|
+
* assembly? Because issuing LZCNT seems possible (see nlz.h). */
|
460
|
+
unsigned long r;
|
461
|
+
return _BitScanForward(&r, x) ? (int)r : 32;
|
462
|
+
|
463
|
+
#elif __has_builtin(__builtin_ctz)
|
464
|
+
STATIC_ASSERT(sizeof_int, sizeof(int) * CHAR_BIT == 32);
|
465
|
+
return x ? (unsigned)__builtin_ctz(x) : 32;
|
466
|
+
|
467
|
+
#else
|
468
|
+
return rb_popcount32((~x) & (x-1));
|
469
|
+
|
470
|
+
#endif
|
471
|
+
}
|
472
|
+
|
473
|
+
static inline int
|
474
|
+
ntz_int64(uint64_t x)
|
475
|
+
{
|
476
|
+
#if defined(__x86_64__) && defined(__BMI__) && ! defined(MJIT_HEADER)
|
477
|
+
return (unsigned)_tzcnt_u64(x);
|
478
|
+
|
479
|
+
#elif defined(_WIN64) && MSC_VERSION_SINCE(1400)
|
480
|
+
unsigned long r;
|
481
|
+
return _BitScanForward64(&r, x) ? (int)r : 64;
|
482
|
+
|
483
|
+
#elif __has_builtin(__builtin_ctzl)
|
484
|
+
if (x == 0) {
|
485
|
+
return 64;
|
486
|
+
}
|
487
|
+
else if (sizeof(long) * CHAR_BIT == 64) {
|
488
|
+
return (unsigned)__builtin_ctzl((unsigned long)x);
|
489
|
+
}
|
490
|
+
else if (sizeof(long long) * CHAR_BIT == 64) {
|
491
|
+
return (unsigned)__builtin_ctzll((unsigned long long)x);
|
492
|
+
}
|
493
|
+
else {
|
494
|
+
/* :FIXME: Is there a way to make this branch a compile-time error? */
|
495
|
+
__builtin_unreachable();
|
496
|
+
}
|
497
|
+
|
498
|
+
#else
|
499
|
+
return rb_popcount64((~x) & (x-1));
|
500
|
+
|
501
|
+
#endif
|
502
|
+
}
|
503
|
+
|
504
|
+
static inline int
|
505
|
+
ntz_intptr(uintptr_t x)
|
506
|
+
{
|
507
|
+
if (sizeof(uintptr_t) * CHAR_BIT == 64) {
|
508
|
+
return ntz_int64((uint64_t)x);
|
509
|
+
}
|
510
|
+
else if (sizeof(uintptr_t) * CHAR_BIT == 32) {
|
511
|
+
return ntz_int32((uint32_t)x);
|
512
|
+
}
|
513
|
+
else {
|
514
|
+
UNREACHABLE_RETURN(~0);
|
515
|
+
}
|
516
|
+
}
|
517
|
+
|
518
|
+
static inline VALUE
|
519
|
+
RUBY_BIT_ROTL(VALUE v, int n)
|
520
|
+
{
|
521
|
+
#if __has_builtin(__builtin_rotateleft32) && (SIZEOF_VALUE * CHAR_BIT == 32)
|
522
|
+
return __builtin_rotateleft32(v, n);
|
523
|
+
|
524
|
+
#elif __has_builtin(__builtin_rotateleft64) && (SIZEOF_VALUE * CHAR_BIT == 64)
|
525
|
+
return __builtin_rotateleft64(v, n);
|
526
|
+
|
527
|
+
#elif MSC_VERSION_SINCE(1310) && (SIZEOF_VALUE * CHAR_BIT == 32)
|
528
|
+
return _rotl(v, n);
|
529
|
+
|
530
|
+
#elif MSC_VERSION_SINCE(1310) && (SIZEOF_VALUE * CHAR_BIT == 64)
|
531
|
+
return _rotl64(v, n);
|
532
|
+
|
533
|
+
#elif defined(_lrotl) && (SIZEOF_VALUE == SIZEOF_LONG)
|
534
|
+
return _lrotl(v, n);
|
535
|
+
|
536
|
+
#else
|
537
|
+
const int m = (sizeof(VALUE) * CHAR_BIT) - 1;
|
538
|
+
return (v << (n & m)) | (v >> (-n & m));
|
539
|
+
#endif
|
540
|
+
}
|
541
|
+
|
542
|
+
static inline VALUE
|
543
|
+
RUBY_BIT_ROTR(VALUE v, int n)
|
544
|
+
{
|
545
|
+
#if __has_builtin(__builtin_rotateright32) && (SIZEOF_VALUE * CHAR_BIT == 32)
|
546
|
+
return __builtin_rotateright32(v, n);
|
547
|
+
|
548
|
+
#elif __has_builtin(__builtin_rotateright64) && (SIZEOF_VALUE * CHAR_BIT == 64)
|
549
|
+
return __builtin_rotateright64(v, n);
|
550
|
+
|
551
|
+
#elif MSC_VERSION_SINCE(1310) && (SIZEOF_VALUE * CHAR_BIT == 32)
|
552
|
+
return _rotr(v, n);
|
553
|
+
|
554
|
+
#elif MSC_VERSION_SINCE(1310) && (SIZEOF_VALUE * CHAR_BIT == 64)
|
555
|
+
return _rotr64(v, n);
|
556
|
+
|
557
|
+
#elif defined(_lrotr) && (SIZEOF_VALUE == SIZEOF_LONG)
|
558
|
+
return _lrotr(v, n);
|
559
|
+
|
560
|
+
#else
|
561
|
+
const int m = (sizeof(VALUE) * CHAR_BIT) - 1;
|
562
|
+
return (v << (-n & m)) | (v >> (n & m));
|
563
|
+
#endif
|
564
|
+
}
|
565
|
+
|
566
|
+
#endif /* INTERNAL_BITS_H */
|