summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/baseruby.yml1
-rw-r--r--.github/workflows/compilers.yml51
-rw-r--r--.github/workflows/macos.yml2
-rw-r--r--.github/workflows/mjit.yml2
-rw-r--r--.github/workflows/spec_guards.yml2
-rw-r--r--.github/workflows/ubuntu.yml9
-rw-r--r--.github/workflows/windows.yml26
-rw-r--r--.travis.yml226
-rw-r--r--LEGAL3
-rw-r--r--NEWS.md70
-rw-r--r--README.md4
-rw-r--r--appveyor.yml4
-rw-r--r--array.c98
-rw-r--r--ast.c89
-rw-r--r--ast.rb259
-rw-r--r--benchmark/README.md2
-rw-r--r--benchmark/ivar_extend.yml23
-rw-r--r--benchmark/masgn.yml29
-rw-r--r--benchmark/mjit_integer.yml2
-rw-r--r--benchmark/nilclass.yml6
-rw-r--r--benchmark/vm_case_classes.yml9
-rw-r--r--bootstraptest/test_ractor.rb3
-rw-r--r--builtin.c2
-rw-r--r--builtin.h2
-rw-r--r--ccan/list/list.h2
-rw-r--r--class.c19
-rw-r--r--common.mk100
-rw-r--r--compile.c2161
-rw-r--r--complex.c16
-rw-r--r--configure.ac158
-rw-r--r--cont.c14
-rw-r--r--coroutine/copy/Context.h3
-rw-r--r--coroutine/ucontext/Context.h3
-rw-r--r--coverage/README2
-rw-r--r--debug_counter.h4
-rw-r--r--defs/gmake.mk1
-rw-r--r--dir.c113
-rw-r--r--dir.rb178
-rw-r--r--dln.c16
-rw-r--r--doc/extension.rdoc2
-rw-r--r--doc/fiber.md7
-rw-r--r--doc/irb/irb.rd.ja2
-rw-r--r--doc/maintainers.rdoc50
-rw-r--r--doc/standard_library.rdoc15
-rw-r--r--doc/syntax/literals.rdoc2
-rw-r--r--doc/syntax/methods.rdoc88
-rw-r--r--doc/time/in.rdoc7
-rw-r--r--doc/time/mon-min.rdoc8
-rw-r--r--doc/time/msec.rdoc2
-rw-r--r--doc/time/nsec.rdoc2
-rw-r--r--doc/time/sec.rdoc2
-rw-r--r--doc/time/sec_i.rdoc1
-rw-r--r--doc/time/usec.rdoc2
-rw-r--r--doc/time/year.rdoc1
-rw-r--r--doc/time/zone_and_in.rdoc8
-rw-r--r--enc/depend65
-rw-r--r--enum.c265
-rw-r--r--enumerator.c11
-rw-r--r--error.c2
-rw-r--r--eval_intern.h2
-rw-r--r--eval_jump.c2
-rw-r--r--ext/-test-/RUBY_ALIGNOF/depend1
-rw-r--r--ext/-test-/arith_seq/extract/depend1
-rw-r--r--ext/-test-/array/resize/depend1
-rw-r--r--ext/-test-/bignum/depend7
-rw-r--r--ext/-test-/bug-14834/depend1
-rw-r--r--ext/-test-/bug-3571/depend1
-rw-r--r--ext/-test-/bug-5832/depend1
-rw-r--r--ext/-test-/bug_reporter/depend1
-rw-r--r--ext/-test-/class/depend2
-rw-r--r--ext/-test-/cxxanyargs/extconf.rb4
-rw-r--r--ext/-test-/debug/depend3
-rw-r--r--ext/-test-/enumerator_kw/depend1
-rw-r--r--ext/-test-/exception/depend4
-rw-r--r--ext/-test-/fatal/depend1
-rw-r--r--ext/-test-/file/depend3
-rw-r--r--ext/-test-/float/depend2
-rw-r--r--ext/-test-/funcall/depend1
-rw-r--r--ext/-test-/gvl/call_without_gvl/depend1
-rw-r--r--ext/-test-/hash/depend2
-rw-r--r--ext/-test-/integer/depend3
-rw-r--r--ext/-test-/iseq_load/depend1
-rw-r--r--ext/-test-/iter/depend3
-rw-r--r--ext/-test-/load/protect/depend1
-rw-r--r--ext/-test-/marshal/compat/depend1
-rw-r--r--ext/-test-/marshal/internal_ivar/depend1
-rw-r--r--ext/-test-/marshal/usr/depend1
-rw-r--r--ext/-test-/memory_status/depend1
-rw-r--r--ext/-test-/memory_view/depend1
-rw-r--r--ext/-test-/method/depend2
-rw-r--r--ext/-test-/notimplement/depend1
-rw-r--r--ext/-test-/num2int/depend1
-rw-r--r--ext/-test-/path_to_class/depend1
-rw-r--r--ext/-test-/popen_deadlock/depend1
-rw-r--r--ext/-test-/postponed_job/depend1
-rw-r--r--ext/-test-/printf/depend1
-rw-r--r--ext/-test-/proc/depend3
-rw-r--r--ext/-test-/random/depend2
-rw-r--r--ext/-test-/rational/depend1
-rw-r--r--ext/-test-/rb_call_super_kw/depend1
-rw-r--r--ext/-test-/recursion/depend1
-rw-r--r--ext/-test-/regexp/depend2
-rw-r--r--ext/-test-/scan_args/depend1
-rw-r--r--ext/-test-/st/foreach/depend1
-rw-r--r--ext/-test-/st/numhash/depend1
-rw-r--r--ext/-test-/st/update/depend1
-rw-r--r--ext/-test-/string/depend16
-rw-r--r--ext/-test-/struct/depend4
-rw-r--r--ext/-test-/symbol/depend2
-rw-r--r--ext/-test-/thread_fd_close/depend1
-rw-r--r--ext/-test-/time/depend3
-rw-r--r--ext/-test-/tracepoint/depend2
-rw-r--r--ext/-test-/typeddata/depend1
-rw-r--r--ext/-test-/vm/depend1
-rw-r--r--ext/-test-/wait_for_single_fd/depend1
-rw-r--r--ext/bigdecimal/depend2
-rw-r--r--ext/bigdecimal/missing.h2
-rw-r--r--ext/cgi/escape/depend1
-rw-r--r--ext/cgi/escape/escape.c2
-rw-r--r--ext/continuation/depend1
-rw-r--r--ext/coverage/depend1
-rw-r--r--ext/date/date.gemspec2
-rw-r--r--ext/date/depend4
-rw-r--r--ext/dbm/dbm.c1156
-rw-r--r--ext/dbm/dbm.gemspec21
-rw-r--r--ext/dbm/depend163
-rw-r--r--ext/dbm/extconf.rb292
-rw-r--r--ext/digest/bubblebabble/depend1
-rw-r--r--ext/digest/bubblebabble/extconf.rb2
-rw-r--r--ext/digest/depend1
-rw-r--r--ext/digest/md5/depend2
-rw-r--r--ext/digest/md5/extconf.rb2
-rw-r--r--ext/digest/rmd160/depend2
-rw-r--r--ext/digest/rmd160/extconf.rb4
-rw-r--r--ext/digest/sha1/depend2
-rw-r--r--ext/digest/sha1/extconf.rb2
-rw-r--r--ext/digest/sha2/depend2
-rw-r--r--ext/digest/sha2/extconf.rb2
-rw-r--r--ext/digest/sha2/sha2.c14
-rw-r--r--ext/etc/depend1
-rw-r--r--ext/fcntl/depend1
-rw-r--r--ext/fiddle/closure.c26
-rw-r--r--ext/fiddle/conversions.h1
-rw-r--r--ext/fiddle/depend8
-rw-r--r--ext/fiddle/extconf.rb43
-rw-r--r--ext/fiddle/function.c11
-rw-r--r--ext/fiddle/lib/fiddle.rb12
-rw-r--r--ext/fiddle/lib/fiddle/cparser.rb6
-rw-r--r--ext/fiddle/lib/fiddle/types.rb35
-rw-r--r--ext/fiddle/lib/fiddle/version.rb2
-rw-r--r--ext/gdbm/README1
-rw-r--r--ext/gdbm/depend163
-rw-r--r--ext/gdbm/extconf.rb19
-rw-r--r--ext/gdbm/gdbm.c1306
-rw-r--r--ext/gdbm/gdbm.gemspec21
-rw-r--r--ext/io/console/depend1
-rw-r--r--ext/io/console/extconf.rb2
-rw-r--r--ext/io/console/io-console.gemspec16
-rw-r--r--ext/io/nonblock/depend1
-rw-r--r--ext/io/wait/depend1
-rw-r--r--ext/io/wait/io-wait.gemspec2
-rw-r--r--ext/json/generator/depend1
-rw-r--r--ext/json/json.gemspec2
-rw-r--r--ext/json/lib/json.rb2
-rw-r--r--ext/json/parser/depend1
-rw-r--r--ext/json/parser/extconf.rb1
-rw-r--r--ext/json/parser/parser.c4785
-rw-r--r--ext/json/parser/parser.h6
-rw-r--r--ext/json/parser/parser.rl94
-rw-r--r--ext/json/parser/prereq.mk5
-rw-r--r--ext/monitor/depend1
-rw-r--r--ext/monitor/monitor.c12
-rw-r--r--ext/nkf/depend1
-rw-r--r--ext/nkf/nkf-utf8/config.h2
-rw-r--r--ext/nkf/nkf-utf8/nkf.c10
-rw-r--r--ext/nkf/nkf-utf8/nkf.h4
-rw-r--r--ext/nkf/nkf.c2
-rw-r--r--ext/objspace/depend3
-rw-r--r--ext/objspace/lib/objspace/trace.rb45
-rw-r--r--ext/objspace/objspace.c2
-rw-r--r--ext/objspace/objspace_dump.c10
-rw-r--r--ext/openssl/depend32
-rw-r--r--ext/openssl/ossl_ocsp.c2
-rw-r--r--ext/openssl/ossl_pkey_ec.c2
-rw-r--r--ext/pathname/depend1
-rw-r--r--ext/pathname/pathname.gemspec2
-rw-r--r--ext/psych/depend5
-rw-r--r--ext/psych/lib/psych.rb204
-rw-r--r--ext/psych/lib/psych/class_loader.rb4
-rw-r--r--ext/psych/lib/psych/exception.rb4
-rw-r--r--ext/psych/lib/psych/handler.rb2
-rw-r--r--ext/psych/lib/psych/nodes/scalar.rb2
-rw-r--r--ext/psych/lib/psych/versions.rb6
-rw-r--r--ext/psych/lib/psych/visitors/to_ruby.rb16
-rw-r--r--ext/psych/lib/psych/visitors/visitor.rb2
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb50
-rw-r--r--ext/psych/yaml/scanner.c4
-rw-r--r--ext/psych/yaml/yaml.h8
-rw-r--r--ext/psych/yaml/yaml_private.h2
-rw-r--r--ext/pty/depend1
-rw-r--r--ext/racc/cparse/cparse.c2
-rw-r--r--ext/racc/cparse/depend1
-rw-r--r--ext/rbconfig/sizeof/depend2
-rw-r--r--ext/readline/depend1
-rw-r--r--ext/ripper/depend1
-rw-r--r--ext/socket/depend450
-rw-r--r--ext/socket/raddrinfo.c125
-rw-r--r--ext/socket/rubysocket.h2
-rw-r--r--ext/socket/socket.c33
-rw-r--r--ext/stringio/depend1
-rw-r--r--ext/strscan/depend1
-rw-r--r--ext/strscan/strscan.c11
-rw-r--r--ext/strscan/strscan.gemspec4
-rw-r--r--ext/syslog/depend1
-rw-r--r--ext/win32/lib/win32/sspi.rb2
-rw-r--r--ext/win32ole/sample/xml.rb12
-rw-r--r--ext/win32ole/win32ole.c16
-rw-r--r--ext/win32ole/win32ole_type.c2
-rw-r--r--ext/win32ole/win32ole_variant.c6
-rw-r--r--ext/win32ole/win32ole_variant_m.c2
-rw-r--r--ext/zlib/depend1
-rw-r--r--ext/zlib/zlib.c2
-rw-r--r--ext/zlib/zlib.gemspec4
-rw-r--r--file.c132
-rw-r--r--gc.c1447
-rw-r--r--gems/bundled_gems12
-rw-r--r--hash.c83
-rw-r--r--include/ruby/backward/2/attributes.h4
-rw-r--r--include/ruby/backward/2/stdarg.h2
-rw-r--r--include/ruby/fiber/scheduler.h2
-rw-r--r--include/ruby/internal/arithmetic/long_long.h29
-rw-r--r--include/ruby/internal/attr/cold.h2
-rw-r--r--include/ruby/internal/attr/const.h2
-rw-r--r--include/ruby/internal/attr/constexpr.h3
-rw-r--r--include/ruby/internal/attr/restrict.h3
-rw-r--r--include/ruby/internal/compiler_since.h4
-rw-r--r--include/ruby/internal/core.h2
-rw-r--r--include/ruby/internal/core/rbasic.h5
-rw-r--r--include/ruby/internal/core/rbignum.h6
-rw-r--r--include/ruby/internal/core/rdata.h13
-rw-r--r--include/ruby/internal/fl_type.h2
-rw-r--r--include/ruby/internal/has/attribute.h7
-rw-r--r--include/ruby/internal/has/builtin.h20
-rw-r--r--include/ruby/internal/has/cpp_attribute.h7
-rw-r--r--include/ruby/internal/has/declspec_attribute.h3
-rw-r--r--include/ruby/internal/intern/cont.h14
-rw-r--r--include/ruby/internal/intern/hash.h1
-rw-r--r--include/ruby/internal/token_paste.h75
-rw-r--r--include/ruby/internal/value_type.h2
-rw-r--r--include/ruby/internal/warning_push.h2
-rw-r--r--include/ruby/missing.h4
-rw-r--r--include/ruby/ruby.h2
-rw-r--r--include/ruby/thread_native.h2
-rw-r--r--inits.c1
-rw-r--r--insns.def22
-rw-r--r--internal/array.h1
-rw-r--r--internal/bignum.h4
-rw-r--r--internal/compile.h3
-rw-r--r--internal/complex.h1
-rw-r--r--internal/gc.h29
-rw-r--r--internal/parse.h1
-rw-r--r--internal/rational.h1
-rw-r--r--internal/re.h2
-rw-r--r--internal/string.h1
-rw-r--r--internal/vm.h2
-rw-r--r--internal/warnings.h2
-rw-r--r--io.c220
-rw-r--r--iseq.c50
-rw-r--r--iseq.h11
-rw-r--r--lib/abbrev.gemspec2
-rw-r--r--lib/base64.gemspec6
-rw-r--r--lib/benchmark.rb3
-rw-r--r--lib/benchmark/benchmark.gemspec2
-rw-r--r--lib/bundler.rb2
-rw-r--r--lib/bundler/bundler.gemspec5
-rw-r--r--lib/bundler/cli.rb13
-rw-r--r--lib/bundler/cli/common.rb17
-rw-r--r--lib/bundler/cli/gem.rb77
-rw-r--r--lib/bundler/cli/install.rb8
-rw-r--r--lib/bundler/cli/outdated.rb2
-rw-r--r--lib/bundler/compact_index_client/updater.rb14
-rw-r--r--lib/bundler/current_ruby.rb1
-rw-r--r--lib/bundler/definition.rb38
-rw-r--r--lib/bundler/dependency.rb8
-rw-r--r--lib/bundler/dsl.rb9
-rw-r--r--lib/bundler/feature_flag.rb2
-rw-r--r--lib/bundler/fetcher.rb3
-rw-r--r--lib/bundler/fetcher/compact_index.rb13
-rw-r--r--lib/bundler/fetcher/downloader.rb12
-rw-r--r--lib/bundler/gem_helper.rb16
-rw-r--r--lib/bundler/injector.rb4
-rw-r--r--lib/bundler/inline.rb2
-rw-r--r--lib/bundler/installer/parallel_installer.rb51
-rw-r--r--lib/bundler/lazy_specification.rb7
-rw-r--r--lib/bundler/lockfile_parser.rb18
-rw-r--r--lib/bundler/man/bundle-add.12
-rw-r--r--lib/bundler/man/bundle-binstubs.12
-rw-r--r--lib/bundler/man/bundle-cache.12
-rw-r--r--lib/bundler/man/bundle-check.12
-rw-r--r--lib/bundler/man/bundle-clean.12
-rw-r--r--lib/bundler/man/bundle-config.125
-rw-r--r--lib/bundler/man/bundle-config.1.ronn24
-rw-r--r--lib/bundler/man/bundle-doctor.12
-rw-r--r--lib/bundler/man/bundle-exec.12
-rw-r--r--lib/bundler/man/bundle-gem.115
-rw-r--r--lib/bundler/man/bundle-gem.1.ronn16
-rw-r--r--lib/bundler/man/bundle-info.12
-rw-r--r--lib/bundler/man/bundle-init.12
-rw-r--r--lib/bundler/man/bundle-inject.12
-rw-r--r--lib/bundler/man/bundle-install.12
-rw-r--r--lib/bundler/man/bundle-list.12
-rw-r--r--lib/bundler/man/bundle-lock.12
-rw-r--r--lib/bundler/man/bundle-open.12
-rw-r--r--lib/bundler/man/bundle-outdated.12
-rw-r--r--lib/bundler/man/bundle-platform.12
-rw-r--r--lib/bundler/man/bundle-pristine.12
-rw-r--r--lib/bundler/man/bundle-remove.12
-rw-r--r--lib/bundler/man/bundle-show.12
-rw-r--r--lib/bundler/man/bundle-update.12
-rw-r--r--lib/bundler/man/bundle-viz.12
-rw-r--r--lib/bundler/man/bundle.12
-rw-r--r--lib/bundler/man/gemfile.52
-rw-r--r--lib/bundler/plugin.rb4
-rw-r--r--lib/bundler/plugin/api/source.rb7
-rw-r--r--lib/bundler/resolver.rb35
-rw-r--r--lib/bundler/resolver/spec_group.rb24
-rw-r--r--lib/bundler/retry.rb2
-rw-r--r--lib/bundler/settings.rb71
-rw-r--r--lib/bundler/source.rb6
-rw-r--r--lib/bundler/source/metadata.rb4
-rw-r--r--lib/bundler/source/path.rb4
-rw-r--r--lib/bundler/source/path/installer.rb2
-rw-r--r--lib/bundler/source/rubygems.rb28
-rw-r--r--lib/bundler/source_list.rb20
-rw-r--r--lib/bundler/spec_set.rb23
-rw-r--r--lib/bundler/templates/Gemfile2
-rw-r--r--lib/bundler/templates/gems.rb2
-rw-r--r--lib/bundler/templates/newgem/Gemfile.tt7
-rw-r--r--lib/bundler/templates/newgem/Rakefile.tt6
-rw-r--r--lib/bundler/templates/newgem/github/workflows/main.yml.tt6
-rw-r--r--lib/bundler/templates/newgem/newgem.gemspec.tt26
-rw-r--r--lib/bundler/templates/newgem/standard.yml.tt4
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb2
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb2
-rw-r--r--lib/bundler/vendor/tmpdir/lib/tmpdir.rb2
-rw-r--r--lib/cgi/cgi.gemspec2
-rw-r--r--lib/cgi/util.rb11
-rw-r--r--lib/erb.rb2
-rw-r--r--lib/forwardable/forwardable.gemspec2
-rw-r--r--lib/irb.rb15
-rw-r--r--lib/irb/cmd/ls.rb28
-rw-r--r--lib/irb/color.rb16
-rw-r--r--lib/irb/init.rb4
-rw-r--r--lib/irb/irb.gemspec2
-rw-r--r--lib/irb/ruby-lex.rb2
-rw-r--r--lib/logger.rb10
-rw-r--r--lib/matrix.rb2493
-rw-r--r--lib/matrix/eigenvalue_decomposition.rb882
-rw-r--r--lib/matrix/lup_decomposition.rb219
-rw-r--r--lib/matrix/matrix.gemspec29
-rw-r--r--lib/matrix/version.rb5
-rw-r--r--lib/net/ftp.rb1534
-rw-r--r--lib/net/http.rb34
-rw-r--r--lib/net/http/generic_request.rb2
-rw-r--r--lib/net/imap.rb3730
-rw-r--r--lib/net/net-ftp.gemspec36
-rw-r--r--lib/net/net-imap.gemspec37
-rw-r--r--lib/net/net-pop.gemspec34
-rw-r--r--lib/net/net-smtp.gemspec35
-rw-r--r--lib/net/pop.rb1022
-rw-r--r--lib/net/protocol.rb13
-rw-r--r--lib/net/smtp.rb1112
-rw-r--r--lib/open-uri.rb7
-rw-r--r--lib/ostruct.rb40
-rw-r--r--lib/pp.gemspec2
-rw-r--r--lib/pp.rb2
-rw-r--r--lib/prime.gemspec28
-rw-r--r--lib/prime.rb561
-rw-r--r--lib/rdoc/rdoc.gemspec6
-rw-r--r--lib/rdoc/rdoc.rb7
-rw-r--r--lib/rdoc/version.rb2
-rw-r--r--lib/resolv.gemspec2
-rw-r--r--lib/resolv.rb6
-rw-r--r--lib/rubygems.rb6
-rw-r--r--lib/rubygems/commands/install_command.rb2
-rw-r--r--lib/rubygems/commands/open_command.rb2
-rw-r--r--lib/rubygems/commands/update_command.rb24
-rw-r--r--lib/rubygems/commands/yank_command.rb2
-rw-r--r--lib/rubygems/defaults.rb2
-rw-r--r--lib/rubygems/deprecate.rb4
-rw-r--r--lib/rubygems/indexer.rb2
-rw-r--r--lib/rubygems/installer.rb7
-rw-r--r--lib/rubygems/package.rb9
-rw-r--r--lib/rubygems/platform.rb10
-rw-r--r--lib/rubygems/remote_fetcher.rb11
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb2
-rw-r--r--lib/rubygems/security/trust_dir.rb1
-rw-r--r--lib/set.rb155
-rw-r--r--lib/set/set.gemspec2
-rw-r--r--lib/set/sorted_set.rb2
-rw-r--r--lib/time.rb1
-rw-r--r--lib/timeout.rb8
-rw-r--r--lib/tracer.rb292
-rw-r--r--lib/tracer/tracer.gemspec25
-rw-r--r--lib/uri.rb1
-rw-r--r--lib/uri/common.rb2
-rw-r--r--lib/uri/generic.rb20
-rw-r--r--lib/uri/rfc2396_parser.rb10
-rw-r--r--lib/uri/rfc3986_parser.rb10
-rw-r--r--lib/uri/uri.gemspec2
-rw-r--r--lib/yaml/store.rb2
-rw-r--r--load.c20
-rw-r--r--man/ruby.12
-rw-r--r--math.c2
-rw-r--r--memory_view.c12
-rw-r--r--mini_builtin.c15
-rwxr-xr-xmisc/expand_tabs.rb59
-rwxr-xr-xmisc/lldb_cruby.py155
-rw-r--r--misc/rb_optparse.bash2
-rw-r--r--misc/rb_optparse.zsh4
-rw-r--r--missing/dup2.c60
-rw-r--r--mjit.c79
-rw-r--r--mjit.h6
-rw-r--r--mjit_compile.c51
-rw-r--r--mjit_worker.c87
-rw-r--r--nilclass.rb25
-rw-r--r--node.c1
-rw-r--r--node.h5
-rw-r--r--numeric.c46
-rw-r--r--numeric.rb20
-rw-r--r--object.c313
-rw-r--r--parse.y181
-rw-r--r--proc.c3
-rw-r--r--ractor.c10
-rw-r--r--ractor.rb6
-rw-r--r--ractor_core.h2
-rw-r--r--random.c6
-rw-r--r--rational.c13
-rw-r--r--re.c8
-rw-r--r--regcomp.c2
-rw-r--r--regexec.c8
-rw-r--r--ruby.c3
-rw-r--r--scheduler.c41
-rw-r--r--signal.c2
-rw-r--r--siphash.c15
-rw-r--r--spec/bundler/bundler/compact_index_client/updater_spec.rb1
-rw-r--r--spec/bundler/bundler/dep_proxy_spec.rb2
-rw-r--r--spec/bundler/bundler/env_spec.rb14
-rw-r--r--spec/bundler/bundler/fetcher/downloader_spec.rb5
-rw-r--r--spec/bundler/bundler/gem_helper_spec.rb39
-rw-r--r--spec/bundler/bundler/installer/parallel_installer_spec.rb33
-rw-r--r--spec/bundler/bundler/installer/spec_installation_spec.rb4
-rw-r--r--spec/bundler/bundler/plugin/dsl_spec.rb2
-rw-r--r--spec/bundler/bundler/plugin/index_spec.rb2
-rw-r--r--spec/bundler/bundler/source_list_spec.rb21
-rw-r--r--spec/bundler/commands/cache_spec.rb25
-rw-r--r--spec/bundler/commands/clean_spec.rb2
-rw-r--r--spec/bundler/commands/config_spec.rb8
-rw-r--r--spec/bundler/commands/info_spec.rb14
-rw-r--r--spec/bundler/commands/lock_spec.rb2
-rw-r--r--spec/bundler/commands/newgem_spec.rb410
-rw-r--r--spec/bundler/commands/outdated_spec.rb403
-rw-r--r--spec/bundler/commands/post_bundle_message_spec.rb24
-rw-r--r--spec/bundler/commands/pristine_spec.rb10
-rw-r--r--spec/bundler/commands/remove_spec.rb4
-rw-r--r--spec/bundler/commands/update_spec.rb395
-rw-r--r--spec/bundler/install/deploy_spec.rb20
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb57
-rw-r--r--spec/bundler/install/gemfile/path_spec.rb7
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb515
-rw-r--r--spec/bundler/install/gemfile/specific_platform_spec.rb44
-rw-r--r--spec/bundler/install/gems/compact_index_spec.rb33
-rw-r--r--spec/bundler/install/gems/dependency_api_spec.rb27
-rw-r--r--spec/bundler/install/gems/flex_spec.rb32
-rw-r--r--spec/bundler/install/gems/post_install_spec.rb2
-rw-r--r--spec/bundler/install/gems/resolving_spec.rb45
-rw-r--r--spec/bundler/install/gems/sudo_spec.rb17
-rw-r--r--spec/bundler/install/git_spec.rb2
-rw-r--r--spec/bundler/install/prereleases_spec.rb6
-rw-r--r--spec/bundler/lock/lockfile_spec.rb59
-rw-r--r--spec/bundler/other/major_deprecation_spec.rb112
-rw-r--r--spec/bundler/quality_spec.rb11
-rw-r--r--spec/bundler/realworld/edgecases_spec.rb8
-rw-r--r--spec/bundler/realworld/fixtures/warbler/Gemfile.lock5
-rw-r--r--spec/bundler/runtime/inline_spec.rb15
-rw-r--r--spec/bundler/runtime/platform_spec.rb38
-rw-r--r--spec/bundler/runtime/setup_spec.rb12
-rw-r--r--spec/bundler/spec_helper.rb14
-rw-r--r--spec/bundler/support/artifice/compact_index.rb4
-rw-r--r--spec/bundler/support/artifice/compact_index_partial_update_no_etag_not_incremental.rb40
-rw-r--r--spec/bundler/support/artifice/endpoint.rb26
-rw-r--r--spec/bundler/support/artifice/windows.rb4
-rw-r--r--spec/bundler/support/builders.rb51
-rw-r--r--spec/bundler/support/bundle.rb8
-rw-r--r--spec/bundler/support/hax.rb2
-rw-r--r--spec/bundler/support/helpers.rb8
-rw-r--r--spec/bundler/support/matchers.rb51
-rw-r--r--spec/bundler/support/path.rb40
-rw-r--r--spec/bundler/support/rubygems_ext.rb71
-rw-r--r--spec/mspec/.rspec1
-rw-r--r--spec/mspec/lib/mspec/helpers/ruby_exe.rb23
-rw-r--r--spec/mspec/lib/mspec/matchers/match_yaml.rb6
-rw-r--r--spec/mspec/spec/helpers/ruby_exe_spec.rb56
-rw-r--r--spec/ruby/README.md2
-rw-r--r--spec/ruby/command_line/dash_encoding_spec.rb8
-rw-r--r--spec/ruby/command_line/dash_r_spec.rb2
-rw-r--r--spec/ruby/command_line/dash_upper_e_spec.rb3
-rw-r--r--spec/ruby/command_line/dash_upper_s_spec.rb2
-rw-r--r--spec/ruby/command_line/dash_upper_u_spec.rb6
-rw-r--r--spec/ruby/command_line/dash_x_spec.rb2
-rw-r--r--spec/ruby/command_line/error_message_spec.rb4
-rw-r--r--spec/ruby/command_line/rubyopt_spec.rb40
-rw-r--r--spec/ruby/command_line/syntax_error_spec.rb4
-rw-r--r--spec/ruby/core/array/element_set_spec.rb8
-rw-r--r--spec/ruby/core/encoding/replicate_spec.rb21
-rw-r--r--spec/ruby/core/enumerator/lazy/filter_map_spec.rb16
-rw-r--r--spec/ruby/core/exception/signal_exception_spec.rb6
-rw-r--r--spec/ruby/core/exception/system_exit_spec.rb4
-rw-r--r--spec/ruby/core/exception/top_level_spec.rb6
-rw-r--r--spec/ruby/core/fiber/raise_spec.rb20
-rw-r--r--spec/ruby/core/file/atime_spec.rb20
-rw-r--r--spec/ruby/core/file/basename_spec.rb15
-rw-r--r--spec/ruby/core/file/shared/read.rb4
-rw-r--r--spec/ruby/core/hash/rehash_spec.rb18
-rw-r--r--spec/ruby/core/hash/transform_keys_spec.rb4
-rw-r--r--spec/ruby/core/io/binmode_spec.rb4
-rw-r--r--spec/ruby/core/io/dup_spec.rb19
-rw-r--r--spec/ruby/core/io/external_encoding_spec.rb5
-rw-r--r--spec/ruby/core/io/internal_encoding_spec.rb5
-rw-r--r--spec/ruby/core/io/lineno_spec.rb36
-rw-r--r--spec/ruby/core/io/set_encoding_by_bom_spec.rb14
-rw-r--r--spec/ruby/core/io/sysread_spec.rb5
-rw-r--r--spec/ruby/core/io/sysseek_spec.rb5
-rw-r--r--spec/ruby/core/kernel/at_exit_spec.rb11
-rw-r--r--spec/ruby/core/kernel/eval_spec.rb65
-rw-r--r--spec/ruby/core/kernel/format_spec.rb1
-rw-r--r--spec/ruby/core/kernel/inspect_spec.rb8
-rw-r--r--spec/ruby/core/kernel/shared/sprintf.rb17
-rw-r--r--spec/ruby/core/module/define_method_spec.rb46
-rw-r--r--spec/ruby/core/module/include_spec.rb142
-rw-r--r--spec/ruby/core/module/prepend_spec.rb186
-rw-r--r--spec/ruby/core/module/remove_method_spec.rb22
-rw-r--r--spec/ruby/core/objectspace/_id2ref_spec.rb41
-rw-r--r--spec/ruby/core/objectspace/define_finalizer_spec.rb2
-rw-r--r--spec/ruby/core/process/status/equal_value_spec.rb4
-rw-r--r--spec/ruby/core/process/status/exited_spec.rb7
-rw-r--r--spec/ruby/core/process/status/exitstatus_spec.rb4
-rw-r--r--spec/ruby/core/process/status/signaled_spec.rb6
-rw-r--r--spec/ruby/core/process/status/success_spec.rb14
-rw-r--r--spec/ruby/core/process/status/termsig_spec.rb4
-rw-r--r--spec/ruby/core/process/status/to_i_spec.rb4
-rw-r--r--spec/ruby/core/range/step_spec.rb13
-rw-r--r--spec/ruby/core/signal/trap_spec.rb2
-rw-r--r--spec/ruby/core/string/inspect_spec.rb6
-rw-r--r--spec/ruby/core/string/rpartition_spec.rb13
-rw-r--r--spec/ruby/core/string/split_spec.rb10
-rw-r--r--spec/ruby/core/struct/dig_spec.rb10
-rw-r--r--spec/ruby/language/fixtures/return.rb8
-rw-r--r--spec/ruby/language/hash_spec.rb15
-rw-r--r--spec/ruby/language/regexp/interpolation_spec.rb2
-rw-r--r--spec/ruby/language/source_encoding_spec.rb4
-rw-r--r--spec/ruby/library/datetime/strftime_spec.rb1
-rw-r--r--spec/ruby/library/matrix/I_spec.rb9
-rw-r--r--spec/ruby/library/matrix/antisymmetric_spec.rb57
-rw-r--r--spec/ruby/library/matrix/build_spec.rb117
-rw-r--r--spec/ruby/library/matrix/clone_spec.rb37
-rw-r--r--spec/ruby/library/matrix/coerce_spec.rb11
-rw-r--r--spec/ruby/library/matrix/collect_spec.rb9
-rw-r--r--spec/ruby/library/matrix/column_size_spec.rb19
-rw-r--r--spec/ruby/library/matrix/column_spec.rb53
-rw-r--r--spec/ruby/library/matrix/column_vector_spec.rb37
-rw-r--r--spec/ruby/library/matrix/column_vectors_spec.rb37
-rw-r--r--spec/ruby/library/matrix/columns_spec.rb67
-rw-r--r--spec/ruby/library/matrix/conj_spec.rb9
-rw-r--r--spec/ruby/library/matrix/conjugate_spec.rb9
-rw-r--r--spec/ruby/library/matrix/constructor_spec.rb103
-rw-r--r--spec/ruby/library/matrix/det_spec.rb11
-rw-r--r--spec/ruby/library/matrix/determinant_spec.rb11
-rw-r--r--spec/ruby/library/matrix/diagonal_spec.rb105
-rw-r--r--spec/ruby/library/matrix/divide_spec.rb83
-rw-r--r--spec/ruby/library/matrix/each_spec.rb119
-rw-r--r--spec/ruby/library/matrix/each_with_index_spec.rb133
-rw-r--r--spec/ruby/library/matrix/eigenvalue_decomposition/eigenvalue_matrix_spec.rb13
-rw-r--r--spec/ruby/library/matrix/eigenvalue_decomposition/eigenvalues_spec.rb35
-rw-r--r--spec/ruby/library/matrix/eigenvalue_decomposition/eigenvector_matrix_spec.rb33
-rw-r--r--spec/ruby/library/matrix/eigenvalue_decomposition/eigenvectors_spec.rb37
-rw-r--r--spec/ruby/library/matrix/eigenvalue_decomposition/initialize_spec.rb39
-rw-r--r--spec/ruby/library/matrix/eigenvalue_decomposition/to_a_spec.rb27
-rw-r--r--spec/ruby/library/matrix/element_reference_spec.rb31
-rw-r--r--spec/ruby/library/matrix/empty_spec.rb107
-rw-r--r--spec/ruby/library/matrix/eql_spec.rb15
-rw-r--r--spec/ruby/library/matrix/equal_value_spec.rb15
-rw-r--r--spec/ruby/library/matrix/exponent_spec.rb93
-rw-r--r--spec/ruby/library/matrix/find_index_spec.rb221
-rw-r--r--spec/ruby/library/matrix/hash_spec.rb21
-rw-r--r--spec/ruby/library/matrix/hermitian_spec.rb53
-rw-r--r--spec/ruby/library/matrix/identity_spec.rb9
-rw-r--r--spec/ruby/library/matrix/imag_spec.rb9
-rw-r--r--spec/ruby/library/matrix/imaginary_spec.rb9
-rw-r--r--spec/ruby/library/matrix/inspect_spec.rb39
-rw-r--r--spec/ruby/library/matrix/inv_spec.rb11
-rw-r--r--spec/ruby/library/matrix/inverse_from_spec.rb9
-rw-r--r--spec/ruby/library/matrix/inverse_spec.rb11
-rw-r--r--spec/ruby/library/matrix/lower_triangular_spec.rb39
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/determinant_spec.rb33
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/initialize_spec.rb21
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/l_spec.rb27
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/p_spec.rb27
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/solve_spec.rb85
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/to_a_spec.rb53
-rw-r--r--spec/ruby/library/matrix/lup_decomposition/u_spec.rb27
-rw-r--r--spec/ruby/library/matrix/map_spec.rb9
-rw-r--r--spec/ruby/library/matrix/minor_spec.rb135
-rw-r--r--spec/ruby/library/matrix/minus_spec.rb65
-rw-r--r--spec/ruby/library/matrix/multiply_spec.rb105
-rw-r--r--spec/ruby/library/matrix/new_spec.rb11
-rw-r--r--spec/ruby/library/matrix/normal_spec.rb41
-rw-r--r--spec/ruby/library/matrix/orthogonal_spec.rb41
-rw-r--r--spec/ruby/library/matrix/permutation_spec.rb51
-rw-r--r--spec/ruby/library/matrix/plus_spec.rb65
-rw-r--r--spec/ruby/library/matrix/rank_spec.rb29
-rw-r--r--spec/ruby/library/matrix/real_spec.rb63
-rw-r--r--spec/ruby/library/matrix/rect_spec.rb9
-rw-r--r--spec/ruby/library/matrix/rectangular_spec.rb9
-rw-r--r--spec/ruby/library/matrix/regular_spec.rb45
-rw-r--r--spec/ruby/library/matrix/round_spec.rb31
-rw-r--r--spec/ruby/library/matrix/row_size_spec.rb19
-rw-r--r--spec/ruby/library/matrix/row_spec.rb55
-rw-r--r--spec/ruby/library/matrix/row_vector_spec.rb33
-rw-r--r--spec/ruby/library/matrix/row_vectors_spec.rb37
-rw-r--r--spec/ruby/library/matrix/rows_spec.rb65
-rw-r--r--spec/ruby/library/matrix/scalar/Fail_spec.rb9
-rw-r--r--spec/ruby/library/matrix/scalar/Raise_spec.rb9
-rw-r--r--spec/ruby/library/matrix/scalar/divide_spec.rb9
-rw-r--r--spec/ruby/library/matrix/scalar/exponent_spec.rb9
-rw-r--r--spec/ruby/library/matrix/scalar/included_spec.rb9
-rw-r--r--spec/ruby/library/matrix/scalar/initialize_spec.rb9
-rw-r--r--spec/ruby/library/matrix/scalar/minus_spec.rb9
-rw-r--r--spec/ruby/library/matrix/scalar/multiply_spec.rb9
-rw-r--r--spec/ruby/library/matrix/scalar/plus_spec.rb9
-rw-r--r--spec/ruby/library/matrix/scalar_spec.rb93
-rw-r--r--spec/ruby/library/matrix/singular_spec.rb47
-rw-r--r--spec/ruby/library/matrix/square_spec.rb41
-rw-r--r--spec/ruby/library/matrix/symmetric_spec.rb45
-rw-r--r--spec/ruby/library/matrix/t_spec.rb9
-rw-r--r--spec/ruby/library/matrix/to_a_spec.rb17
-rw-r--r--spec/ruby/library/matrix/to_s_spec.rb9
-rw-r--r--spec/ruby/library/matrix/tr_spec.rb11
-rw-r--r--spec/ruby/library/matrix/trace_spec.rb11
-rw-r--r--spec/ruby/library/matrix/transpose_spec.rb9
-rw-r--r--spec/ruby/library/matrix/unit_spec.rb9
-rw-r--r--spec/ruby/library/matrix/unitary_spec.rb51
-rw-r--r--spec/ruby/library/matrix/upper_triangular_spec.rb39
-rw-r--r--spec/ruby/library/matrix/vector/cross_product_spec.rb21
-rw-r--r--spec/ruby/library/matrix/vector/each2_spec.rb81
-rw-r--r--spec/ruby/library/matrix/vector/eql_spec.rb23
-rw-r--r--spec/ruby/library/matrix/vector/inner_product_spec.rb33
-rw-r--r--spec/ruby/library/matrix/vector/normalize_spec.rb29
-rw-r--r--spec/ruby/library/matrix/zero_spec.rb75
-rw-r--r--spec/ruby/library/net/FTPError_spec.rb11
-rw-r--r--spec/ruby/library/net/FTPPermError_spec.rb17
-rw-r--r--spec/ruby/library/net/FTPProtoError_spec.rb17
-rw-r--r--spec/ruby/library/net/FTPReplyError_spec.rb17
-rw-r--r--spec/ruby/library/net/FTPTempError_spec.rb17
-rw-r--r--spec/ruby/library/net/ftp/abort_spec.rb97
-rw-r--r--spec/ruby/library/net/ftp/acct_spec.rb111
-rw-r--r--spec/ruby/library/net/ftp/binary_spec.rb33
-rw-r--r--spec/ruby/library/net/ftp/chdir_spec.rb145
-rw-r--r--spec/ruby/library/net/ftp/close_spec.rb47
-rw-r--r--spec/ruby/library/net/ftp/closed_spec.rb31
-rw-r--r--spec/ruby/library/net/ftp/connect_spec.rb93
-rw-r--r--spec/ruby/library/net/ftp/debug_mode_spec.rb33
-rw-r--r--spec/ruby/library/net/ftp/default_passive_spec.rb11
-rw-r--r--spec/ruby/library/net/ftp/delete_spec.rb113
-rw-r--r--spec/ruby/library/net/ftp/dir_spec.rb13
-rw-r--r--spec/ruby/library/net/ftp/get_spec.rb31
-rw-r--r--spec/ruby/library/net/ftp/getbinaryfile_spec.rb13
-rw-r--r--spec/ruby/library/net/ftp/getdir_spec.rb11
-rw-r--r--spec/ruby/library/net/ftp/gettextfile_spec.rb13
-rw-r--r--spec/ruby/library/net/ftp/help_spec.rb103
-rw-r--r--spec/ruby/library/net/ftp/initialize_spec.rb557
-rw-r--r--spec/ruby/library/net/ftp/last_response_code_spec.rb13
-rw-r--r--spec/ruby/library/net/ftp/last_response_spec.rb39
-rw-r--r--spec/ruby/library/net/ftp/lastresp_spec.rb13
-rw-r--r--spec/ruby/library/net/ftp/list_spec.rb13
-rw-r--r--spec/ruby/library/net/ftp/login_spec.rb379
-rw-r--r--spec/ruby/library/net/ftp/ls_spec.rb13
-rw-r--r--spec/ruby/library/net/ftp/mdtm_spec.rb59
-rw-r--r--spec/ruby/library/net/ftp/mkdir_spec.rb97
-rw-r--r--spec/ruby/library/net/ftp/mtime_spec.rb73
-rw-r--r--spec/ruby/library/net/ftp/nlst_spec.rb141
-rw-r--r--spec/ruby/library/net/ftp/noop_spec.rb59
-rw-r--r--spec/ruby/library/net/ftp/open_spec.rb73
-rw-r--r--spec/ruby/library/net/ftp/passive_spec.rb39
-rw-r--r--spec/ruby/library/net/ftp/put_spec.rb31
-rw-r--r--spec/ruby/library/net/ftp/putbinaryfile_spec.rb13
-rw-r--r--spec/ruby/library/net/ftp/puttextfile_spec.rb13
-rw-r--r--spec/ruby/library/net/ftp/pwd_spec.rb101
-rw-r--r--spec/ruby/library/net/ftp/quit_spec.rb51
-rw-r--r--spec/ruby/library/net/ftp/rename_spec.rb159
-rw-r--r--spec/ruby/library/net/ftp/resume_spec.rb33
-rw-r--r--spec/ruby/library/net/ftp/retrbinary_spec.rb47
-rw-r--r--spec/ruby/library/net/ftp/retrlines_spec.rb55
-rw-r--r--spec/ruby/library/net/ftp/return_code_spec.rb35
-rw-r--r--spec/ruby/library/net/ftp/rmdir_spec.rb111
-rw-r--r--spec/ruby/library/net/ftp/sendcmd_spec.rb103
-rw-r--r--spec/ruby/library/net/ftp/set_socket_spec.rb13
-rw-r--r--spec/ruby/library/net/ftp/site_spec.rb101
-rw-r--r--spec/ruby/library/net/ftp/size_spec.rb91
-rw-r--r--spec/ruby/library/net/ftp/status_spec.rb105
-rw-r--r--spec/ruby/library/net/ftp/storbinary_spec.rb73
-rw-r--r--spec/ruby/library/net/ftp/storlines_spec.rb65
-rw-r--r--spec/ruby/library/net/ftp/system_spec.rb91
-rw-r--r--spec/ruby/library/net/ftp/voidcmd_spec.rb103
-rw-r--r--spec/ruby/library/net/ftp/welcome_spec.rb39
-rw-r--r--spec/ruby/library/net/http/http/fixtures/http_server.rb2
-rw-r--r--spec/ruby/library/net/http/http/get_spec.rb1
-rw-r--r--spec/ruby/library/net/http/httpresponse/read_body_spec.rb1
-rw-r--r--spec/ruby/library/net/http/httpresponse/read_new_spec.rb1
-rw-r--r--spec/ruby/library/net/http/httpresponse/shared/body.rb2
-rw-r--r--spec/ruby/library/prime/each_spec.rb247
-rw-r--r--spec/ruby/library/prime/instance_spec.rb31
-rw-r--r--spec/ruby/library/prime/int_from_prime_division_spec.rb19
-rw-r--r--spec/ruby/library/prime/integer/each_prime_spec.rb19
-rw-r--r--spec/ruby/library/prime/integer/from_prime_division_spec.rb19
-rw-r--r--spec/ruby/library/prime/integer/prime_division_spec.rb31
-rw-r--r--spec/ruby/library/prime/integer/prime_spec.rb27
-rw-r--r--spec/ruby/library/prime/next_spec.rb11
-rw-r--r--spec/ruby/library/prime/prime_division_spec.rb37
-rw-r--r--spec/ruby/library/prime/prime_spec.rb27
-rw-r--r--spec/ruby/library/prime/succ_spec.rb11
-rw-r--r--spec/ruby/library/rbconfig/rbconfig_spec.rb8
-rw-r--r--spec/ruby/library/rubygems/gem/load_path_insert_index_spec.rb10
-rw-r--r--spec/ruby/library/yaml/fixtures/common.rb6
-rw-r--r--spec/ruby/library/yaml/load_spec.rb135
-rw-r--r--spec/ruby/library/yaml/shared/load.rb136
-rw-r--r--spec/ruby/library/yaml/unsafe_load_spec.rb9
-rw-r--r--spec/ruby/optional/capi/data_spec.rb7
-rw-r--r--spec/ruby/optional/capi/ext/data_spec.c6
-rw-r--r--spec/ruby/optional/capi/ext/object_spec.c6
-rw-r--r--spec/ruby/optional/capi/ext/typed_data_spec.c6
-rw-r--r--spec/ruby/optional/capi/object_spec.rb33
-rw-r--r--spec/ruby/optional/capi/rbasic_spec.rb1
-rw-r--r--spec/ruby/optional/capi/typed_data_spec.rb11
-rw-r--r--spec/ruby/shared/process/exit.rb10
-rw-r--r--spec/ruby/shared/time/strftime_for_time.rb8
-rw-r--r--st.c8
-rw-r--r--strftime.c6
-rw-r--r--string.c63
-rw-r--r--template/prelude.c.tmpl27
-rw-r--r--template/sizes.c.tmpl2
-rw-r--r--test/benchmark/test_benchmark.rb2
-rw-r--r--test/cgi/test_cgi_util.rb33
-rw-r--r--test/dbm/test_dbm.rb634
-rw-r--r--test/fiber/scheduler.rb14
-rw-r--r--test/fiber/test_address_resolve.rb278
-rw-r--r--test/fiber/test_scheduler.rb18
-rw-r--r--test/fiber/test_sleep.rb25
-rw-r--r--test/fiber/test_thread.rb24
-rw-r--r--test/fiddle/helper.rb4
-rw-r--r--test/fiddle/test_closure.rb25
-rw-r--r--test/fiddle/test_cparser.rb56
-rw-r--r--test/gdbm/test_gdbm.rb734
-rw-r--r--test/irb/test_cmd.rb23
-rw-r--r--test/irb/test_color.rb91
-rw-r--r--test/irb/test_init.rb56
-rw-r--r--test/irb/test_raise_no_backtrace_exception.rb31
-rw-r--r--test/matrix/test_matrix.rb888
-rw-r--r--test/matrix/test_vector.rb335
-rw-r--r--test/monitor/test_monitor.rb7
-rw-r--r--test/net/ftp/test_buffered_socket.rb48
-rw-r--r--test/net/ftp/test_ftp.rb2585
-rw-r--r--test/net/ftp/test_mlsx_entry.rb98
-rw-r--r--test/net/http/test_http.rb17
-rw-r--r--test/net/http/test_http_request.rb1
-rw-r--r--test/net/http/test_https.rb66
-rw-r--r--test/net/imap/test_imap.rb844
-rw-r--r--test/net/imap/test_imap_response_parser.rb311
-rw-r--r--test/net/pop/test_pop.rb166
-rw-r--r--test/net/smtp/test_response.rb100
-rw-r--r--test/net/smtp/test_smtp.rb301
-rw-r--r--test/net/smtp/test_ssl_socket.rb99
-rw-r--r--test/net/smtp/test_sslcontext.rb129
-rw-r--r--test/net/smtp/test_starttls.rb122
-rw-r--r--test/objspace/test_objspace.rb21
-rw-r--r--test/open-uri/test_open-uri.rb252
-rw-r--r--test/openssl/test_bn.rb41
-rw-r--r--test/optparse/test_acceptable.rb1
-rw-r--r--test/ostruct/test_ostruct.rb23
-rw-r--r--test/psych/helper.rb40
-rw-r--r--test/psych/test_alias_and_anchor.rb12
-rw-r--r--test/psych/test_array.rb6
-rw-r--r--test/psych/test_class.rb4
-rw-r--r--test/psych/test_coder.rb135
-rw-r--r--test/psych/test_date_time.rb4
-rw-r--r--test/psych/test_deprecated.rb4
-rw-r--r--test/psych/test_document.rb2
-rw-r--r--test/psych/test_emitter.rb10
-rw-r--r--test/psych/test_encoding.rb4
-rw-r--r--test/psych/test_exception.rb48
-rw-r--r--test/psych/test_hash.rb18
-rw-r--r--test/psych/test_marshalable.rb12
-rw-r--r--test/psych/test_merge_keys.rb24
-rw-r--r--test/psych/test_numeric.rb1
-rw-r--r--test/psych/test_object.rb4
-rw-r--r--test/psych/test_object_references.rb12
-rw-r--r--test/psych/test_omap.rb4
-rw-r--r--test/psych/test_parser.rb16
-rw-r--r--test/psych/test_psych.rb106
-rw-r--r--test/psych/test_ractor.rb4
-rw-r--r--test/psych/test_safe_load.rb64
-rw-r--r--test/psych/test_serialize_subclasses.rb4
-rw-r--r--test/psych/test_set.rb6
-rw-r--r--test/psych/test_string.rb14
-rw-r--r--test/psych/test_struct.rb6
-rw-r--r--test/psych/test_yaml.rb14
-rw-r--r--test/psych/test_yaml_special_cases.rb6
-rw-r--r--test/psych/test_yamlstore.rb47
-rw-r--r--test/psych/visitors/test_to_ruby.rb4
-rw-r--r--test/psych/visitors/test_yaml_tree.rb12
-rw-r--r--test/rdoc/test_rdoc_options.rb6
-rw-r--r--test/rdoc/test_rdoc_rdoc.rb13
-rw-r--r--test/rdoc/test_rdoc_rubygems_hook.rb25
-rw-r--r--test/resolv/test_dns.rb32
-rw-r--r--test/ripper/test_parser_events.rb30
-rw-r--r--test/ruby/test_array.rb55
-rw-r--r--test/ruby/test_assignment.rb58
-rw-r--r--test/ruby/test_ast.rb50
-rw-r--r--test/ruby/test_case.rb12
-rw-r--r--test/ruby/test_econv.rb2
-rw-r--r--test/ruby/test_env.rb40
-rw-r--r--test/ruby/test_exception.rb71
-rw-r--r--test/ruby/test_fiber.rb2
-rw-r--r--test/ruby/test_file_exhaustive.rb1
-rw-r--r--test/ruby/test_float.rb11
-rw-r--r--test/ruby/test_gc.rb6
-rw-r--r--test/ruby/test_gc_compact.rb41
-rw-r--r--test/ruby/test_insns_leaf.rb46
-rw-r--r--test/ruby/test_iseq.rb13
-rw-r--r--test/ruby/test_jit.rb6
-rw-r--r--test/ruby/test_keyword.rb20
-rw-r--r--test/ruby/test_lazy_enumerator.rb4
-rw-r--r--test/ruby/test_literal.rb22
-rw-r--r--test/ruby/test_math.rb1
-rw-r--r--test/ruby/test_module.rb110
-rw-r--r--test/ruby/test_parse.rb15
-rw-r--r--test/ruby/test_process.rb1
-rw-r--r--test/ruby/test_refinement.rb71
-rw-r--r--test/ruby/test_regexp.rb18
-rw-r--r--test/ruby/test_require_lib.rb3
-rw-r--r--test/ruby/test_settracefunc.rb15
-rw-r--r--test/ruby/test_syntax.rb40
-rw-r--r--test/ruby/test_thread.rb21
-rw-r--r--test/ruby/test_time.rb10
-rw-r--r--test/rubygems/helper.rb (renamed from lib/rubygems/test_case.rb)149
-rw-r--r--test/rubygems/installer_test_case.rb (renamed from lib/rubygems/installer_test_case.rb)2
-rw-r--r--test/rubygems/package/tar_test_case.rb (renamed from lib/rubygems/package/tar_test_case.rb)2
-rw-r--r--test/rubygems/packages/ascii_binder-0.1.10.1.gembin0 -> 244736 bytes
-rw-r--r--test/rubygems/test_bundled_ca.rb6
-rw-r--r--test/rubygems/test_config.rb2
-rw-r--r--test/rubygems/test_deprecate.rb56
-rw-r--r--test/rubygems/test_gem.rb66
-rw-r--r--test/rubygems/test_gem_available_set.rb2
-rw-r--r--test/rubygems/test_gem_bundler_version_finder.rb6
-rw-r--r--test/rubygems/test_gem_command.rb4
-rw-r--r--test/rubygems/test_gem_command_manager.rb14
-rw-r--r--test/rubygems/test_gem_commands_build_command.rb22
-rw-r--r--test/rubygems/test_gem_commands_cert_command.rb74
-rw-r--r--test/rubygems/test_gem_commands_check_command.rb12
-rw-r--r--test/rubygems/test_gem_commands_cleanup_command.rb50
-rw-r--r--test/rubygems/test_gem_commands_contents_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_dependency_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_environment_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_fetch_command.rb20
-rw-r--r--test/rubygems/test_gem_commands_generate_index_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_help_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_info_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb122
-rw-r--r--test/rubygems/test_gem_commands_list_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_lock_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_mirror.rb2
-rw-r--r--test/rubygems/test_gem_commands_open_command.rb21
-rw-r--r--test/rubygems/test_gem_commands_outdated_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_owner_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_pristine_command.rb30
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb14
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb16
-rw-r--r--test/rubygems/test_gem_commands_search_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_server_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb50
-rw-r--r--test/rubygems/test_gem_commands_signin_command.rb14
-rw-r--r--test/rubygems/test_gem_commands_signout_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb12
-rw-r--r--test/rubygems/test_gem_commands_specification_command.rb14
-rw-r--r--test/rubygems/test_gem_commands_stale_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_uninstall_command.rb10
-rw-r--r--test/rubygems/test_gem_commands_unpack_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb51
-rw-r--r--test/rubygems/test_gem_commands_which_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_yank_command.rb4
-rw-r--r--test/rubygems/test_gem_config_file.rb20
-rw-r--r--test/rubygems/test_gem_dependency.rb14
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb10
-rw-r--r--test/rubygems/test_gem_dependency_list.rb2
-rw-r--r--test/rubygems/test_gem_dependency_resolution_error.rb2
-rw-r--r--test/rubygems/test_gem_doctor.rb62
-rw-r--r--test/rubygems/test_gem_ext_builder.rb45
-rw-r--r--test/rubygems/test_gem_ext_cmake_builder.rb10
-rw-r--r--test/rubygems/test_gem_ext_configure_builder.rb10
-rw-r--r--test/rubygems/test_gem_ext_ext_conf_builder.rb28
-rw-r--r--test/rubygems/test_gem_ext_rake_builder.rb4
-rw-r--r--test/rubygems/test_gem_gem_runner.rb2
-rw-r--r--test/rubygems/test_gem_gemcutter_utilities.rb18
-rw-r--r--test/rubygems/test_gem_impossible_dependencies_error.rb2
-rw-r--r--test/rubygems/test_gem_indexer.rb2
-rw-r--r--test/rubygems/test_gem_install_update_options.rb20
-rw-r--r--test/rubygems/test_gem_installer.rb306
-rw-r--r--test/rubygems/test_gem_local_remote_options.rb4
-rw-r--r--test/rubygems/test_gem_name_tuple.rb2
-rw-r--r--test/rubygems/test_gem_package.rb102
-rw-r--r--test/rubygems/test_gem_package_old.rb20
-rw-r--r--test/rubygems/test_gem_package_tar_header.rb12
-rw-r--r--test/rubygems/test_gem_package_tar_reader.rb2
-rw-r--r--test/rubygems/test_gem_package_tar_reader_entry.rb18
-rw-r--r--test/rubygems/test_gem_package_tar_writer.rb40
-rw-r--r--test/rubygems/test_gem_package_task.rb6
-rw-r--r--test/rubygems/test_gem_path_support.rb4
-rw-r--r--test/rubygems/test_gem_platform.rb31
-rw-r--r--test/rubygems/test_gem_rdoc.rb20
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb71
-rw-r--r--test/rubygems/test_gem_request.rb6
-rw-r--r--test/rubygems/test_gem_request_connection_pools.rb4
-rw-r--r--test/rubygems/test_gem_request_set.rb31
-rw-r--r--test/rubygems/test_gem_request_set_gem_dependency_api.rb34
-rw-r--r--test/rubygems/test_gem_request_set_lockfile.rb8
-rw-r--r--test/rubygems/test_gem_request_set_lockfile_parser.rb8
-rw-r--r--test/rubygems/test_gem_request_set_lockfile_tokenizer.rb10
-rw-r--r--test/rubygems/test_gem_requirement.rb28
-rw-r--r--test/rubygems/test_gem_resolver.rb24
-rw-r--r--test/rubygems/test_gem_resolver_activation_request.rb2
-rw-r--r--test/rubygems/test_gem_resolver_api_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_api_specification.rb2
-rw-r--r--test/rubygems/test_gem_resolver_best_set.rb4
-rw-r--r--test/rubygems/test_gem_resolver_composed_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_conflict.rb2
-rw-r--r--test/rubygems/test_gem_resolver_dependency_request.rb2
-rw-r--r--test/rubygems/test_gem_resolver_git_set.rb4
-rw-r--r--test/rubygems/test_gem_resolver_git_specification.rb7
-rw-r--r--test/rubygems/test_gem_resolver_index_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_index_specification.rb4
-rw-r--r--test/rubygems/test_gem_resolver_installed_specification.rb2
-rw-r--r--test/rubygems/test_gem_resolver_installer_set.rb10
-rw-r--r--test/rubygems/test_gem_resolver_local_specification.rb4
-rw-r--r--test/rubygems/test_gem_resolver_lock_set.rb2
-rw-r--r--test/rubygems/test_gem_resolver_lock_specification.rb2
-rw-r--r--test/rubygems/test_gem_resolver_requirement_list.rb2
-rw-r--r--test/rubygems/test_gem_resolver_specification.rb4
-rw-r--r--test/rubygems/test_gem_resolver_vendor_set.rb6
-rw-r--r--test/rubygems/test_gem_resolver_vendor_specification.rb2
-rw-r--r--test/rubygems/test_gem_security.rb12
-rw-r--r--test/rubygems/test_gem_security_policy.rb56
-rw-r--r--test/rubygems/test_gem_security_signer.rb16
-rw-r--r--test/rubygems/test_gem_security_trust_dir.rb10
-rw-r--r--test/rubygems/test_gem_server.rb14
-rw-r--r--test/rubygems/test_gem_silent_ui.rb20
-rw-r--r--test/rubygems/test_gem_source.rb6
-rw-r--r--test/rubygems/test_gem_source_fetch_problem.rb4
-rw-r--r--test/rubygems/test_gem_source_git.rb24
-rw-r--r--test/rubygems/test_gem_source_installed.rb2
-rw-r--r--test/rubygems/test_gem_source_list.rb2
-rw-r--r--test/rubygems/test_gem_source_local.rb2
-rw-r--r--test/rubygems/test_gem_source_lock.rb2
-rw-r--r--test/rubygems/test_gem_source_specific_file.rb4
-rw-r--r--test/rubygems/test_gem_source_subpath_problem.rb2
-rw-r--r--test/rubygems/test_gem_source_vendor.rb2
-rw-r--r--test/rubygems/test_gem_spec_fetcher.rb4
-rw-r--r--test/rubygems/test_gem_specification.rb162
-rw-r--r--test/rubygems/test_gem_stream_ui.rb4
-rw-r--r--test/rubygems/test_gem_stub_specification.rb10
-rw-r--r--test/rubygems/test_gem_text.rb2
-rw-r--r--test/rubygems/test_gem_uninstaller.rb34
-rw-r--r--test/rubygems/test_gem_unsatisfiable_dependency_error.rb2
-rw-r--r--test/rubygems/test_gem_uri_formatter.rb2
-rw-r--r--test/rubygems/test_gem_util.rb16
-rw-r--r--test/rubygems/test_gem_validator.rb2
-rw-r--r--test/rubygems/test_gem_version.rb19
-rw-r--r--test/rubygems/test_gem_version_option.rb2
-rw-r--r--test/rubygems/test_kernel.rb10
-rw-r--r--test/rubygems/test_project_sanity.rb4
-rw-r--r--test/rubygems/test_remote_fetch_error.rb4
-rw-r--r--test/rubygems/test_require.rb28
-rw-r--r--test/rubygems/utilities.rb (renamed from lib/rubygems/test_utilities.rb)4
-rw-r--r--test/socket/test_addrinfo.rb7
-rw-r--r--test/socket/test_socket.rb12
-rw-r--r--test/strscan/test_ractor.rb2
-rw-r--r--test/strscan/test_stringscanner.rb17
-rw-r--r--test/test_prime.rb299
-rw-r--r--test/test_time.rb9
-rw-r--r--test/test_timeout.rb8
-rw-r--r--test/test_tracer.rb234
-rw-r--r--test/uri/test_generic.rb4
-rw-r--r--test/uri/test_parser.rb5
-rw-r--r--thread.c209
-rw-r--r--thread_pthread.c43
-rw-r--r--thread_pthread.h4
-rw-r--r--thread_sync.c16
-rw-r--r--thread_win32.c32
-rw-r--r--time.c250
-rw-r--r--timev.rb386
-rw-r--r--tool/bundler/rubocop_gems.rb11
-rw-r--r--tool/bundler/rubocop_gems.rb.lock59
-rw-r--r--tool/bundler/standard_gems.rb11
-rw-r--r--tool/bundler/standard_gems.rb.lock65
-rw-r--r--tool/bundler/test_gems.rb3
-rw-r--r--tool/bundler/test_gems.rb.lock9
-rw-r--r--tool/ci_functions.sh29
-rwxr-xr-xtool/extlibs.rb2
-rw-r--r--tool/lib/minitest/autorun.rb14
-rw-r--r--tool/lib/minitest/benchmark.rb418
-rw-r--r--tool/lib/minitest/mock.rb196
-rw-r--r--tool/lib/minitest/unit.rb4
-rw-r--r--tool/lib/test/unit.rb7
-rw-r--r--tool/lib/test/unit/assertions.rb10
-rw-r--r--tool/lib/test/unit/core_assertions.rb10
-rw-r--r--tool/m4/_colorize_result_prepare.m42
-rw-r--r--tool/m4/ac_msg_result.m42
-rw-r--r--tool/m4/colorize_result.m42
-rw-r--r--tool/m4/ruby_append_option.m42
-rw-r--r--tool/m4/ruby_append_options.m42
-rw-r--r--tool/m4/ruby_check_builtin_func.m42
-rw-r--r--tool/m4/ruby_check_builtin_setjmp.m42
-rw-r--r--tool/m4/ruby_check_printf_prefix.m42
-rw-r--r--tool/m4/ruby_check_setjmp.m44
-rw-r--r--tool/m4/ruby_check_signedness.m42
-rw-r--r--tool/m4/ruby_check_sizeof.m42
-rw-r--r--tool/m4/ruby_check_sysconf.m42
-rw-r--r--tool/m4/ruby_cppoutfile.m42
-rw-r--r--tool/m4/ruby_decl_attribute.m42
-rw-r--r--tool/m4/ruby_default_arch.m45
-rw-r--r--tool/m4/ruby_define_if.m42
-rw-r--r--tool/m4/ruby_defint.m42
-rw-r--r--tool/m4/ruby_dtrace_available.m42
-rw-r--r--tool/m4/ruby_dtrace_postprocess.m42
-rw-r--r--tool/m4/ruby_func_attribute.m42
-rw-r--r--tool/m4/ruby_mingw32.m42
-rw-r--r--tool/m4/ruby_prepend_option.m42
-rw-r--r--tool/m4/ruby_prog_gnu_ld.m42
-rw-r--r--tool/m4/ruby_replace_funcs.m48
-rw-r--r--tool/m4/ruby_replace_type.m42
-rw-r--r--tool/m4/ruby_rm_recursive.m42
-rw-r--r--tool/m4/ruby_setjmp_type.m42
-rw-r--r--tool/m4/ruby_stack_grow_direction.m42
-rw-r--r--tool/m4/ruby_try_cflags.m42
-rw-r--r--tool/m4/ruby_try_cxxflags.m42
-rw-r--r--tool/m4/ruby_try_ldflags.m42
-rw-r--r--tool/m4/ruby_type_attribute.m42
-rw-r--r--tool/m4/ruby_universal_arch.m42
-rw-r--r--tool/m4/ruby_werror_flag.m42
-rw-r--r--tool/mjit_tabs.rb8
-rw-r--r--tool/mk_builtin_loader.rb2
-rwxr-xr-xtool/mkconfig.rb12
-rwxr-xr-xtool/rbinstall.rb31
-rw-r--r--tool/ruby_vm/views/_mjit_compile_send.erb4
-rw-r--r--tool/sync_default_gems.rb85
-rw-r--r--tool/test/minitest/metametameta.rb1
-rw-r--r--tool/test/minitest/test_minitest_benchmark.rb131
-rw-r--r--tool/test/minitest/test_minitest_mock.rb404
-rw-r--r--tool/test/webrick/test_filehandler.rb1
-rw-r--r--tool/test/webrick/test_httpproxy.rb1
-rw-r--r--tool/test/webrick/test_httpresponse.rb8
-rwxr-xr-xtool/travis_wait.sh18
-rw-r--r--trace_point.rb12
-rw-r--r--transcode.c2
-rw-r--r--util.c3
-rw-r--r--variable.c9
-rw-r--r--version.h4
-rw-r--r--vm.c9
-rw-r--r--vm_backtrace.c133
-rw-r--r--vm_core.h41
-rw-r--r--vm_dump.c81
-rw-r--r--vm_eval.c12
-rw-r--r--vm_exec.c2
-rw-r--r--vm_insnhelper.c9
-rw-r--r--vm_insnhelper.h4
-rw-r--r--vm_method.c40
-rw-r--r--vm_trace.c6
-rw-r--r--vsnprintf.c6
-rw-r--r--win32/Makefile.sub2
-rwxr-xr-xwin32/resource.rb2
-rw-r--r--win32/ruby.manifest8
-rw-r--r--win32/win32.c2
1091 files changed, 22314 insertions, 37037 deletions
diff --git a/.github/workflows/baseruby.yml b/.github/workflows/baseruby.yml
index 52099b6..11f71e0 100644
--- a/.github/workflows/baseruby.yml
+++ b/.github/workflows/baseruby.yml
@@ -26,7 +26,6 @@ jobs:
- run: sudo apt-get install build-essential autoconf bison
- run: ./autogen.sh
- run: ./configure --disable-install-doc
- - run: $make update-unicode
- run: $make common-srcs
- run: $make incs
- run: $make all
diff --git a/.github/workflows/compilers.yml b/.github/workflows/compilers.yml
index e95a088..3bd7bab 100644
--- a/.github/workflows/compilers.yml
+++ b/.github/workflows/compilers.yml
@@ -6,7 +6,7 @@ on: [push, pull_request]
# environment variables (plus the "echo ::set-env" hack) is to reroute that
# restriction.
env:
- default_cc: clang-11
+ default_cc: clang-13
append_cc: ''
crosshost: ''
@@ -47,33 +47,34 @@ jobs:
fail-fast: false
matrix:
entry:
- - { key: default_cc, name: gcc-10, value: gcc-10 }
-# - { key: default_cc, name: gcc-9, value: gcc-9 }
-# - { key: default_cc, name: gcc-8, value: gcc-8 }
-# - { key: default_cc, name: gcc-7, value: gcc-7 }
-# - { key: default_cc, name: gcc-6, value: gcc-6 }
-# - { key: default_cc, name: gcc-5, value: gcc-5 }
- - { key: default_cc, name: gcc-4.8, value: gcc-4.8 }
- - { key: default_cc, name: clang-13, value: clang-13 }
-# - { key: default_cc, name: clang-12, value: clang-12 }
-# - { key: default_cc, name: clang-11, value: clang-11 }
-# - { key: default_cc, name: clang-10, value: clang-10 }
-# - { key: default_cc, name: clang-9, value: clang-9 }
-# - { key: default_cc, name: clang-8, value: clang-8 }
-# - { key: default_cc, name: clang-7, value: clang-7 }
-# - { key: default_cc, name: clang-6.0, value: clang-6.0 }
-# - { key: default_cc, name: clang-5.0, value: clang-5.0 }
-# - { key: default_cc, name: clang-4.0, value: clang-4.0 }
- - { key: default_cc, name: clang-3.9, value: clang-3.9 }
-
- - { key: crosshost, name: aarch64-linux-gnu, value: aarch64-linux-gnu }
+ - { key: default_cc, name: gcc-11, value: gcc-11, container: gcc-11 }
+ - { key: default_cc, name: gcc-10, value: gcc-10, container: gcc-10 }
+ - { key: default_cc, name: gcc-9, value: gcc-9, container: gcc-9 }
+ - { key: default_cc, name: gcc-8, value: gcc-8, container: gcc-8 }
+ - { key: default_cc, name: gcc-7, value: gcc-7, container: gcc-7 }
+ - { key: default_cc, name: gcc-6, value: gcc-6, container: gcc-6 }
+ - { key: default_cc, name: gcc-5, value: gcc-5, container: gcc-5 }
+ - { key: default_cc, name: gcc-4.8, value: gcc-4.8, container: gcc-4.8 }
+ - { key: default_cc, name: clang-13, value: clang-13, container: clang-13 }
+ - { key: default_cc, name: clang-12, value: clang-12, container: clang-12 }
+ - { key: default_cc, name: clang-11, value: clang-11, container: clang-11 }
+ - { key: default_cc, name: clang-10, value: clang-10, container: clang-10 }
+ - { key: default_cc, name: clang-9, value: clang-9, container: clang-9 }
+ - { key: default_cc, name: clang-8, value: clang-8, container: clang-8 }
+ - { key: default_cc, name: clang-7, value: clang-7, container: clang-7 }
+ - { key: default_cc, name: clang-6.0, value: clang-6.0, container: clang-6.0 }
+ - { key: default_cc, name: clang-5.0, value: clang-5.0, container: clang-5.0 }
+ - { key: default_cc, name: clang-4.0, value: clang-4.0, container: clang-4.0 }
+ - { key: default_cc, name: clang-3.9, value: clang-3.9, container: clang-3.9 }
+
+ - { key: crosshost, name: aarch64-linux-gnu, value: aarch64-linux-gnu, container: crossbuild-essential-arm64 }
# - { key: crosshost, name: arm-linux-gnueabi, value: arm-linux-gnueabi }
# - { key: crosshost, name: arm-linux-gnueabihf, value: arm-linux-gnueabihf }
# - { key: crosshost, name: i686-w64-mingw32, value: i686-w64-mingw32 }
# - { key: crosshost, name: powerpc-linux-gnu, value: powerpc-linux-gnu }
- - { key: crosshost, name: powerpc64le-linux-gnu, value: powerpc64le-linux-gnu }
- - { key: crosshost, name: s390x-linux-gnu, value: s390x-linux-gnu }
- - { key: crosshost, name: x86_64-w64-mingw32, value: x86_64-w64-mingw32 }
+ - { key: crosshost, name: powerpc64le-linux-gnu, value: powerpc64le-linux-gnu, container: crossbuild-essential-ppc64el }
+ - { key: crosshost, name: s390x-linux-gnu, value: s390x-linux-gnu, container: crossbuild-essential-s390x }
+ - { key: crosshost, name: x86_64-w64-mingw32, value: x86_64-w64-mingw32, container: mingw-w64 }
- { key: append_cc, name: c99, value: '-std=c99 -Werror=pedantic -pedantic-errors' }
# - { key: append_cc, name: c11, value: '-std=c11 -Werror=pedantic -pedantic-errors' }
@@ -156,7 +157,7 @@ jobs:
name: ${{ matrix.entry.name }}
runs-on: ubuntu-latest
- container: ghcr.io/ruby/ruby-ci-image:latest
+ container: ghcr.io/ruby/ruby-ci-image:${{ matrix.entry.container || 'clang-13' }}
steps:
- run: mkdir build
working-directory:
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
index 6f5d435..9e02185 100644
--- a/.github/workflows/macos.yml
+++ b/.github/workflows/macos.yml
@@ -5,7 +5,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
- test_task: [ "check", "test-bundler-parallel", "test-bundled-gems" ]
+ test_task: [ "check", "test-bundler-parallel" ] #, "test-bundled-gems" ] matrix tests has unknown issues
fail-fast: false
env:
GITPULLOPTIONS: --no-tags origin ${{github.ref}}
diff --git a/.github/workflows/mjit.yml b/.github/workflows/mjit.yml
index c2a6ed2..d5cc9e9 100644
--- a/.github/workflows/mjit.yml
+++ b/.github/workflows/mjit.yml
@@ -38,7 +38,7 @@ jobs:
- run: ./autogen.sh
working-directory: src
- name: Run configure
- run: ../src/configure -C --disable-install-doc
+ run: ../src/configure -C --disable-install-doc cppflags=-DVM_CHECK_MODE
- run: make $JOBS incs
- run: make $JOBS
- run: sudo make $JOBS -s install
diff --git a/.github/workflows/spec_guards.yml b/.github/workflows/spec_guards.yml
index 9414984..f921d66 100644
--- a/.github/workflows/spec_guards.yml
+++ b/.github/workflows/spec_guards.yml
@@ -11,8 +11,6 @@ jobs:
# Specs from ruby/spec should still run on all supported Ruby versions.
# This also ensures the needed ruby_version_is guards are there, see spec/README.md.
ruby:
- - ruby-2.5
-# - ruby-2.6
- ruby-2.7
- ruby-3.0
diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml
index c7840f1..34dffa2 100644
--- a/.github/workflows/ubuntu.yml
+++ b/.github/workflows/ubuntu.yml
@@ -8,17 +8,8 @@ jobs:
os:
- ubuntu-20.04
# - ubuntu-18.04
-# - ubuntu-16.04
debug: ["", "-DRUBY_DEBUG"]
exclude:
- - test_task: test-bundler-parallel
- os: ubuntu-16.04
- - test_task: test-bundled-gems
- os: ubuntu-16.04
- - test_task: "test-all TESTS=--repeat-count=2"
- os: ubuntu-16.04
- - os: ubuntu-16.04
- debug: -DRUBY_DEBUG
- test_task: "test-all TESTS=--repeat-count=2"
debug: -DRUBY_DEBUG
fail-fast: false
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index e8633c5..ef2c003 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -4,7 +4,7 @@ jobs:
make:
strategy:
matrix:
- test_task: [test]
+ test_task: [check] # to make job names consistent
os: [windows-2019]
vs: [2019]
fail-fast: false
@@ -35,7 +35,11 @@ jobs:
${{ runner.os }}-chocolatey-
- name: Install libraries with chocolatey
run: |
- choco install --no-progress openssl winflexbison3
+ # Using Choco-Install for retries, but it doesn't detect failures properly
+ # if you pass multiple package names in a single command.
+ Choco-Install -PackageName openssl
+ Choco-Install -PackageName winflexbison3
+ shell: pwsh
- name: git config
run: |
git config --global core.autocrlf false
@@ -58,10 +62,24 @@ jobs:
nmake extract-extlibs
nmake
- name: nmake test
- timeout-minutes: 30
+ timeout-minutes: 5
run: |
call "%VCVARS%"
- nmake ${{ matrix.test_task }}
+ nmake test
+ - name: nmake test-all
+ timeout-minutes: 60
+ run: |
+ call "%VCVARS%"
+ ::- %TEMP% is inconsistent with %TMP% and test-all expects they are consistent.
+ ::- https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302
+ set TMP=%USERPROFILE%\AppData\Local\Temp
+ set TEMP=%USERPROFILE%\AppData\Local\Temp
+ nmake test-all
+ - name: nmake test-spec
+ timeout-minutes: 10
+ run: |
+ call "%VCVARS%"
+ nmake test-spec
- uses: k0kubun/action-slack@v2.0.0
with:
payload: |
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..ff0ce69
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,226 @@
+# -*- YAML -*-
+# Copyright (C) 2011 Urabe, Shyouhei. All rights reserved.
+#
+# This file is a part of the programming language Ruby. Permission is hereby
+# granted, to either redistribute or modify this file, provided that the
+# conditions mentioned in the file COPYING are met. Consult the file for
+# details.
+
+# We only manage non-amd64 free pipelines.
+# https://docs.travis-ci.com/user/billing-overview/
+
+language: c
+
+os: linux
+
+dist: focal
+
+git:
+ quiet: true
+
+cache:
+ ccache: true
+ directories:
+ - $HOME/config_2nd
+ - $HOME/.downloaded-cache
+
+env:
+ global:
+ # Reset timestamps early
+ - _=$(touch NEWS && find . -type f -exec touch -r NEWS {} +)
+ - CONFIGURE_TTY=no
+ - CCACHE_COMPILERCHECK=none
+ - CCACHE_NOCOMPRESS=1
+ - CCACHE_MAXSIZE=512Mi
+ - NPROC="`nproc`"
+ # JOBS and SETARCH are overridden when necessary; see below.
+ - JOBS=-j$((1+${NPROC}))
+ - SETARCH=
+ - RUBY_PREFIX=/tmp/ruby-prefix
+ - GEMS_FOR_TEST='timezone tzinfo'
+ # The tests skipped in `make test-all`.
+ - TEST_ALL_SKIPPED_TESTS=
+ # Run the separated tests with allowing failures.
+ - RUN_SEPARATED_TESTS=true
+ # The tests executed separately by `make test-all`.
+ - TEST_ALL_SEPARATED_TESTS=
+ # https://github.com/travis-ci/travis-build/blob/e411371dda21430a60f61b8f3f57943d2fe4d344/lib/travis/build/bash/travis_apt_get_options.bash#L7
+ - travis_apt_get_options='--allow-downgrades --allow-remove-essential --allow-change-held-packages'
+ - travis_apt_get_options="-yq --no-install-suggests --no-install-recommends $travis_apt_get_options"
+ # -O1 is faster than -O3 in our tests.
+ - optflags=-O1
+ # -g0 disables backtraces when SEGV. Do not set that.
+ - debugflags=-ggdb3
+
+.org.ruby-lang.ci.matrix-definitions:
+
+ - &gcc-10
+ compiler: gcc-10
+ before_install:
+ - tool/travis_retry.sh sudo bash -c "rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && exec apt-get update -yq"
+ - >-
+ tool/travis_retry.sh sudo -E apt-get $travis_apt_get_options install
+ ccache
+ gcc-10
+ g++-10
+ libffi-dev
+ libgdbm-dev
+ libncurses-dev
+ libncursesw5-dev
+ libreadline-dev
+ libssl-dev
+ libyaml-dev
+ openssl
+ zlib1g-dev
+
+ # --------
+
+ - &arm64-linux
+ name: arm64-linux
+ arch: arm64
+ <<: *gcc-10
+
+ - &ppc64le-linux
+ name: ppc64le-linux
+ arch: ppc64le
+ <<: *gcc-10
+
+ - &s390x-linux
+ name: s390x-linux
+ arch: s390x
+ <<: *gcc-10
+
+ - &arm32-linux
+ name: arm32-linux
+ arch: arm64
+ # https://packages.ubuntu.com/focal/crossbuild-essential-armhf
+ compiler: arm-linux-gnueabihf-gcc
+ env:
+ - SETARCH='setarch linux32 --verbose --32bit'
+ before_install:
+ - sudo dpkg --add-architecture armhf
+ - tool/travis_retry.sh sudo bash -c "rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && exec apt-get update -yq"
+ - >-
+ tool/travis_retry.sh sudo -E apt-get $travis_apt_get_options install
+ ccache
+ crossbuild-essential-armhf
+ libc6:armhf
+ libstdc++-10-dev:armhf
+ libffi-dev:armhf
+ libgdbm-dev:armhf
+ libncurses-dev:armhf
+ libncursesw5-dev:armhf
+ libreadline-dev:armhf
+ libssl-dev:armhf
+ linux-libc-dev:armhf
+ zlib1g-dev:armhf
+
+matrix:
+ include:
+ # Build every commit (Allowed Failures):
+ - <<: *arm32-linux
+ - <<: *arm64-linux
+ - <<: *ppc64le-linux
+ - <<: *s390x-linux
+ allow_failures:
+ # An arm64 job sometimes does not start right now.
+ # https://travis-ci.community/t/11629
+ - name: arm32-linux
+ - name: arm64-linux
+ # - name: ppc64le-linux
+ # - name: s390x-linux
+ fast_finish: true
+
+before_script:
+ - . tool/ci_functions.sh
+ - |-
+ if [ -n "${TEST_ALL_SKIPPED_TESTS}" ]; then
+ TEST_ALL_OPTS="${TEST_ALL_OPTS} $(ci_to_excluded_test_opts "${TEST_ALL_SKIPPED_TESTS}")"
+ if [ -z "${TEST_ALL_SEPARATED_TESTS}" ]; then
+ TEST_ALL_SEPARATED_TESTS="${TEST_ALL_SKIPPED_TESTS}"
+ fi
+ fi
+ - |-
+ if [ -n "${TEST_ALL_SEPARATED_TESTS}" ]; then
+ TEST_ALL_OPTS_SEPARATED="$(ci_to_included_test_opts "${TEST_ALL_SEPARATED_TESTS}")"
+ fi
+ - echo TEST_ALL_OPTS="${TEST_ALL_OPTS}" TEST_ALL_OPTS_SEPARATED="${TEST_ALL_OPTS_SEPARATED}"
+ - rm -fr .ext autom4te.cache
+ - |-
+ [ -d ~/.downloaded-cache ] ||
+ mkdir ~/.downloaded-cache
+ - ln -s ~/.downloaded-cache
+ - "> config.status"
+ - "> .rbconfig.time"
+ - sed -f tool/prereq.status template/Makefile.in common.mk > Makefile
+ - make -s $JOBS up
+ - make -s $JOBS srcs
+ - rm -f config.status Makefile rbconfig.rb .rbconfig.time
+ - |-
+ if [ -d ~/config_2nd ]; then
+ cp -pr ~/config_2nd build
+ else
+ mkdir build
+ fi
+ - mkdir config_1st config_2nd
+ - chmod -R a-w .
+ - chmod -R u+w build config_1st config_2nd
+ - cd build
+ - |-
+ case "$CC" in
+ gcc*) CC="ccache $CC${GCC_FLAGS:+ }$GCC_FLAGS -fno-diagnostics-color";;
+ clang*) CC="ccache $CC${GCC_FLAGS:+ }$GCC_FLAGS -fno-color-diagnostics";;
+ esac
+ - |-
+ [ ! -f config.cache ] ||
+ [ "$CC" = "`sed -n s/^ac_cv_prog_CC=//p config.cache`" ] ||
+ (set -x; exec rm config.cache)
+ - $SETARCH ../configure -C --disable-install-doc --prefix=$RUBY_PREFIX $CONFIG_FLAG
+ - cp -pr config.cache config.status .ext/include ../config_1st
+ - $SETARCH make reconfig
+ - cp -pr config.cache config.status .ext/include ../config_2nd
+ - (cd .. && exec diff -ru config_1st config_2nd)
+ - chmod u+w ..
+ - rm -rf ~/config_2nd
+ - mv ../config_2nd ~
+ - chmod u-w ..
+ - $SETARCH make -s $JOBS
+ - make -s install
+ - |-
+ [ -z "${GEMS_FOR_TEST}" ] ||
+ $RUBY_PREFIX/bin/gem install --no-document $GEMS_FOR_TEST
+ - echo "raise 'do not load ~/.irbrc in test'" > ~/.irbrc
+
+script:
+ - $SETARCH make -s test -o showflags TESTOPTS="${TESTOPTS=$JOBS -q --tty=no}"
+ - ../tool/travis_wait.sh $SETARCH make -s test-all -o exts TESTOPTS="$JOBS -q --tty=no ${TEST_ALL_OPTS}" RUBYOPT="-w"
+ # Run the failing tests separately returning ok status to check if it works,
+ # visualize them.
+ - |
+ if [ "${RUN_SEPARATED_TESTS}" = true -a -n "${TEST_ALL_OPTS_SEPARATED}" ]; then
+ $SETARCH make -s test-all -o exts TESTOPTS="$JOBS -v --tty=no ${TEST_ALL_OPTS_SEPARATED}" RUBYOPT="-w" || :
+ fi
+ - $SETARCH make -s test-spec MSPECOPT=-ff # not using `-j` because sometimes `mspec -j` silently dies
+ - $SETARCH make -s -o showflags leaked-globals
+
+# We enable Travis on the specific branches or forked repositories here.
+if: (repo = ruby/ruby AND (branch = master OR branch =~ /^ruby_\d_\d$/)) OR repo != ruby/ruby
+
+# We want to be notified when something happens.
+notifications:
+ irc:
+ channels:
+ - "chat.freenode.net#ruby-core"
+ on_success: change # [always|never|change] # default: always
+ on_failure: always # [always|never|change] # default: always
+ template:
+ - "%{message} by @%{author}: See %{build_url}"
+
+ webhooks:
+ urls:
+ - secure: mRsoS/UbqDkKkW5p3AEqM27d4SZnV6Gsylo3bm8T/deltQzTsGzZwrm7OIBXZv0UFZdE68XmPlyHfZFLSP2V9QZ7apXMf9/vw0GtcSe1gchtnjpAPF6lYBn7nMCbVPPx9cS0dwL927fjdRM1vj7IKZ2bk4F0lAJ25R25S6teqdk= # ruby-lang slack: ruby/simpler-alerts-bot (travis)
+ on_success: never
+ on_failure: always
+
+ email:
+ - jaruga@ruby-lang.org
diff --git a/LEGAL b/LEGAL
index 177dcf6..ecd1e16 100644
--- a/LEGAL
+++ b/LEGAL
@@ -531,7 +531,6 @@ mentioned below.
[include/ruby/st.h]
[missing/acosh.c]
[missing/alloca.c]
-[missing/dup2.c]
[missing/erf.c]
[missing/finite.c]
[missing/hypot.c]
@@ -934,9 +933,7 @@ mentioned below.
[lib/bundler]
[lib/bundler.rb]
-[lib/bundler.gemspec]
[spec/bundler]
-[man/bundle-*,gemfile.*]
Bundler is under the following license.
diff --git a/NEWS.md b/NEWS.md
index cf79ab7..d351a3d 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -6,6 +6,7 @@ since the **3.0.0** release, except for bug fixes.
Note that each entry is kept to a minimum, see links for details.
## Language changes
+
* Pin operator now takes an expression. [[Feature #17411]]
```ruby
@@ -13,12 +14,60 @@ Note that each entry is kept to a minimum, see links for details.
#=> [[3, 5], [5, 7], [11, 13]]
```
+* Multiple assignment evaluation order has been made consistent with
+ single assignment evaluation order. With single assignment, Ruby
+ uses a left-to-right evaluation order. With this code:
+
+ ```ruby
+ foo[0] = bar
+ ```
+
+ The following evaluation order is used:
+
+ 1. `foo`
+ 2. `bar`
+ 3. `[]=` called on the result of `foo`
+
+ In Ruby before 3.1.0, multiple assignment did not follow this
+ evaluation order. With this code:
+
+ ```ruby
+ foo[0], bar.baz = a, b
+ ```
+
+ Versions of Ruby before 3.1.0 would evaluate in the following
+ order
+
+ 1. `a`
+ 2. `b`
+ 3. `foo`
+ 4. `[]=` called on the result of `foo`
+ 5. `bar`
+ 6. `baz=` called on the result of `bar`
+
+ Starting in Ruby 3.1.0, evaluation order is now consistent with
+ single assignment, with the left hand side being evaluated before
+ the right hand side:
+
+ 1. `foo`
+ 2. `bar`
+ 3. `a`
+ 4. `b`
+ 5. `[]=` called on the result of `foo`
+ 6. `baz=` called on the result of `bar`
+
+ [[Bug #4443]]
+
## Command line options
## Core classes updates
Outstanding ones only.
+* Array
+
+ * Array#intersect? is added. [[Feature #15198]]
+
* Enumerable
* Enumerable#compact is added. [[Feature #17312]]
@@ -52,6 +101,10 @@ Outstanding ones only.
* Queue#initialize now accepts an Enumerable of initial values.
[[Feature #17327]]
+* Thread
+
+ * Thread#native_thread_id is added. [[Feature #17853]]
+
* Thread::Backtrace
* Thread::Backtrace.limit, which returns the value to limit backtrace
@@ -81,7 +134,12 @@ Excluding feature bug fixes.
### JIT
-* `RubyVM::MJIT` is renamed to `RubyVM::JIT`.
+* The default `--jit-max-cache` is changed from 100 to 10000.
+
+* The JIT compiler no longer skips compilation of methods longer than
+ 1000 instructions.
+
+* `RubyVM::MJIT` is renamed to `RubyVM::JIT`. [[Feature #17490]]
## Static analysis
@@ -91,9 +149,17 @@ Excluding feature bug fixes.
## Miscellaneous changes
+* lib/objspace/trace.rb is added, which is a tool for tracing the object
+ allocation. Just by requiring this file, tracing is started *immediately*.
+ Just by `Kernel#p`, you can investigate where an object was created.
+ Note that just requiring this file brings a large performance overhead.
+ This is only for debugging purpose. Do not use this in production.
+ [Feature #17762]
+[Bug #4443]: https://bugs.ruby-lang.org/issues/4443
[Feature #12194]: https://bugs.ruby-lang.org/issues/12194
[Feature #14256]: https://bugs.ruby-lang.org/issues/14256
+[Feature #15198]: https://bugs.ruby-lang.org/issues/15198
[Feature #16043]: https://bugs.ruby-lang.org/issues/16043
[Feature #16806]: https://bugs.ruby-lang.org/issues/16806
[Feature #17312]: https://bugs.ruby-lang.org/issues/17312
@@ -101,4 +167,6 @@ Excluding feature bug fixes.
[Feature #17411]: https://bugs.ruby-lang.org/issues/17411
[Bug #17423]: https://bugs.ruby-lang.org/issues/17423
[Feature #17479]: https://bugs.ruby-lang.org/issues/17479
+[Feature #17490]: https://bugs.ruby-lang.org/issues/17490
[Feature #17744]: https://bugs.ruby-lang.org/issues/17744
+[Feature #17762]: https://bugs.ruby-lang.org/issues/17762
diff --git a/README.md b/README.md
index 3cadbad..6bdfb1d 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
-[![Build Status](https://travis-ci.org/ruby/ruby.svg?branch=master)](https://travis-ci.org/ruby/ruby)
-[![Build status](https://ci.appveyor.com/api/projects/status/0sy8rrxut4o0k960/branch/master?svg=true)](https://ci.appveyor.com/project/ruby/ruby/branch/master)
[![Actions Status: macOS](https://github.com/ruby/ruby/workflows/macOS/badge.svg)](https://github.com/ruby/ruby/actions?query=workflow%3A"macOS")
[![Actions Status: MinGW](https://github.com/ruby/ruby/workflows/MinGW/badge.svg)](https://github.com/ruby/ruby/actions?query=workflow%3A"MinGW")
[![Actions Status: MJIT](https://github.com/ruby/ruby/workflows/MJIT/badge.svg)](https://github.com/ruby/ruby/actions?query=workflow%3A"MJIT")
[![Actions Status: Ubuntu](https://github.com/ruby/ruby/workflows/Ubuntu/badge.svg)](https://github.com/ruby/ruby/actions?query=workflow%3A"Ubuntu")
[![Actions Status: Windows](https://github.com/ruby/ruby/workflows/Windows/badge.svg)](https://github.com/ruby/ruby/actions?query=workflow%3A"Windows")
+[![AppVeyor status](https://ci.appveyor.com/api/projects/status/0sy8rrxut4o0k960/branch/master?svg=true)](https://ci.appveyor.com/project/ruby/ruby/branch/master)
+[![Travis Status](https://www.travis-ci.com/ruby/ruby.svg?branch=master)](https://www.travis-ci.com/ruby/ruby)
# What's Ruby
diff --git a/appveyor.yml b/appveyor.yml
index 6b9e6e9..351b7c7 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -24,7 +24,6 @@ environment:
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
GEMS_FOR_TEST: ""
RELINE_TEST_ENCODING: "Windows-31J"
- UPDATE_UNICODE: "UNICODE_FILES=. UNICODE_PROPERTY_FILES=. UNICODE_AUXILIARY_FILES=. UNICODE_EMOJI_FILES=."
for:
-
matrix:
@@ -49,8 +48,7 @@ for:
- echo>> Makefile RT_VER=0
- echo>> Makefile BUILTIN_ENCOBJS=nul
- type win32\Makefile.sub >> Makefile
- - nmake %mflags% touch-unicode-files
- - nmake %mflags% %UPDATE_UNICODE% incs
+ - nmake %mflags% up
- nmake %mflags% extract-extlibs
- del Makefile
- mkdir \usr\local\bin
diff --git a/array.c b/array.c
index be744e2..a1e0c13 100644
--- a/array.c
+++ b/array.c
@@ -354,14 +354,16 @@ ary_heap_free(VALUE ary)
}
}
-static void
+static size_t
ary_heap_realloc(VALUE ary, size_t new_capa)
{
+ size_t alloc_capa = new_capa;
size_t old_capa = ARY_HEAP_CAPA(ary);
if (RARRAY_TRANSIENT_P(ary)) {
if (new_capa <= old_capa) {
/* do nothing */
+ alloc_capa = old_capa;
}
else {
VALUE *new_ptr = rb_transient_heap_alloc(ary, sizeof(VALUE) * new_capa);
@@ -379,6 +381,8 @@ ary_heap_realloc(VALUE ary, size_t new_capa)
SIZED_REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, new_capa, old_capa);
}
ary_verify(ary);
+
+ return alloc_capa;
}
#if USE_TRANSIENT_HEAP
@@ -443,6 +447,7 @@ ary_resize_capa(VALUE ary, long capacity)
assert(!ARY_SHARED_P(ary));
if (capacity > RARRAY_EMBED_LEN_MAX) {
+ size_t new_capa = capacity;
if (ARY_EMBED_P(ary)) {
long len = ARY_EMBED_LEN(ary);
VALUE *ptr = ary_heap_alloc(ary, capacity);
@@ -453,9 +458,9 @@ ary_resize_capa(VALUE ary, long capacity)
ARY_SET_HEAP_LEN(ary, len);
}
else {
- ary_heap_realloc(ary, capacity);
+ new_capa = ary_heap_realloc(ary, capacity);
}
- ARY_SET_CAPA(ary, capacity);
+ ARY_SET_CAPA(ary, new_capa);
}
else {
if (!ARY_EMBED_P(ary)) {
@@ -2267,8 +2272,8 @@ rb_ary_resize(VALUE ary, long len)
}
else {
if (olen > len + ARY_DEFAULT_SIZE) {
- ary_heap_realloc(ary, len);
- ARY_SET_CAPA(ary, len);
+ size_t new_capa = ary_heap_realloc(ary, len);
+ ARY_SET_CAPA(ary, new_capa);
}
ARY_SET_HEAP_LEN(ary, len);
}
@@ -3069,11 +3074,13 @@ ary_rotate_ptr(VALUE *ptr, long len, long cnt)
VALUE tmp = *ptr;
memmove(ptr, ptr + 1, sizeof(VALUE)*(len - 1));
*(ptr + len - 1) = tmp;
- } else if (cnt == len - 1) {
+ }
+ else if (cnt == len - 1) {
VALUE tmp = *(ptr + len - 1);
memmove(ptr + 1, ptr, sizeof(VALUE)*(len - 1));
*ptr = tmp;
- } else {
+ }
+ else {
--len;
if (cnt < len) ary_reverse(ptr + cnt, ptr + len);
if (--cnt > 0) ary_reverse(ptr, ptr + cnt);
@@ -3208,6 +3215,7 @@ rb_ary_rotate_m(int argc, VALUE *argv, VALUE ary)
struct ary_sort_data {
VALUE ary;
+ VALUE receiver;
struct cmp_opt_data cmp_opt;
};
@@ -3220,6 +3228,15 @@ sort_reentered(VALUE ary)
return Qnil;
}
+static void
+sort_returned(struct ary_sort_data *data)
+{
+ if (rb_obj_frozen_p(data->receiver)) {
+ rb_raise(rb_eFrozenError, "array frozen during sort");
+ }
+ sort_reentered(data->ary);
+}
+
static int
sort_1(const void *ap, const void *bp, void *dummy)
{
@@ -3233,7 +3250,7 @@ sort_1(const void *ap, const void *bp, void *dummy)
args[1] = b;
retval = rb_yield_values2(2, args);
n = rb_cmpint(retval, a, b);
- sort_reentered(data->ary);
+ sort_returned(data);
return n;
}
@@ -3259,7 +3276,7 @@ sort_2(const void *ap, const void *bp, void *dummy)
retval = rb_funcallv(a, id_cmp, 1, &b);
n = rb_cmpint(retval, a, b);
- sort_reentered(data->ary);
+ sort_returned(data);
return n;
}
@@ -3311,6 +3328,7 @@ rb_ary_sort_bang(VALUE ary)
long len = RARRAY_LEN(ary);
RBASIC_CLEAR_CLASS(tmp);
data.ary = tmp;
+ data.receiver = ary;
data.cmp_opt.opt_methods = 0;
data.cmp_opt.opt_inited = 0;
RARRAY_PTR_USE(tmp, ptr, {
@@ -4311,10 +4329,9 @@ static VALUE
take_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, cbarg))
{
VALUE *args = (VALUE *)cbarg;
- if (args[1] == 0) rb_iter_break();
- else args[1]--;
if (argc > 1) val = rb_ary_new4(argc, argv);
rb_ary_push(args[0], val);
+ if (--args[1] == 0) rb_iter_break();
return Qnil;
}
@@ -4324,6 +4341,7 @@ take_items(VALUE obj, long n)
VALUE result = rb_check_array_type(obj);
VALUE args[2];
+ if (n == 0) return result;
if (!NIL_P(result)) return rb_ary_subseq(result, 0, n);
result = rb_ary_new2(n);
args[0] = result; args[1] = (VALUE)n;
@@ -5567,6 +5585,61 @@ rb_ary_union_multi(int argc, VALUE *argv, VALUE ary)
return ary_union;
}
+/*
+ * call-seq:
+ * ary.intersect?(other_ary) -> true or false
+ *
+ * Returns +true+ if the array and +other_ary+ have at least one element in
+ * common, otherwise returns +false+.
+ *
+ * a = [ 1, 2, 3 ]
+ * b = [ 3, 4, 5 ]
+ * c = [ 5, 6, 7 ]
+ * a.intersect?(b) #=> true
+ * a.intersect?(c) #=> false
+ */
+
+static VALUE
+rb_ary_intersect_p(VALUE ary1, VALUE ary2)
+{
+ VALUE hash, v, result, shorter, longer;
+ st_data_t vv;
+ long i;
+
+ ary2 = to_ary(ary2);
+ if (RARRAY_LEN(ary1) == 0 || RARRAY_LEN(ary2) == 0) return Qfalse;
+
+ if (RARRAY_LEN(ary1) <= SMALL_ARRAY_LEN && RARRAY_LEN(ary2) <= SMALL_ARRAY_LEN) {
+ for (i=0; i<RARRAY_LEN(ary1); i++) {
+ v = RARRAY_AREF(ary1, i);
+ if (rb_ary_includes_by_eql(ary2, v)) return Qtrue;
+ }
+ return Qfalse;
+ }
+
+ shorter = ary1;
+ longer = ary2;
+ if (RARRAY_LEN(ary1) > RARRAY_LEN(ary2)) {
+ longer = ary1;
+ shorter = ary2;
+ }
+
+ hash = ary_make_hash(shorter);
+ result = Qfalse;
+
+ for (i=0; i<RARRAY_LEN(longer); i++) {
+ v = RARRAY_AREF(longer, i);
+ vv = (st_data_t)v;
+ if (rb_hash_stlike_lookup(hash, vv, 0)) {
+ result = Qtrue;
+ break;
+ }
+ }
+ ary_recycle_hash(hash);
+
+ return result;
+}
+
static VALUE
ary_max_generic(VALUE ary, long i, VALUE vmax)
{
@@ -5677,7 +5750,7 @@ ary_max_opt_string(VALUE ary, long i, VALUE vmax)
* With an argument \Integer +n+ and no block, returns a new \Array with at most +n+ elements,
* in descending order per method <tt><=></tt>:
* [0, 1, 2, 3].max(3) # => [3, 2, 1]
- * [0, 1, 2, 3].max(6) # => [3, 2, 1]
+ * [0, 1, 2, 3].max(6) # => [3, 2, 1, 0]
*
* When a block is given, the block must return an \Integer.
*
@@ -8295,6 +8368,7 @@ Init_Array(void)
rb_define_method(rb_cArray, "union", rb_ary_union_multi, -1);
rb_define_method(rb_cArray, "difference", rb_ary_difference_multi, -1);
rb_define_method(rb_cArray, "intersection", rb_ary_intersection_multi, -1);
+ rb_define_method(rb_cArray, "intersect?", rb_ary_intersect_p, 1);
rb_define_method(rb_cArray, "<<", rb_ary_push, 1);
rb_define_method(rb_cArray, "push", rb_ary_push_m, -1);
rb_define_alias(rb_cArray, "append", "push");
diff --git a/ast.c b/ast.c
index 7d65db5..3945a32 100644
--- a/ast.c
+++ b/ast.c
@@ -64,8 +64,8 @@ ast_new_internal(rb_ast_t *ast, const NODE *node)
return obj;
}
-static VALUE rb_ast_parse_str(VALUE str);
-static VALUE rb_ast_parse_file(VALUE path);
+static VALUE rb_ast_parse_str(VALUE str, VALUE save_script_lines);
+static VALUE rb_ast_parse_file(VALUE path, VALUE save_script_lines);
static VALUE
ast_parse_new(void)
@@ -85,29 +85,31 @@ ast_parse_done(rb_ast_t *ast)
}
static VALUE
-ast_s_parse(rb_execution_context_t *ec, VALUE module, VALUE str)
+ast_s_parse(rb_execution_context_t *ec, VALUE module, VALUE str, VALUE save_script_lines)
{
- return rb_ast_parse_str(str);
+ return rb_ast_parse_str(str, save_script_lines);
}
static VALUE
-rb_ast_parse_str(VALUE str)
+rb_ast_parse_str(VALUE str, VALUE save_script_lines)
{
rb_ast_t *ast = 0;
StringValue(str);
- ast = rb_parser_compile_string_path(ast_parse_new(), Qnil, str, 1);
+ VALUE vparser = ast_parse_new();
+ if (RTEST(save_script_lines)) rb_parser_save_script_lines(vparser);
+ ast = rb_parser_compile_string_path(vparser, Qnil, str, 1);
return ast_parse_done(ast);
}
static VALUE
-ast_s_parse_file(rb_execution_context_t *ec, VALUE module, VALUE path)
+ast_s_parse_file(rb_execution_context_t *ec, VALUE module, VALUE path, VALUE save_script_lines)
{
- return rb_ast_parse_file(path);
+ return rb_ast_parse_file(path, save_script_lines);
}
static VALUE
-rb_ast_parse_file(VALUE path)
+rb_ast_parse_file(VALUE path, VALUE save_script_lines)
{
VALUE f;
rb_ast_t *ast = 0;
@@ -116,7 +118,9 @@ rb_ast_parse_file(VALUE path)
FilePathValue(path);
f = rb_file_open_str(path, "r");
rb_funcall(f, rb_intern("set_encoding"), 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-"));
- ast = rb_parser_compile_file_path(ast_parse_new(), Qnil, f, 1);
+ VALUE vparser = ast_parse_new();
+ if (RTEST(save_script_lines)) rb_parser_save_script_lines(vparser);
+ ast = rb_parser_compile_file_path(vparser, Qnil, f, 1);
rb_io_close(f);
return ast_parse_done(ast);
}
@@ -135,12 +139,14 @@ lex_array(VALUE array, int index)
}
static VALUE
-rb_ast_parse_array(VALUE array)
+rb_ast_parse_array(VALUE array, VALUE save_script_lines)
{
rb_ast_t *ast = 0;
array = rb_check_array_type(array);
- ast = rb_parser_compile_generic(ast_parse_new(), lex_array, Qnil, array, 1);
+ VALUE vparser = ast_parse_new();
+ if (RTEST(save_script_lines)) rb_parser_save_script_lines(vparser);
+ ast = rb_parser_compile_generic(vparser, lex_array, Qnil, array, 1);
return ast_parse_done(ast);
}
@@ -187,35 +193,38 @@ script_lines(VALUE path)
}
static VALUE
-ast_s_of(rb_execution_context_t *ec, VALUE module, VALUE body)
+ast_s_of(rb_execution_context_t *ec, VALUE module, VALUE body, VALUE save_script_lines)
{
VALUE path, node, lines;
int node_id;
- const rb_iseq_t *iseq = NULL;
- if (rb_obj_is_proc(body)) {
- iseq = vm_proc_iseq(body);
-
- if (!rb_obj_is_iseq((VALUE)iseq)) {
- iseq = NULL;
- }
+ if (rb_frame_info_p(body)) {
+ rb_frame_info_get(body, &path, &node_id);
+ if (NIL_P(path)) return Qnil;
}
else {
- iseq = rb_method_iseq(body);
- }
+ const rb_iseq_t *iseq = NULL;
- if (!iseq) return Qnil;
+ if (rb_obj_is_proc(body)) {
+ iseq = vm_proc_iseq(body);
+
+ if (!rb_obj_is_iseq((VALUE)iseq)) return Qnil;
+ }
+ else {
+ iseq = rb_method_iseq(body);
+ }
+ path = rb_iseq_path(iseq);
+ node_id = iseq->body->location.node_id;
+ }
- path = rb_iseq_path(iseq);
- node_id = iseq->body->location.node_id;
if (!NIL_P(lines = script_lines(path))) {
- node = rb_ast_parse_array(lines);
+ node = rb_ast_parse_array(lines, save_script_lines);
}
else if (RSTRING_LEN(path) == 2 && memcmp(RSTRING_PTR(path), "-e", 2) == 0) {
- node = rb_ast_parse_str(rb_e_script);
+ node = rb_ast_parse_str(rb_e_script, save_script_lines);
}
else {
- node = rb_ast_parse_file(path);
+ node = rb_ast_parse_file(path, save_script_lines);
}
return node_find(node, node_id);
@@ -245,6 +254,17 @@ ast_node_type(rb_execution_context_t *ec, VALUE self)
return rb_sym_intern_ascii_cstr(node_type_to_str(data->node));
}
+#ifdef DEBUG_ISEQ_NODE_ID
+static VALUE
+ast_node_node_id(VALUE self)
+{
+ struct ASTNodeData *data;
+ TypedData_Get_Struct(self, struct ASTNodeData, &rb_node_type, data);
+
+ return INT2FIX(nd_node_id(data->node));
+}
+#endif
+
#define NEW_CHILD(ast, node) node ? ast_new_internal(ast, node) : Qnil
static VALUE
@@ -687,6 +707,16 @@ ast_node_inspect(rb_execution_context_t *ec, VALUE self)
return str;
}
+static VALUE
+ast_node_script_lines(rb_execution_context_t *ec, VALUE self)
+{
+ struct ASTNodeData *data;
+ TypedData_Get_Struct(self, struct ASTNodeData, &rb_node_type, data);
+ VALUE ret = data->ast->body.script_lines;
+ if (!RB_TYPE_P(ret, T_ARRAY)) return Qnil;
+ return ret;
+}
+
#include "ast.rbinc"
void
@@ -695,4 +725,7 @@ Init_ast(void)
rb_mAST = rb_define_module_under(rb_cRubyVM, "AbstractSyntaxTree");
rb_cNode = rb_define_class_under(rb_mAST, "Node", rb_cObject);
rb_undef_alloc_func(rb_cNode);
+#ifdef DEBUG_ISEQ_NODE_ID
+ rb_define_method(rb_cNode, "node_id", ast_node_node_id, 0);
+#endif
}
diff --git a/ast.rb b/ast.rb
index 34fa645..ce99f53 100644
--- a/ast.rb
+++ b/ast.rb
@@ -1,145 +1,178 @@
# for ast.c
-class RubyVM
+# AbstractSyntaxTree provides methods to parse Ruby code into
+# abstract syntax trees. The nodes in the tree
+# are instances of RubyVM::AbstractSyntaxTree::Node.
+#
+# This module is MRI specific as it exposes implementation details
+# of the MRI abstract syntax tree.
+#
+# This module is experimental and its API is not stable, therefore it might
+# change without notice. As examples, the order of children nodes is not
+# guaranteed, the number of children nodes might change, there is no way to
+# access children nodes by name, etc.
+#
+# If you are looking for a stable API or an API working under multiple Ruby
+# implementations, consider using the _parser_ gem or Ripper. If you would
+# like to make RubyVM::AbstractSyntaxTree stable, please join the discussion
+# at https://bugs.ruby-lang.org/issues/14844.
+#
+module RubyVM::AbstractSyntaxTree
- # AbstractSyntaxTree provides methods to parse Ruby code into
- # abstract syntax trees. The nodes in the tree
- # are instances of RubyVM::AbstractSyntaxTree::Node.
+ # call-seq:
+ # RubyVM::AbstractSyntaxTree.parse(string) -> RubyVM::AbstractSyntaxTree::Node
#
- # This module is MRI specific as it exposes implementation details
- # of the MRI abstract syntax tree.
+ # Parses the given _string_ into an abstract syntax tree,
+ # returning the root node of that tree.
#
- # This module is experimental and its API is not stable, therefore it might
- # change without notice. As examples, the order of children nodes is not
- # guaranteed, the number of children nodes might change, there is no way to
- # access children nodes by name, etc.
+ # SyntaxError is raised if the given _string_ is invalid syntax.
#
- # If you are looking for a stable API or an API working under multiple Ruby
- # implementations, consider using the _parser_ gem or Ripper. If you would
- # like to make RubyVM::AbstractSyntaxTree stable, please join the discussion
- # at https://bugs.ruby-lang.org/issues/14844.
+ # RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
+ # # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-1:9>
+ def self.parse string, save_script_lines: false
+ Primitive.ast_s_parse string, save_script_lines
+ end
+
+ # call-seq:
+ # RubyVM::AbstractSyntaxTree.parse_file(pathname) -> RubyVM::AbstractSyntaxTree::Node
+ #
+ # Reads the file from _pathname_, then parses it like ::parse,
+ # returning the root node of the abstract syntax tree.
+ #
+ # SyntaxError is raised if _pathname_'s contents are not
+ # valid Ruby syntax.
+ #
+ # RubyVM::AbstractSyntaxTree.parse_file("my-app/app.rb")
+ # # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-31:3>
+ def self.parse_file pathname, save_script_lines: false
+ Primitive.ast_s_parse_file pathname, save_script_lines
+ end
+
+ # call-seq:
+ # RubyVM::AbstractSyntaxTree.of(proc) -> RubyVM::AbstractSyntaxTree::Node
+ # RubyVM::AbstractSyntaxTree.of(method) -> RubyVM::AbstractSyntaxTree::Node
+ #
+ # Returns AST nodes of the given _proc_ or _method_.
+ #
+ # RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
+ # # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:35-1:42>
#
- module AbstractSyntaxTree
+ # def hello
+ # puts "hello, world"
+ # end
+ #
+ # RubyVM::AbstractSyntaxTree.of(method(:hello))
+ # # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-3:3>
+ def self.of body, save_script_lines: false
+ Primitive.ast_s_of body, save_script_lines
+ end
+
+ # RubyVM::AbstractSyntaxTree::Node instances are created by parse methods in
+ # RubyVM::AbstractSyntaxTree.
+ #
+ # This class is MRI specific.
+ #
+ class Node
# call-seq:
- # RubyVM::AbstractSyntaxTree.parse(string) -> RubyVM::AbstractSyntaxTree::Node
- #
- # Parses the given _string_ into an abstract syntax tree,
- # returning the root node of that tree.
+ # node.type -> symbol
#
- # SyntaxError is raised if the given _string_ is invalid syntax.
+ # Returns the type of this node as a symbol.
#
- # RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
- # # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-1:9>
- def self.parse string
- Primitive.ast_s_parse string
+ # root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
+ # root.type # => :SCOPE
+ # lasgn = root.children[2]
+ # lasgn.type # => :LASGN
+ # call = lasgn.children[1]
+ # call.type # => :OPCALL
+ def type
+ Primitive.ast_node_type
end
# call-seq:
- # RubyVM::AbstractSyntaxTree.parse_file(pathname) -> RubyVM::AbstractSyntaxTree::Node
+ # node.first_lineno -> integer
#
- # Reads the file from _pathname_, then parses it like ::parse,
- # returning the root node of the abstract syntax tree.
+ # The line number in the source code where this AST's text began.
+ def first_lineno
+ Primitive.ast_node_first_lineno
+ end
+
+ # call-seq:
+ # node.first_column -> integer
#
- # SyntaxError is raised if _pathname_'s contents are not
- # valid Ruby syntax.
+ # The column number in the source code where this AST's text began.
+ def first_column
+ Primitive.ast_node_first_column
+ end
+
+ # call-seq:
+ # node.last_lineno -> integer
#
- # RubyVM::AbstractSyntaxTree.parse_file("my-app/app.rb")
- # # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-31:3>
- def self.parse_file pathname
- Primitive.ast_s_parse_file pathname
+ # The line number in the source code where this AST's text ended.
+ def last_lineno
+ Primitive.ast_node_last_lineno
end
# call-seq:
- # RubyVM::AbstractSyntaxTree.of(proc) -> RubyVM::AbstractSyntaxTree::Node
- # RubyVM::AbstractSyntaxTree.of(method) -> RubyVM::AbstractSyntaxTree::Node
+ # node.last_column -> integer
#
- # Returns AST nodes of the given _proc_ or _method_.
+ # The column number in the source code where this AST's text ended.
+ def last_column
+ Primitive.ast_node_last_column
+ end
+
+ # call-seq:
+ # node.children -> array
#
- # RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
- # # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:35-1:42>
+ # Returns AST nodes under this one. Each kind of node
+ # has different children, depending on what kind of node it is.
#
- # def hello
- # puts "hello, world"
- # end
+ # The returned array may contain other nodes or <code>nil</code>.
+ def children
+ Primitive.ast_node_children
+ end
+
+ # call-seq:
+ # node.inspect -> string
#
- # RubyVM::AbstractSyntaxTree.of(method(:hello))
- # # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-3:3>
- def self.of body
- Primitive.ast_s_of body
+ # Returns debugging information about this node as a string.
+ def inspect
+ Primitive.ast_node_inspect
end
- # RubyVM::AbstractSyntaxTree::Node instances are created by parse methods in
- # RubyVM::AbstractSyntaxTree.
+ # call-seq:
+ # node.script_lines -> array
#
- # This class is MRI specific.
+ # Returns the original source code as an array of lines.
#
- class Node
-
- # call-seq:
- # node.type -> symbol
- #
- # Returns the type of this node as a symbol.
- #
- # root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
- # root.type # => :SCOPE
- # lasgn = root.children[2]
- # lasgn.type # => :LASGN
- # call = lasgn.children[1]
- # call.type # => :OPCALL
- def type
- Primitive.ast_node_type
- end
-
- # call-seq:
- # node.first_lineno -> integer
- #
- # The line number in the source code where this AST's text began.
- def first_lineno
- Primitive.ast_node_first_lineno
- end
-
- # call-seq:
- # node.first_column -> integer
- #
- # The column number in the source code where this AST's text began.
- def first_column
- Primitive.ast_node_first_column
- end
-
- # call-seq:
- # node.last_lineno -> integer
- #
- # The line number in the source code where this AST's text ended.
- def last_lineno
- Primitive.ast_node_last_lineno
- end
-
- # call-seq:
- # node.last_column -> integer
- #
- # The column number in the source code where this AST's text ended.
- def last_column
- Primitive.ast_node_last_column
- end
-
- # call-seq:
- # node.children -> array
- #
- # Returns AST nodes under this one. Each kind of node
- # has different children, depending on what kind of node it is.
- #
- # The returned array may contain other nodes or <code>nil</code>.
- def children
- Primitive.ast_node_children
- end
+ # Note that this is an API for ruby internal use, debugging,
+ # and research. Do not use this for any other purpose.
+ # The compatibility is not guaranteed.
+ def script_lines
+ Primitive.ast_node_script_lines
+ end
- # call-seq:
- # node.inspect -> string
- #
- # Returns debugging information about this node as a string.
- def inspect
- Primitive.ast_node_inspect
+ # call-seq:
+ # node.source -> string
+ #
+ # Returns the code fragment that corresponds to this AST.
+ #
+ # Note that this is an API for ruby internal use, debugging,
+ # and research. Do not use this for any other purpose.
+ # The compatibility is not guaranteed.
+ #
+ # Also note that this API may return an incomplete code fragment
+ # that does not parse; for example, a here document following
+ # an expression may be dropped.
+ def source
+ lines = script_lines
+ if lines
+ lines = lines[first_lineno - 1 .. last_lineno - 1]
+ lines[-1] = lines[-1][0...last_column]
+ lines[0] = lines[0][first_column..-1]
+ lines.join
+ else
+ nil
end
end
end
diff --git a/benchmark/README.md b/benchmark/README.md
index 39a5aa1..c222164 100644
--- a/benchmark/README.md
+++ b/benchmark/README.md
@@ -37,7 +37,7 @@ Usage: benchmark-driver [options] RUBY|YAML...
--bundler Install and use gems specified in Gemfile
--filter REGEXP Filter out benchmarks with given regexp
--run-duration SECONDS Warmup estimates loop_count to run for this duration (default: 3)
- -v, --verbose Verbose mode. Multiple -v options increase visilibity (max: 2)
+ -v, --verbose Verbose mode. Multiple -v options increase visibility (max: 2)
```
## make benchmark
diff --git a/benchmark/ivar_extend.yml b/benchmark/ivar_extend.yml
new file mode 100644
index 0000000..eb9ee92
--- /dev/null
+++ b/benchmark/ivar_extend.yml
@@ -0,0 +1,23 @@
+prelude: |
+ class Embedded
+ def initialize
+ @a = 1
+ @b = 1
+ @c = 1
+ end
+ end
+
+ class Extended
+ def initialize
+ @a = 1
+ @b = 1
+ @c = 1
+ @d = 1
+ @e = 1
+ @f = 1
+ end
+ end
+benchmark:
+ embedded: Embedded.new
+ extended: Extended.new
+loop_count: 20_000_000
diff --git a/benchmark/masgn.yml b/benchmark/masgn.yml
new file mode 100644
index 0000000..4be9333
--- /dev/null
+++ b/benchmark/masgn.yml
@@ -0,0 +1,29 @@
+prelude: |
+ a = [nil] * 3
+ b = Class.new{attr_writer :a, :b, :c}.new
+ c, d, e, f = nil, nil, nil, nil
+benchmark:
+ array2_2: "c = (a[0], a[1] = 1, 2)"
+ array2_3: "c = (a[0], a[1] = 1, 2, 3)"
+ array3_2: "c = (a[0], a[1], a[2] = 1, 2)"
+ array3_3: "c = (a[0], a[1], a[2] = 1, 2, 3)"
+ attr2_2: "c = (b.a, b.b = 1, 2)"
+ attr2_3: "c = (b.a, b.b = 1, 2, 3)"
+ attr3_2: "c = (b.a, b.b, b.c = 1, 2)"
+ attr3_3: "c = (b.a, b.b, b.c = 1, 2, 3)"
+ lvar2_2: "c = (d, e = 1, 2)"
+ lvar2_3: "c = (d, e = 1, 2, 3)"
+ lvar3_2: "c = (d, e, f = 1, 2)"
+ lvar3_3: "c = (d, e, f = 1, 2, 3)"
+ array2_2p: "(a[0], a[1] = 1, 2; nil)"
+ array2_3p: "(a[0], a[1] = 1, 2, 3; nil)"
+ array3_2p: "(a[0], a[1], a[2] = 1, 2; nil)"
+ array3_3p: "(a[0], a[1], a[2] = 1, 2, 3; nil)"
+ attr2_2p: "(b.a, b.b = 1, 2; nil)"
+ attr2_3p: "(b.a, b.b = 1, 2, 3; nil)"
+ attr3_2p: "(b.a, b.b, b.c = 1, 2; nil)"
+ attr3_3p: "(b.a, b.b, b.c = 1, 2, 3; nil)"
+ lvar2_2p: "(d, e = 1, 2; nil)"
+ lvar2_3p: "(d, e = 1, 2, 3; nil)"
+ lvar3_2p: "(d, e, f = 1, 2; nil)"
+ lvar3_3p: "(d, e, f = 1, 2, 3; nil)"
diff --git a/benchmark/mjit_integer.yml b/benchmark/mjit_integer.yml
index edc3556..a6b5c9e 100644
--- a/benchmark/mjit_integer.yml
+++ b/benchmark/mjit_integer.yml
@@ -8,6 +8,7 @@ prelude: |
def mjit_magnitude(int) int.magnitude end
def mjit_odd?(int) int.odd? end
def mjit_ord(int) int.ord end
+ def mjit_size(int) int.size end
def mjit_to_i(int) int.to_i end
def mjit_to_int(int) int.to_int end
def mjit_uminus(int) -int end
@@ -22,6 +23,7 @@ benchmark:
- mjit_magnitude(-1)
- mjit_odd?(1)
- mjit_ord(1)
+ - mjit_size(1)
- mjit_to_i(1)
- mjit_to_int(1)
- mjit_uminus(1)
diff --git a/benchmark/nilclass.yml b/benchmark/nilclass.yml
new file mode 100644
index 0000000..fba67a5
--- /dev/null
+++ b/benchmark/nilclass.yml
@@ -0,0 +1,6 @@
+benchmark:
+ to_i: |
+ nil.to_i
+ to_f: |
+ nil.to_f
+loop_count: 100000
diff --git a/benchmark/vm_case_classes.yml b/benchmark/vm_case_classes.yml
new file mode 100644
index 0000000..cacc4f0
--- /dev/null
+++ b/benchmark/vm_case_classes.yml
@@ -0,0 +1,9 @@
+benchmark:
+ vm_case_classes: |
+ case :foo
+ when Hash
+ raise
+ when Array
+ raise
+ end
+loop_count: 6000000
diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb
index 6299b50..7e77dfc 100644
--- a/bootstraptest/test_ractor.rb
+++ b/bootstraptest/test_ractor.rb
@@ -248,7 +248,8 @@ assert_equal 30.times.map { 'ok' }.to_s, %q{
30.times.map{|i|
test i
}
-} unless ENV['RUN_OPTS'] =~ /--jit-min-calls=5/ # This always fails with --jit-wait --jit-min-calls=5
+} unless ENV['RUN_OPTS'] =~ /--jit-min-calls=5/ || # This always fails with --jit-wait --jit-min-calls=5
+ (ENV.key?('TRAVIS') && ENV['TRAVIS_CPU_ARCH'] == 'arm64') # https://bugs.ruby-lang.org/issues/17878
# Exception for empty select
assert_match /specify at least one ractor/, %q{
diff --git a/builtin.c b/builtin.c
index 7c3653d..21fff95 100644
--- a/builtin.c
+++ b/builtin.c
@@ -3,7 +3,7 @@
#include "iseq.h"
#include "builtin.h"
-#if CROSS_COMPILING
+#ifdef CROSS_COMPILING
#define INCLUDED_BY_BUILTIN_C 1
#include "mini_builtin.c"
diff --git a/builtin.h b/builtin.h
index 3b2f477..5b4bda1 100644
--- a/builtin.h
+++ b/builtin.h
@@ -65,7 +65,7 @@ PUREFUNC(static inline VALUE rb_vm_lvar(rb_execution_context_t *ec, int index));
static inline VALUE
rb_vm_lvar(rb_execution_context_t *ec, int index)
{
-#if VM_CORE_H_EC_DEFINED
+#if defined(VM_CORE_H_EC_DEFINED) && VM_CORE_H_EC_DEFINED
return ec->cfp->ep[index];
#else
return rb_vm_lvar_exposed(ec, index);
diff --git a/ccan/list/list.h b/ccan/list/list.h
index 7d21930..c434ad8 100644
--- a/ccan/list/list.h
+++ b/ccan/list/list.h
@@ -658,7 +658,7 @@ static inline void list_prepend_list_(struct list_head *to,
* @off: offset(relative to @i) at which list node data resides.
*
* This is a low-level wrapper to iterate @i over the entire list, used to
- * implement all oher, more high-level, for-each constructs. It's a for loop,
+ * implement all other, more high-level, for-each constructs. It's a for loop,
* so you can break and continue as normal.
*
* WARNING! Being the low-level macro that it is, this wrapper doesn't know
diff --git a/class.c b/class.c
index e1e1ce0..9ac2b3f 100644
--- a/class.c
+++ b/class.c
@@ -173,8 +173,21 @@ rb_class_detach_module_subclasses(VALUE klass)
static VALUE
class_alloc(VALUE flags, VALUE klass)
{
- NEWOBJ_OF(obj, struct RClass, klass, (flags & T_MASK) | FL_PROMOTED1 /* start from age == 2 */ | (RGENGC_WB_PROTECTED_CLASS ? FL_WB_PROTECTED : 0));
+ size_t payload_size = 0;
+
+#if USE_RVARGC
+ payload_size = sizeof(rb_classext_t);
+#endif
+
+ RVARGC_NEWOBJ_OF(obj, struct RClass, klass, (flags & T_MASK) | FL_PROMOTED1 /* start from age == 2 */ | (RGENGC_WB_PROTECTED_CLASS ? FL_WB_PROTECTED : 0), payload_size);
+
+#if USE_RVARGC
+ obj->ptr = (rb_classext_t *)rb_rvargc_payload_data_ptr((VALUE)obj + rb_slot_size());
+ RB_OBJ_WRITTEN(obj, Qundef, (VALUE)obj + rb_slot_size());
+#else
obj->ptr = ZALLOC(rb_classext_t);
+#endif
+
/* ZALLOC
RCLASS_IV_TBL(obj) = 0;
RCLASS_CONST_TBL(obj) = 0;
@@ -1168,10 +1181,12 @@ cache_clear_refined_method(ID key, VALUE value, void *data)
{
rb_method_entry_t *me = (rb_method_entry_t *) value;
- if (me->def->type == VM_METHOD_TYPE_REFINED) {
+ if (me->def->type == VM_METHOD_TYPE_REFINED && me->def->body.refined.orig_me) {
VALUE klass = (VALUE)data;
rb_clear_method_cache(klass, me->called_id);
}
+ // Refined method entries without an orig_me is going to stay in the method
+ // table of klass, like before the move, so no need to clear the cache.
return ID_TABLE_CONTINUE;
}
diff --git a/common.mk b/common.mk
index 17116c4..30380e0 100644
--- a/common.mk
+++ b/common.mk
@@ -306,6 +306,7 @@ exts-note: $(EXTS_MK)
$(Q)$(MAKE) $(EXTS_NOTE)
ext/extinit.c: $(srcdir)/template/extinit.c.tmpl $(PREP)
+ $(MAKEDIRS) $(@D)
$(Q)$(MINIRUBY) $(tooldir)/generic_erb.rb -o $@ -c \
$(srcdir)/template/extinit.c.tmpl $(EXTINITS)
@@ -1031,6 +1032,7 @@ BUILTIN_RB_SRCS = \
$(srcdir)/kernel.rb \
$(srcdir)/ractor.rb \
$(srcdir)/timev.rb \
+ $(srcdir)/nilclass.rb \
$(srcdir)/prelude.rb \
$(srcdir)/gem_prelude.rb \
$(empty)
@@ -1151,8 +1153,9 @@ builtin_binary.inc: $(PREP) $(BUILTIN_RB_SRCS) $(srcdir)/template/builtin_binary
$(BUILTIN_RB_INCS): $(top_srcdir)/tool/mk_builtin_loader.rb
$(srcdir)/revision.h:
- $(Q)$(gnumake:yes=#) $(RM) $(@F)
- $(Q)$(gnumake:yes=#) $(NULLCMD) > $@ || $(NULLCMD) > $(@F)
+$(srcdir)/revision.h$(gnumake:yes=-nongnumake):
+ $(Q)$(RM) $(@F)
+ $(Q)$(NULLCMD) > $@ || $(NULLCMD) > $(@F)
revision.tmp::
$(Q) $(NULLCMD) > $@
@@ -1674,7 +1677,6 @@ addr2line.$(OBJEXT): {$(VPATH)}internal/has/feature.h
addr2line.$(OBJEXT): {$(VPATH)}internal/has/warning.h
addr2line.$(OBJEXT): {$(VPATH)}internal/stdalign.h
addr2line.$(OBJEXT): {$(VPATH)}internal/stdbool.h
-addr2line.$(OBJEXT): {$(VPATH)}internal/token_paste.h
addr2line.$(OBJEXT): {$(VPATH)}internal/warning_push.h
addr2line.$(OBJEXT): {$(VPATH)}internal/xmalloc.h
addr2line.$(OBJEXT): {$(VPATH)}missing.h
@@ -1853,7 +1855,6 @@ array.$(OBJEXT): {$(VPATH)}internal/static_assert.h
array.$(OBJEXT): {$(VPATH)}internal/stdalign.h
array.$(OBJEXT): {$(VPATH)}internal/stdbool.h
array.$(OBJEXT): {$(VPATH)}internal/symbol.h
-array.$(OBJEXT): {$(VPATH)}internal/token_paste.h
array.$(OBJEXT): {$(VPATH)}internal/value.h
array.$(OBJEXT): {$(VPATH)}internal/value_type.h
array.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -2039,7 +2040,6 @@ ast.$(OBJEXT): {$(VPATH)}internal/static_assert.h
ast.$(OBJEXT): {$(VPATH)}internal/stdalign.h
ast.$(OBJEXT): {$(VPATH)}internal/stdbool.h
ast.$(OBJEXT): {$(VPATH)}internal/symbol.h
-ast.$(OBJEXT): {$(VPATH)}internal/token_paste.h
ast.$(OBJEXT): {$(VPATH)}internal/value.h
ast.$(OBJEXT): {$(VPATH)}internal/value_type.h
ast.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -2230,7 +2230,6 @@ bignum.$(OBJEXT): {$(VPATH)}internal/static_assert.h
bignum.$(OBJEXT): {$(VPATH)}internal/stdalign.h
bignum.$(OBJEXT): {$(VPATH)}internal/stdbool.h
bignum.$(OBJEXT): {$(VPATH)}internal/symbol.h
-bignum.$(OBJEXT): {$(VPATH)}internal/token_paste.h
bignum.$(OBJEXT): {$(VPATH)}internal/value.h
bignum.$(OBJEXT): {$(VPATH)}internal/value_type.h
bignum.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -2409,7 +2408,6 @@ builtin.$(OBJEXT): {$(VPATH)}internal/static_assert.h
builtin.$(OBJEXT): {$(VPATH)}internal/stdalign.h
builtin.$(OBJEXT): {$(VPATH)}internal/stdbool.h
builtin.$(OBJEXT): {$(VPATH)}internal/symbol.h
-builtin.$(OBJEXT): {$(VPATH)}internal/token_paste.h
builtin.$(OBJEXT): {$(VPATH)}internal/value.h
builtin.$(OBJEXT): {$(VPATH)}internal/value_type.h
builtin.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -2602,7 +2600,6 @@ class.$(OBJEXT): {$(VPATH)}internal/static_assert.h
class.$(OBJEXT): {$(VPATH)}internal/stdalign.h
class.$(OBJEXT): {$(VPATH)}internal/stdbool.h
class.$(OBJEXT): {$(VPATH)}internal/symbol.h
-class.$(OBJEXT): {$(VPATH)}internal/token_paste.h
class.$(OBJEXT): {$(VPATH)}internal/value.h
class.$(OBJEXT): {$(VPATH)}internal/value_type.h
class.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -2781,7 +2778,6 @@ compar.$(OBJEXT): {$(VPATH)}internal/static_assert.h
compar.$(OBJEXT): {$(VPATH)}internal/stdalign.h
compar.$(OBJEXT): {$(VPATH)}internal/stdbool.h
compar.$(OBJEXT): {$(VPATH)}internal/symbol.h
-compar.$(OBJEXT): {$(VPATH)}internal/token_paste.h
compar.$(OBJEXT): {$(VPATH)}internal/value.h
compar.$(OBJEXT): {$(VPATH)}internal/value_type.h
compar.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -2813,6 +2809,7 @@ compile.$(OBJEXT): $(top_srcdir)/internal/hash.h
compile.$(OBJEXT): $(top_srcdir)/internal/imemo.h
compile.$(OBJEXT): $(top_srcdir)/internal/numeric.h
compile.$(OBJEXT): $(top_srcdir)/internal/object.h
+compile.$(OBJEXT): $(top_srcdir)/internal/rational.h
compile.$(OBJEXT): $(top_srcdir)/internal/re.h
compile.$(OBJEXT): $(top_srcdir)/internal/serial.h
compile.$(OBJEXT): $(top_srcdir)/internal/static_assert.h
@@ -2984,7 +2981,6 @@ compile.$(OBJEXT): {$(VPATH)}internal/static_assert.h
compile.$(OBJEXT): {$(VPATH)}internal/stdalign.h
compile.$(OBJEXT): {$(VPATH)}internal/stdbool.h
compile.$(OBJEXT): {$(VPATH)}internal/symbol.h
-compile.$(OBJEXT): {$(VPATH)}internal/token_paste.h
compile.$(OBJEXT): {$(VPATH)}internal/value.h
compile.$(OBJEXT): {$(VPATH)}internal/value_type.h
compile.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -3184,7 +3180,6 @@ complex.$(OBJEXT): {$(VPATH)}internal/static_assert.h
complex.$(OBJEXT): {$(VPATH)}internal/stdalign.h
complex.$(OBJEXT): {$(VPATH)}internal/stdbool.h
complex.$(OBJEXT): {$(VPATH)}internal/symbol.h
-complex.$(OBJEXT): {$(VPATH)}internal/token_paste.h
complex.$(OBJEXT): {$(VPATH)}internal/value.h
complex.$(OBJEXT): {$(VPATH)}internal/value_type.h
complex.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -3370,7 +3365,6 @@ cont.$(OBJEXT): {$(VPATH)}internal/static_assert.h
cont.$(OBJEXT): {$(VPATH)}internal/stdalign.h
cont.$(OBJEXT): {$(VPATH)}internal/stdbool.h
cont.$(OBJEXT): {$(VPATH)}internal/symbol.h
-cont.$(OBJEXT): {$(VPATH)}internal/token_paste.h
cont.$(OBJEXT): {$(VPATH)}internal/value.h
cont.$(OBJEXT): {$(VPATH)}internal/value_type.h
cont.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -3563,7 +3557,6 @@ debug.$(OBJEXT): {$(VPATH)}internal/static_assert.h
debug.$(OBJEXT): {$(VPATH)}internal/stdalign.h
debug.$(OBJEXT): {$(VPATH)}internal/stdbool.h
debug.$(OBJEXT): {$(VPATH)}internal/symbol.h
-debug.$(OBJEXT): {$(VPATH)}internal/token_paste.h
debug.$(OBJEXT): {$(VPATH)}internal/value.h
debug.$(OBJEXT): {$(VPATH)}internal/value_type.h
debug.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -3741,7 +3734,6 @@ debug_counter.$(OBJEXT): {$(VPATH)}internal/static_assert.h
debug_counter.$(OBJEXT): {$(VPATH)}internal/stdalign.h
debug_counter.$(OBJEXT): {$(VPATH)}internal/stdbool.h
debug_counter.$(OBJEXT): {$(VPATH)}internal/symbol.h
-debug_counter.$(OBJEXT): {$(VPATH)}internal/token_paste.h
debug_counter.$(OBJEXT): {$(VPATH)}internal/value.h
debug_counter.$(OBJEXT): {$(VPATH)}internal/value_type.h
debug_counter.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -3920,7 +3912,6 @@ dir.$(OBJEXT): {$(VPATH)}internal/static_assert.h
dir.$(OBJEXT): {$(VPATH)}internal/stdalign.h
dir.$(OBJEXT): {$(VPATH)}internal/stdbool.h
dir.$(OBJEXT): {$(VPATH)}internal/symbol.h
-dir.$(OBJEXT): {$(VPATH)}internal/token_paste.h
dir.$(OBJEXT): {$(VPATH)}internal/value.h
dir.$(OBJEXT): {$(VPATH)}internal/value_type.h
dir.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -4088,7 +4079,6 @@ dln.$(OBJEXT): {$(VPATH)}internal/static_assert.h
dln.$(OBJEXT): {$(VPATH)}internal/stdalign.h
dln.$(OBJEXT): {$(VPATH)}internal/stdbool.h
dln.$(OBJEXT): {$(VPATH)}internal/symbol.h
-dln.$(OBJEXT): {$(VPATH)}internal/token_paste.h
dln.$(OBJEXT): {$(VPATH)}internal/value.h
dln.$(OBJEXT): {$(VPATH)}internal/value_type.h
dln.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -4247,7 +4237,6 @@ dln_find.$(OBJEXT): {$(VPATH)}internal/static_assert.h
dln_find.$(OBJEXT): {$(VPATH)}internal/stdalign.h
dln_find.$(OBJEXT): {$(VPATH)}internal/stdbool.h
dln_find.$(OBJEXT): {$(VPATH)}internal/symbol.h
-dln_find.$(OBJEXT): {$(VPATH)}internal/token_paste.h
dln_find.$(OBJEXT): {$(VPATH)}internal/value.h
dln_find.$(OBJEXT): {$(VPATH)}internal/value_type.h
dln_find.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -4405,7 +4394,6 @@ dmydln.$(OBJEXT): {$(VPATH)}internal/static_assert.h
dmydln.$(OBJEXT): {$(VPATH)}internal/stdalign.h
dmydln.$(OBJEXT): {$(VPATH)}internal/stdbool.h
dmydln.$(OBJEXT): {$(VPATH)}internal/symbol.h
-dmydln.$(OBJEXT): {$(VPATH)}internal/token_paste.h
dmydln.$(OBJEXT): {$(VPATH)}internal/value.h
dmydln.$(OBJEXT): {$(VPATH)}internal/value_type.h
dmydln.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -4624,7 +4612,6 @@ encoding.$(OBJEXT): {$(VPATH)}internal/static_assert.h
encoding.$(OBJEXT): {$(VPATH)}internal/stdalign.h
encoding.$(OBJEXT): {$(VPATH)}internal/stdbool.h
encoding.$(OBJEXT): {$(VPATH)}internal/symbol.h
-encoding.$(OBJEXT): {$(VPATH)}internal/token_paste.h
encoding.$(OBJEXT): {$(VPATH)}internal/value.h
encoding.$(OBJEXT): {$(VPATH)}internal/value_type.h
encoding.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -4815,7 +4802,6 @@ enum.$(OBJEXT): {$(VPATH)}internal/static_assert.h
enum.$(OBJEXT): {$(VPATH)}internal/stdalign.h
enum.$(OBJEXT): {$(VPATH)}internal/stdbool.h
enum.$(OBJEXT): {$(VPATH)}internal/symbol.h
-enum.$(OBJEXT): {$(VPATH)}internal/token_paste.h
enum.$(OBJEXT): {$(VPATH)}internal/value.h
enum.$(OBJEXT): {$(VPATH)}internal/value_type.h
enum.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -5001,7 +4987,6 @@ enumerator.$(OBJEXT): {$(VPATH)}internal/static_assert.h
enumerator.$(OBJEXT): {$(VPATH)}internal/stdalign.h
enumerator.$(OBJEXT): {$(VPATH)}internal/stdbool.h
enumerator.$(OBJEXT): {$(VPATH)}internal/symbol.h
-enumerator.$(OBJEXT): {$(VPATH)}internal/token_paste.h
enumerator.$(OBJEXT): {$(VPATH)}internal/value.h
enumerator.$(OBJEXT): {$(VPATH)}internal/value_type.h
enumerator.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -5194,7 +5179,6 @@ error.$(OBJEXT): {$(VPATH)}internal/static_assert.h
error.$(OBJEXT): {$(VPATH)}internal/stdalign.h
error.$(OBJEXT): {$(VPATH)}internal/stdbool.h
error.$(OBJEXT): {$(VPATH)}internal/symbol.h
-error.$(OBJEXT): {$(VPATH)}internal/token_paste.h
error.$(OBJEXT): {$(VPATH)}internal/value.h
error.$(OBJEXT): {$(VPATH)}internal/value_type.h
error.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -5401,7 +5385,6 @@ eval.$(OBJEXT): {$(VPATH)}internal/static_assert.h
eval.$(OBJEXT): {$(VPATH)}internal/stdalign.h
eval.$(OBJEXT): {$(VPATH)}internal/stdbool.h
eval.$(OBJEXT): {$(VPATH)}internal/symbol.h
-eval.$(OBJEXT): {$(VPATH)}internal/token_paste.h
eval.$(OBJEXT): {$(VPATH)}internal/value.h
eval.$(OBJEXT): {$(VPATH)}internal/value_type.h
eval.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -5617,7 +5600,6 @@ file.$(OBJEXT): {$(VPATH)}internal/static_assert.h
file.$(OBJEXT): {$(VPATH)}internal/stdalign.h
file.$(OBJEXT): {$(VPATH)}internal/stdbool.h
file.$(OBJEXT): {$(VPATH)}internal/symbol.h
-file.$(OBJEXT): {$(VPATH)}internal/token_paste.h
file.$(OBJEXT): {$(VPATH)}internal/value.h
file.$(OBJEXT): {$(VPATH)}internal/value_type.h
file.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -5826,7 +5808,6 @@ gc.$(OBJEXT): {$(VPATH)}internal/static_assert.h
gc.$(OBJEXT): {$(VPATH)}internal/stdalign.h
gc.$(OBJEXT): {$(VPATH)}internal/stdbool.h
gc.$(OBJEXT): {$(VPATH)}internal/symbol.h
-gc.$(OBJEXT): {$(VPATH)}internal/token_paste.h
gc.$(OBJEXT): {$(VPATH)}internal/value.h
gc.$(OBJEXT): {$(VPATH)}internal/value_type.h
gc.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -6028,7 +6009,6 @@ golf_prelude.$(OBJEXT): {$(VPATH)}internal/static_assert.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/stdalign.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/stdbool.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/symbol.h
-golf_prelude.$(OBJEXT): {$(VPATH)}internal/token_paste.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/value.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/value_type.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -6197,7 +6177,6 @@ goruby.$(OBJEXT): {$(VPATH)}internal/static_assert.h
goruby.$(OBJEXT): {$(VPATH)}internal/stdalign.h
goruby.$(OBJEXT): {$(VPATH)}internal/stdbool.h
goruby.$(OBJEXT): {$(VPATH)}internal/symbol.h
-goruby.$(OBJEXT): {$(VPATH)}internal/token_paste.h
goruby.$(OBJEXT): {$(VPATH)}internal/value.h
goruby.$(OBJEXT): {$(VPATH)}internal/value_type.h
goruby.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -6382,7 +6361,6 @@ hash.$(OBJEXT): {$(VPATH)}internal/static_assert.h
hash.$(OBJEXT): {$(VPATH)}internal/stdalign.h
hash.$(OBJEXT): {$(VPATH)}internal/stdbool.h
hash.$(OBJEXT): {$(VPATH)}internal/symbol.h
-hash.$(OBJEXT): {$(VPATH)}internal/token_paste.h
hash.$(OBJEXT): {$(VPATH)}internal/value.h
hash.$(OBJEXT): {$(VPATH)}internal/value_type.h
hash.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -6554,7 +6532,6 @@ inits.$(OBJEXT): {$(VPATH)}internal/static_assert.h
inits.$(OBJEXT): {$(VPATH)}internal/stdalign.h
inits.$(OBJEXT): {$(VPATH)}internal/stdbool.h
inits.$(OBJEXT): {$(VPATH)}internal/symbol.h
-inits.$(OBJEXT): {$(VPATH)}internal/token_paste.h
inits.$(OBJEXT): {$(VPATH)}internal/value.h
inits.$(OBJEXT): {$(VPATH)}internal/value_type.h
inits.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -6751,7 +6728,6 @@ io.$(OBJEXT): {$(VPATH)}internal/static_assert.h
io.$(OBJEXT): {$(VPATH)}internal/stdalign.h
io.$(OBJEXT): {$(VPATH)}internal/stdbool.h
io.$(OBJEXT): {$(VPATH)}internal/symbol.h
-io.$(OBJEXT): {$(VPATH)}internal/token_paste.h
io.$(OBJEXT): {$(VPATH)}internal/value.h
io.$(OBJEXT): {$(VPATH)}internal/value_type.h
io.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -6962,7 +6938,6 @@ iseq.$(OBJEXT): {$(VPATH)}internal/static_assert.h
iseq.$(OBJEXT): {$(VPATH)}internal/stdalign.h
iseq.$(OBJEXT): {$(VPATH)}internal/stdbool.h
iseq.$(OBJEXT): {$(VPATH)}internal/symbol.h
-iseq.$(OBJEXT): {$(VPATH)}internal/token_paste.h
iseq.$(OBJEXT): {$(VPATH)}internal/value.h
iseq.$(OBJEXT): {$(VPATH)}internal/value_type.h
iseq.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -7164,7 +7139,6 @@ load.$(OBJEXT): {$(VPATH)}internal/static_assert.h
load.$(OBJEXT): {$(VPATH)}internal/stdalign.h
load.$(OBJEXT): {$(VPATH)}internal/stdbool.h
load.$(OBJEXT): {$(VPATH)}internal/symbol.h
-load.$(OBJEXT): {$(VPATH)}internal/token_paste.h
load.$(OBJEXT): {$(VPATH)}internal/value.h
load.$(OBJEXT): {$(VPATH)}internal/value_type.h
load.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -7338,7 +7312,6 @@ loadpath.$(OBJEXT): {$(VPATH)}internal/static_assert.h
loadpath.$(OBJEXT): {$(VPATH)}internal/stdalign.h
loadpath.$(OBJEXT): {$(VPATH)}internal/stdbool.h
loadpath.$(OBJEXT): {$(VPATH)}internal/symbol.h
-loadpath.$(OBJEXT): {$(VPATH)}internal/token_paste.h
loadpath.$(OBJEXT): {$(VPATH)}internal/value.h
loadpath.$(OBJEXT): {$(VPATH)}internal/value_type.h
loadpath.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -7501,7 +7474,6 @@ localeinit.$(OBJEXT): {$(VPATH)}internal/static_assert.h
localeinit.$(OBJEXT): {$(VPATH)}internal/stdalign.h
localeinit.$(OBJEXT): {$(VPATH)}internal/stdbool.h
localeinit.$(OBJEXT): {$(VPATH)}internal/symbol.h
-localeinit.$(OBJEXT): {$(VPATH)}internal/token_paste.h
localeinit.$(OBJEXT): {$(VPATH)}internal/value.h
localeinit.$(OBJEXT): {$(VPATH)}internal/value_type.h
localeinit.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -7663,7 +7635,6 @@ main.$(OBJEXT): {$(VPATH)}internal/static_assert.h
main.$(OBJEXT): {$(VPATH)}internal/stdalign.h
main.$(OBJEXT): {$(VPATH)}internal/stdbool.h
main.$(OBJEXT): {$(VPATH)}internal/symbol.h
-main.$(OBJEXT): {$(VPATH)}internal/token_paste.h
main.$(OBJEXT): {$(VPATH)}internal/value.h
main.$(OBJEXT): {$(VPATH)}internal/value_type.h
main.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -7844,7 +7815,6 @@ marshal.$(OBJEXT): {$(VPATH)}internal/static_assert.h
marshal.$(OBJEXT): {$(VPATH)}internal/stdalign.h
marshal.$(OBJEXT): {$(VPATH)}internal/stdbool.h
marshal.$(OBJEXT): {$(VPATH)}internal/symbol.h
-marshal.$(OBJEXT): {$(VPATH)}internal/token_paste.h
marshal.$(OBJEXT): {$(VPATH)}internal/value.h
marshal.$(OBJEXT): {$(VPATH)}internal/value_type.h
marshal.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -8020,7 +7990,6 @@ math.$(OBJEXT): {$(VPATH)}internal/static_assert.h
math.$(OBJEXT): {$(VPATH)}internal/stdalign.h
math.$(OBJEXT): {$(VPATH)}internal/stdbool.h
math.$(OBJEXT): {$(VPATH)}internal/symbol.h
-math.$(OBJEXT): {$(VPATH)}internal/token_paste.h
math.$(OBJEXT): {$(VPATH)}internal/value.h
math.$(OBJEXT): {$(VPATH)}internal/value_type.h
math.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -8185,7 +8154,6 @@ memory_view.$(OBJEXT): {$(VPATH)}internal/static_assert.h
memory_view.$(OBJEXT): {$(VPATH)}internal/stdalign.h
memory_view.$(OBJEXT): {$(VPATH)}internal/stdbool.h
memory_view.$(OBJEXT): {$(VPATH)}internal/symbol.h
-memory_view.$(OBJEXT): {$(VPATH)}internal/token_paste.h
memory_view.$(OBJEXT): {$(VPATH)}internal/value.h
memory_view.$(OBJEXT): {$(VPATH)}internal/value_type.h
memory_view.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -8370,7 +8338,6 @@ miniinit.$(OBJEXT): {$(VPATH)}internal/static_assert.h
miniinit.$(OBJEXT): {$(VPATH)}internal/stdalign.h
miniinit.$(OBJEXT): {$(VPATH)}internal/stdbool.h
miniinit.$(OBJEXT): {$(VPATH)}internal/symbol.h
-miniinit.$(OBJEXT): {$(VPATH)}internal/token_paste.h
miniinit.$(OBJEXT): {$(VPATH)}internal/value.h
miniinit.$(OBJEXT): {$(VPATH)}internal/value_type.h
miniinit.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -8384,6 +8351,7 @@ miniinit.$(OBJEXT): {$(VPATH)}mini_builtin.c
miniinit.$(OBJEXT): {$(VPATH)}miniinit.c
miniinit.$(OBJEXT): {$(VPATH)}miniprelude.c
miniinit.$(OBJEXT): {$(VPATH)}missing.h
+miniinit.$(OBJEXT): {$(VPATH)}nilclass.rb
miniinit.$(OBJEXT): {$(VPATH)}node.h
miniinit.$(OBJEXT): {$(VPATH)}numeric.rb
miniinit.$(OBJEXT): {$(VPATH)}onigmo.h
@@ -8443,6 +8411,7 @@ mjit.$(OBJEXT): $(hdrdir)/ruby/ruby.h
mjit.$(OBJEXT): $(hdrdir)/ruby/version.h
mjit.$(OBJEXT): $(top_srcdir)/internal/array.h
mjit.$(OBJEXT): $(top_srcdir)/internal/class.h
+mjit.$(OBJEXT): $(top_srcdir)/internal/compile.h
mjit.$(OBJEXT): $(top_srcdir)/internal/compilers.h
mjit.$(OBJEXT): $(top_srcdir)/internal/cont.h
mjit.$(OBJEXT): $(top_srcdir)/internal/file.h
@@ -8464,6 +8433,7 @@ mjit.$(OBJEXT): {$(VPATH)}backward/2/limits.h
mjit.$(OBJEXT): {$(VPATH)}backward/2/long_long.h
mjit.$(OBJEXT): {$(VPATH)}backward/2/stdalign.h
mjit.$(OBJEXT): {$(VPATH)}backward/2/stdarg.h
+mjit.$(OBJEXT): {$(VPATH)}builtin.h
mjit.$(OBJEXT): {$(VPATH)}config.h
mjit.$(OBJEXT): {$(VPATH)}constant.h
mjit.$(OBJEXT): {$(VPATH)}debug.h
@@ -8474,6 +8444,9 @@ mjit.$(OBJEXT): {$(VPATH)}encoding.h
mjit.$(OBJEXT): {$(VPATH)}gc.h
mjit.$(OBJEXT): {$(VPATH)}id.h
mjit.$(OBJEXT): {$(VPATH)}id_table.h
+mjit.$(OBJEXT): {$(VPATH)}insns.def
+mjit.$(OBJEXT): {$(VPATH)}insns.inc
+mjit.$(OBJEXT): {$(VPATH)}insns_info.inc
mjit.$(OBJEXT): {$(VPATH)}intern.h
mjit.$(OBJEXT): {$(VPATH)}internal.h
mjit.$(OBJEXT): {$(VPATH)}internal/anyargs.h
@@ -8610,12 +8583,12 @@ mjit.$(OBJEXT): {$(VPATH)}internal/static_assert.h
mjit.$(OBJEXT): {$(VPATH)}internal/stdalign.h
mjit.$(OBJEXT): {$(VPATH)}internal/stdbool.h
mjit.$(OBJEXT): {$(VPATH)}internal/symbol.h
-mjit.$(OBJEXT): {$(VPATH)}internal/token_paste.h
mjit.$(OBJEXT): {$(VPATH)}internal/value.h
mjit.$(OBJEXT): {$(VPATH)}internal/value_type.h
mjit.$(OBJEXT): {$(VPATH)}internal/variable.h
mjit.$(OBJEXT): {$(VPATH)}internal/warning_push.h
mjit.$(OBJEXT): {$(VPATH)}internal/xmalloc.h
+mjit.$(OBJEXT): {$(VPATH)}iseq.h
mjit.$(OBJEXT): {$(VPATH)}method.h
mjit.$(OBJEXT): {$(VPATH)}missing.h
mjit.$(OBJEXT): {$(VPATH)}mjit.c
@@ -8635,7 +8608,9 @@ mjit.$(OBJEXT): {$(VPATH)}thread_native.h
mjit.$(OBJEXT): {$(VPATH)}util.h
mjit.$(OBJEXT): {$(VPATH)}vm_callinfo.h
mjit.$(OBJEXT): {$(VPATH)}vm_core.h
+mjit.$(OBJEXT): {$(VPATH)}vm_debug.h
mjit.$(OBJEXT): {$(VPATH)}vm_opts.h
+mjit.$(OBJEXT): {$(VPATH)}vm_sync.h
mjit_build_dir.$(OBJEXT): {$(VPATH)}config.h
mjit_build_dir.$(OBJEXT): {$(VPATH)}internal/compiler_is.h
mjit_build_dir.$(OBJEXT): {$(VPATH)}internal/compiler_is/apple.h
@@ -8824,7 +8799,6 @@ mjit_compile.$(OBJEXT): {$(VPATH)}internal/static_assert.h
mjit_compile.$(OBJEXT): {$(VPATH)}internal/stdalign.h
mjit_compile.$(OBJEXT): {$(VPATH)}internal/stdbool.h
mjit_compile.$(OBJEXT): {$(VPATH)}internal/symbol.h
-mjit_compile.$(OBJEXT): {$(VPATH)}internal/token_paste.h
mjit_compile.$(OBJEXT): {$(VPATH)}internal/value.h
mjit_compile.$(OBJEXT): {$(VPATH)}internal/value_type.h
mjit_compile.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -9016,7 +8990,6 @@ node.$(OBJEXT): {$(VPATH)}internal/static_assert.h
node.$(OBJEXT): {$(VPATH)}internal/stdalign.h
node.$(OBJEXT): {$(VPATH)}internal/stdbool.h
node.$(OBJEXT): {$(VPATH)}internal/symbol.h
-node.$(OBJEXT): {$(VPATH)}internal/token_paste.h
node.$(OBJEXT): {$(VPATH)}internal/value.h
node.$(OBJEXT): {$(VPATH)}internal/value_type.h
node.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -9208,7 +9181,6 @@ numeric.$(OBJEXT): {$(VPATH)}internal/static_assert.h
numeric.$(OBJEXT): {$(VPATH)}internal/stdalign.h
numeric.$(OBJEXT): {$(VPATH)}internal/stdbool.h
numeric.$(OBJEXT): {$(VPATH)}internal/symbol.h
-numeric.$(OBJEXT): {$(VPATH)}internal/token_paste.h
numeric.$(OBJEXT): {$(VPATH)}internal/value.h
numeric.$(OBJEXT): {$(VPATH)}internal/value_type.h
numeric.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -9399,7 +9371,6 @@ object.$(OBJEXT): {$(VPATH)}internal/static_assert.h
object.$(OBJEXT): {$(VPATH)}internal/stdalign.h
object.$(OBJEXT): {$(VPATH)}internal/stdbool.h
object.$(OBJEXT): {$(VPATH)}internal/symbol.h
-object.$(OBJEXT): {$(VPATH)}internal/token_paste.h
object.$(OBJEXT): {$(VPATH)}internal/value.h
object.$(OBJEXT): {$(VPATH)}internal/value_type.h
object.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -9408,6 +9379,8 @@ object.$(OBJEXT): {$(VPATH)}internal/xmalloc.h
object.$(OBJEXT): {$(VPATH)}kernel.rb
object.$(OBJEXT): {$(VPATH)}kernel.rbinc
object.$(OBJEXT): {$(VPATH)}missing.h
+object.$(OBJEXT): {$(VPATH)}nilclass.rb
+object.$(OBJEXT): {$(VPATH)}nilclass.rbinc
object.$(OBJEXT): {$(VPATH)}object.c
object.$(OBJEXT): {$(VPATH)}onigmo.h
object.$(OBJEXT): {$(VPATH)}oniguruma.h
@@ -9579,7 +9552,6 @@ pack.$(OBJEXT): {$(VPATH)}internal/static_assert.h
pack.$(OBJEXT): {$(VPATH)}internal/stdalign.h
pack.$(OBJEXT): {$(VPATH)}internal/stdbool.h
pack.$(OBJEXT): {$(VPATH)}internal/symbol.h
-pack.$(OBJEXT): {$(VPATH)}internal/token_paste.h
pack.$(OBJEXT): {$(VPATH)}internal/value.h
pack.$(OBJEXT): {$(VPATH)}internal/value_type.h
pack.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -9772,7 +9744,6 @@ parse.$(OBJEXT): {$(VPATH)}internal/static_assert.h
parse.$(OBJEXT): {$(VPATH)}internal/stdalign.h
parse.$(OBJEXT): {$(VPATH)}internal/stdbool.h
parse.$(OBJEXT): {$(VPATH)}internal/symbol.h
-parse.$(OBJEXT): {$(VPATH)}internal/token_paste.h
parse.$(OBJEXT): {$(VPATH)}internal/value.h
parse.$(OBJEXT): {$(VPATH)}internal/value_type.h
parse.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -9999,7 +9970,6 @@ proc.$(OBJEXT): {$(VPATH)}internal/static_assert.h
proc.$(OBJEXT): {$(VPATH)}internal/stdalign.h
proc.$(OBJEXT): {$(VPATH)}internal/stdbool.h
proc.$(OBJEXT): {$(VPATH)}internal/symbol.h
-proc.$(OBJEXT): {$(VPATH)}internal/token_paste.h
proc.$(OBJEXT): {$(VPATH)}internal/value.h
proc.$(OBJEXT): {$(VPATH)}internal/value_type.h
proc.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -10204,7 +10174,6 @@ process.$(OBJEXT): {$(VPATH)}internal/static_assert.h
process.$(OBJEXT): {$(VPATH)}internal/stdalign.h
process.$(OBJEXT): {$(VPATH)}internal/stdbool.h
process.$(OBJEXT): {$(VPATH)}internal/symbol.h
-process.$(OBJEXT): {$(VPATH)}internal/token_paste.h
process.$(OBJEXT): {$(VPATH)}internal/value.h
process.$(OBJEXT): {$(VPATH)}internal/value_type.h
process.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -10410,7 +10379,6 @@ ractor.$(OBJEXT): {$(VPATH)}internal/static_assert.h
ractor.$(OBJEXT): {$(VPATH)}internal/stdalign.h
ractor.$(OBJEXT): {$(VPATH)}internal/stdbool.h
ractor.$(OBJEXT): {$(VPATH)}internal/symbol.h
-ractor.$(OBJEXT): {$(VPATH)}internal/token_paste.h
ractor.$(OBJEXT): {$(VPATH)}internal/value.h
ractor.$(OBJEXT): {$(VPATH)}internal/value_type.h
ractor.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -10608,7 +10576,6 @@ random.$(OBJEXT): {$(VPATH)}internal/static_assert.h
random.$(OBJEXT): {$(VPATH)}internal/stdalign.h
random.$(OBJEXT): {$(VPATH)}internal/stdbool.h
random.$(OBJEXT): {$(VPATH)}internal/symbol.h
-random.$(OBJEXT): {$(VPATH)}internal/token_paste.h
random.$(OBJEXT): {$(VPATH)}internal/value.h
random.$(OBJEXT): {$(VPATH)}internal/value_type.h
random.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -10796,7 +10763,6 @@ range.$(OBJEXT): {$(VPATH)}internal/static_assert.h
range.$(OBJEXT): {$(VPATH)}internal/stdalign.h
range.$(OBJEXT): {$(VPATH)}internal/stdbool.h
range.$(OBJEXT): {$(VPATH)}internal/symbol.h
-range.$(OBJEXT): {$(VPATH)}internal/token_paste.h
range.$(OBJEXT): {$(VPATH)}internal/value.h
range.$(OBJEXT): {$(VPATH)}internal/value_type.h
range.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -10978,7 +10944,6 @@ rational.$(OBJEXT): {$(VPATH)}internal/static_assert.h
rational.$(OBJEXT): {$(VPATH)}internal/stdalign.h
rational.$(OBJEXT): {$(VPATH)}internal/stdbool.h
rational.$(OBJEXT): {$(VPATH)}internal/symbol.h
-rational.$(OBJEXT): {$(VPATH)}internal/token_paste.h
rational.$(OBJEXT): {$(VPATH)}internal/value.h
rational.$(OBJEXT): {$(VPATH)}internal/value_type.h
rational.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -11157,7 +11122,6 @@ re.$(OBJEXT): {$(VPATH)}internal/static_assert.h
re.$(OBJEXT): {$(VPATH)}internal/stdalign.h
re.$(OBJEXT): {$(VPATH)}internal/stdbool.h
re.$(OBJEXT): {$(VPATH)}internal/symbol.h
-re.$(OBJEXT): {$(VPATH)}internal/token_paste.h
re.$(OBJEXT): {$(VPATH)}internal/value.h
re.$(OBJEXT): {$(VPATH)}internal/value_type.h
re.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -11322,7 +11286,6 @@ regcomp.$(OBJEXT): {$(VPATH)}internal/static_assert.h
regcomp.$(OBJEXT): {$(VPATH)}internal/stdalign.h
regcomp.$(OBJEXT): {$(VPATH)}internal/stdbool.h
regcomp.$(OBJEXT): {$(VPATH)}internal/symbol.h
-regcomp.$(OBJEXT): {$(VPATH)}internal/token_paste.h
regcomp.$(OBJEXT): {$(VPATH)}internal/value.h
regcomp.$(OBJEXT): {$(VPATH)}internal/value_type.h
regcomp.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -11484,7 +11447,6 @@ regenc.$(OBJEXT): {$(VPATH)}internal/static_assert.h
regenc.$(OBJEXT): {$(VPATH)}internal/stdalign.h
regenc.$(OBJEXT): {$(VPATH)}internal/stdbool.h
regenc.$(OBJEXT): {$(VPATH)}internal/symbol.h
-regenc.$(OBJEXT): {$(VPATH)}internal/token_paste.h
regenc.$(OBJEXT): {$(VPATH)}internal/value.h
regenc.$(OBJEXT): {$(VPATH)}internal/value_type.h
regenc.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -11645,7 +11607,6 @@ regerror.$(OBJEXT): {$(VPATH)}internal/static_assert.h
regerror.$(OBJEXT): {$(VPATH)}internal/stdalign.h
regerror.$(OBJEXT): {$(VPATH)}internal/stdbool.h
regerror.$(OBJEXT): {$(VPATH)}internal/symbol.h
-regerror.$(OBJEXT): {$(VPATH)}internal/token_paste.h
regerror.$(OBJEXT): {$(VPATH)}internal/value.h
regerror.$(OBJEXT): {$(VPATH)}internal/value_type.h
regerror.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -11806,7 +11767,6 @@ regexec.$(OBJEXT): {$(VPATH)}internal/static_assert.h
regexec.$(OBJEXT): {$(VPATH)}internal/stdalign.h
regexec.$(OBJEXT): {$(VPATH)}internal/stdbool.h
regexec.$(OBJEXT): {$(VPATH)}internal/symbol.h
-regexec.$(OBJEXT): {$(VPATH)}internal/token_paste.h
regexec.$(OBJEXT): {$(VPATH)}internal/value.h
regexec.$(OBJEXT): {$(VPATH)}internal/value_type.h
regexec.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -11967,7 +11927,6 @@ regparse.$(OBJEXT): {$(VPATH)}internal/static_assert.h
regparse.$(OBJEXT): {$(VPATH)}internal/stdalign.h
regparse.$(OBJEXT): {$(VPATH)}internal/stdbool.h
regparse.$(OBJEXT): {$(VPATH)}internal/symbol.h
-regparse.$(OBJEXT): {$(VPATH)}internal/token_paste.h
regparse.$(OBJEXT): {$(VPATH)}internal/value.h
regparse.$(OBJEXT): {$(VPATH)}internal/value_type.h
regparse.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -12129,7 +12088,6 @@ regsyntax.$(OBJEXT): {$(VPATH)}internal/static_assert.h
regsyntax.$(OBJEXT): {$(VPATH)}internal/stdalign.h
regsyntax.$(OBJEXT): {$(VPATH)}internal/stdbool.h
regsyntax.$(OBJEXT): {$(VPATH)}internal/symbol.h
-regsyntax.$(OBJEXT): {$(VPATH)}internal/token_paste.h
regsyntax.$(OBJEXT): {$(VPATH)}internal/value.h
regsyntax.$(OBJEXT): {$(VPATH)}internal/value_type.h
regsyntax.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -12338,7 +12296,6 @@ ruby.$(OBJEXT): {$(VPATH)}internal/static_assert.h
ruby.$(OBJEXT): {$(VPATH)}internal/stdalign.h
ruby.$(OBJEXT): {$(VPATH)}internal/stdbool.h
ruby.$(OBJEXT): {$(VPATH)}internal/symbol.h
-ruby.$(OBJEXT): {$(VPATH)}internal/token_paste.h
ruby.$(OBJEXT): {$(VPATH)}internal/value.h
ruby.$(OBJEXT): {$(VPATH)}internal/value_type.h
ruby.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -12529,7 +12486,6 @@ scheduler.$(OBJEXT): {$(VPATH)}internal/static_assert.h
scheduler.$(OBJEXT): {$(VPATH)}internal/stdalign.h
scheduler.$(OBJEXT): {$(VPATH)}internal/stdbool.h
scheduler.$(OBJEXT): {$(VPATH)}internal/symbol.h
-scheduler.$(OBJEXT): {$(VPATH)}internal/token_paste.h
scheduler.$(OBJEXT): {$(VPATH)}internal/value.h
scheduler.$(OBJEXT): {$(VPATH)}internal/value_type.h
scheduler.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -12699,7 +12655,6 @@ setproctitle.$(OBJEXT): {$(VPATH)}internal/static_assert.h
setproctitle.$(OBJEXT): {$(VPATH)}internal/stdalign.h
setproctitle.$(OBJEXT): {$(VPATH)}internal/stdbool.h
setproctitle.$(OBJEXT): {$(VPATH)}internal/symbol.h
-setproctitle.$(OBJEXT): {$(VPATH)}internal/token_paste.h
setproctitle.$(OBJEXT): {$(VPATH)}internal/value.h
setproctitle.$(OBJEXT): {$(VPATH)}internal/value_type.h
setproctitle.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -12883,7 +12838,6 @@ signal.$(OBJEXT): {$(VPATH)}internal/static_assert.h
signal.$(OBJEXT): {$(VPATH)}internal/stdalign.h
signal.$(OBJEXT): {$(VPATH)}internal/stdbool.h
signal.$(OBJEXT): {$(VPATH)}internal/symbol.h
-signal.$(OBJEXT): {$(VPATH)}internal/token_paste.h
signal.$(OBJEXT): {$(VPATH)}internal/value.h
signal.$(OBJEXT): {$(VPATH)}internal/value_type.h
signal.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -13078,7 +13032,6 @@ sprintf.$(OBJEXT): {$(VPATH)}internal/static_assert.h
sprintf.$(OBJEXT): {$(VPATH)}internal/stdalign.h
sprintf.$(OBJEXT): {$(VPATH)}internal/stdbool.h
sprintf.$(OBJEXT): {$(VPATH)}internal/symbol.h
-sprintf.$(OBJEXT): {$(VPATH)}internal/token_paste.h
sprintf.$(OBJEXT): {$(VPATH)}internal/value.h
sprintf.$(OBJEXT): {$(VPATH)}internal/value_type.h
sprintf.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -13249,7 +13202,6 @@ st.$(OBJEXT): {$(VPATH)}internal/static_assert.h
st.$(OBJEXT): {$(VPATH)}internal/stdalign.h
st.$(OBJEXT): {$(VPATH)}internal/stdbool.h
st.$(OBJEXT): {$(VPATH)}internal/symbol.h
-st.$(OBJEXT): {$(VPATH)}internal/token_paste.h
st.$(OBJEXT): {$(VPATH)}internal/value.h
st.$(OBJEXT): {$(VPATH)}internal/value_type.h
st.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -13416,7 +13368,6 @@ strftime.$(OBJEXT): {$(VPATH)}internal/static_assert.h
strftime.$(OBJEXT): {$(VPATH)}internal/stdalign.h
strftime.$(OBJEXT): {$(VPATH)}internal/stdbool.h
strftime.$(OBJEXT): {$(VPATH)}internal/symbol.h
-strftime.$(OBJEXT): {$(VPATH)}internal/token_paste.h
strftime.$(OBJEXT): {$(VPATH)}internal/value.h
strftime.$(OBJEXT): {$(VPATH)}internal/value_type.h
strftime.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -13453,6 +13404,7 @@ string.$(OBJEXT): $(top_srcdir)/internal/transcode.h
string.$(OBJEXT): $(top_srcdir)/internal/vm.h
string.$(OBJEXT): $(top_srcdir)/internal/warnings.h
string.$(OBJEXT): {$(VPATH)}assert.h
+string.$(OBJEXT): {$(VPATH)}atomic.h
string.$(OBJEXT): {$(VPATH)}backward/2/assume.h
string.$(OBJEXT): {$(VPATH)}backward/2/attributes.h
string.$(OBJEXT): {$(VPATH)}backward/2/bool.h
@@ -13608,7 +13560,6 @@ string.$(OBJEXT): {$(VPATH)}internal/static_assert.h
string.$(OBJEXT): {$(VPATH)}internal/stdalign.h
string.$(OBJEXT): {$(VPATH)}internal/stdbool.h
string.$(OBJEXT): {$(VPATH)}internal/symbol.h
-string.$(OBJEXT): {$(VPATH)}internal/token_paste.h
string.$(OBJEXT): {$(VPATH)}internal/value.h
string.$(OBJEXT): {$(VPATH)}internal/value_type.h
string.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -13626,6 +13577,7 @@ string.$(OBJEXT): {$(VPATH)}ruby_assert.h
string.$(OBJEXT): {$(VPATH)}st.h
string.$(OBJEXT): {$(VPATH)}string.c
string.$(OBJEXT): {$(VPATH)}subst.h
+string.$(OBJEXT): {$(VPATH)}thread_native.h
string.$(OBJEXT): {$(VPATH)}util.h
string.$(OBJEXT): {$(VPATH)}vm_debug.h
string.$(OBJEXT): {$(VPATH)}vm_sync.h
@@ -13830,7 +13782,6 @@ struct.$(OBJEXT): {$(VPATH)}internal/static_assert.h
struct.$(OBJEXT): {$(VPATH)}internal/stdalign.h
struct.$(OBJEXT): {$(VPATH)}internal/stdbool.h
struct.$(OBJEXT): {$(VPATH)}internal/symbol.h
-struct.$(OBJEXT): {$(VPATH)}internal/token_paste.h
struct.$(OBJEXT): {$(VPATH)}internal/value.h
struct.$(OBJEXT): {$(VPATH)}internal/value_type.h
struct.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -14020,7 +13971,6 @@ symbol.$(OBJEXT): {$(VPATH)}internal/static_assert.h
symbol.$(OBJEXT): {$(VPATH)}internal/stdalign.h
symbol.$(OBJEXT): {$(VPATH)}internal/stdbool.h
symbol.$(OBJEXT): {$(VPATH)}internal/symbol.h
-symbol.$(OBJEXT): {$(VPATH)}internal/token_paste.h
symbol.$(OBJEXT): {$(VPATH)}internal/value.h
symbol.$(OBJEXT): {$(VPATH)}internal/value_type.h
symbol.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -14225,7 +14175,6 @@ thread.$(OBJEXT): {$(VPATH)}internal/static_assert.h
thread.$(OBJEXT): {$(VPATH)}internal/stdalign.h
thread.$(OBJEXT): {$(VPATH)}internal/stdbool.h
thread.$(OBJEXT): {$(VPATH)}internal/symbol.h
-thread.$(OBJEXT): {$(VPATH)}internal/token_paste.h
thread.$(OBJEXT): {$(VPATH)}internal/value.h
thread.$(OBJEXT): {$(VPATH)}internal/value_type.h
thread.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -14427,7 +14376,6 @@ time.$(OBJEXT): {$(VPATH)}internal/static_assert.h
time.$(OBJEXT): {$(VPATH)}internal/stdalign.h
time.$(OBJEXT): {$(VPATH)}internal/stdbool.h
time.$(OBJEXT): {$(VPATH)}internal/symbol.h
-time.$(OBJEXT): {$(VPATH)}internal/token_paste.h
time.$(OBJEXT): {$(VPATH)}internal/value.h
time.$(OBJEXT): {$(VPATH)}internal/value_type.h
time.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -14606,7 +14554,6 @@ transcode.$(OBJEXT): {$(VPATH)}internal/static_assert.h
transcode.$(OBJEXT): {$(VPATH)}internal/stdalign.h
transcode.$(OBJEXT): {$(VPATH)}internal/stdbool.h
transcode.$(OBJEXT): {$(VPATH)}internal/symbol.h
-transcode.$(OBJEXT): {$(VPATH)}internal/token_paste.h
transcode.$(OBJEXT): {$(VPATH)}internal/value.h
transcode.$(OBJEXT): {$(VPATH)}internal/value_type.h
transcode.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -14792,7 +14739,6 @@ transient_heap.$(OBJEXT): {$(VPATH)}internal/static_assert.h
transient_heap.$(OBJEXT): {$(VPATH)}internal/stdalign.h
transient_heap.$(OBJEXT): {$(VPATH)}internal/stdbool.h
transient_heap.$(OBJEXT): {$(VPATH)}internal/symbol.h
-transient_heap.$(OBJEXT): {$(VPATH)}internal/token_paste.h
transient_heap.$(OBJEXT): {$(VPATH)}internal/value.h
transient_heap.$(OBJEXT): {$(VPATH)}internal/value_type.h
transient_heap.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -14969,7 +14915,6 @@ util.$(OBJEXT): {$(VPATH)}internal/static_assert.h
util.$(OBJEXT): {$(VPATH)}internal/stdalign.h
util.$(OBJEXT): {$(VPATH)}internal/stdbool.h
util.$(OBJEXT): {$(VPATH)}internal/symbol.h
-util.$(OBJEXT): {$(VPATH)}internal/token_paste.h
util.$(OBJEXT): {$(VPATH)}internal/value.h
util.$(OBJEXT): {$(VPATH)}internal/value_type.h
util.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -15159,7 +15104,6 @@ variable.$(OBJEXT): {$(VPATH)}internal/static_assert.h
variable.$(OBJEXT): {$(VPATH)}internal/stdalign.h
variable.$(OBJEXT): {$(VPATH)}internal/stdbool.h
variable.$(OBJEXT): {$(VPATH)}internal/symbol.h
-variable.$(OBJEXT): {$(VPATH)}internal/token_paste.h
variable.$(OBJEXT): {$(VPATH)}internal/value.h
variable.$(OBJEXT): {$(VPATH)}internal/value_type.h
variable.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -15354,7 +15298,6 @@ version.$(OBJEXT): {$(VPATH)}internal/static_assert.h
version.$(OBJEXT): {$(VPATH)}internal/stdalign.h
version.$(OBJEXT): {$(VPATH)}internal/stdbool.h
version.$(OBJEXT): {$(VPATH)}internal/symbol.h
-version.$(OBJEXT): {$(VPATH)}internal/token_paste.h
version.$(OBJEXT): {$(VPATH)}internal/value.h
version.$(OBJEXT): {$(VPATH)}internal/value_type.h
version.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -15569,7 +15512,6 @@ vm.$(OBJEXT): {$(VPATH)}internal/static_assert.h
vm.$(OBJEXT): {$(VPATH)}internal/stdalign.h
vm.$(OBJEXT): {$(VPATH)}internal/stdbool.h
vm.$(OBJEXT): {$(VPATH)}internal/symbol.h
-vm.$(OBJEXT): {$(VPATH)}internal/token_paste.h
vm.$(OBJEXT): {$(VPATH)}internal/value.h
vm.$(OBJEXT): {$(VPATH)}internal/value_type.h
vm.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -15780,7 +15722,6 @@ vm_backtrace.$(OBJEXT): {$(VPATH)}internal/static_assert.h
vm_backtrace.$(OBJEXT): {$(VPATH)}internal/stdalign.h
vm_backtrace.$(OBJEXT): {$(VPATH)}internal/stdbool.h
vm_backtrace.$(OBJEXT): {$(VPATH)}internal/symbol.h
-vm_backtrace.$(OBJEXT): {$(VPATH)}internal/token_paste.h
vm_backtrace.$(OBJEXT): {$(VPATH)}internal/value.h
vm_backtrace.$(OBJEXT): {$(VPATH)}internal/value_type.h
vm_backtrace.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -15970,7 +15911,6 @@ vm_dump.$(OBJEXT): {$(VPATH)}internal/static_assert.h
vm_dump.$(OBJEXT): {$(VPATH)}internal/stdalign.h
vm_dump.$(OBJEXT): {$(VPATH)}internal/stdbool.h
vm_dump.$(OBJEXT): {$(VPATH)}internal/symbol.h
-vm_dump.$(OBJEXT): {$(VPATH)}internal/token_paste.h
vm_dump.$(OBJEXT): {$(VPATH)}internal/value.h
vm_dump.$(OBJEXT): {$(VPATH)}internal/value_type.h
vm_dump.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -16166,7 +16106,6 @@ vm_sync.$(OBJEXT): {$(VPATH)}internal/static_assert.h
vm_sync.$(OBJEXT): {$(VPATH)}internal/stdalign.h
vm_sync.$(OBJEXT): {$(VPATH)}internal/stdbool.h
vm_sync.$(OBJEXT): {$(VPATH)}internal/symbol.h
-vm_sync.$(OBJEXT): {$(VPATH)}internal/token_paste.h
vm_sync.$(OBJEXT): {$(VPATH)}internal/value.h
vm_sync.$(OBJEXT): {$(VPATH)}internal/value_type.h
vm_sync.$(OBJEXT): {$(VPATH)}internal/variable.h
@@ -16363,7 +16302,6 @@ vm_trace.$(OBJEXT): {$(VPATH)}internal/static_assert.h
vm_trace.$(OBJEXT): {$(VPATH)}internal/stdalign.h
vm_trace.$(OBJEXT): {$(VPATH)}internal/stdbool.h
vm_trace.$(OBJEXT): {$(VPATH)}internal/symbol.h
-vm_trace.$(OBJEXT): {$(VPATH)}internal/token_paste.h
vm_trace.$(OBJEXT): {$(VPATH)}internal/value.h
vm_trace.$(OBJEXT): {$(VPATH)}internal/value_type.h
vm_trace.$(OBJEXT): {$(VPATH)}internal/variable.h
diff --git a/compile.c b/compile.c
index 7e1724c..c3aa8f3 100644
--- a/compile.c
+++ b/compile.c
@@ -28,6 +28,7 @@
#include "internal/hash.h"
#include "internal/numeric.h"
#include "internal/object.h"
+#include "internal/rational.h"
#include "internal/re.h"
#include "internal/symbol.h"
#include "internal/thread.h"
@@ -93,6 +94,7 @@ typedef struct iseq_insn_data {
VALUE *operands;
struct {
int line_no;
+ int node_id;
rb_event_flag_t events;
} insn_info;
} INSN;
@@ -216,77 +218,77 @@ const ID rb_iseq_shared_exc_local_tbl[] = {idERROR_INFO};
APPEND_LIST((seq1), (seq2))
/* add an instruction */
-#define ADD_INSN(seq, line, insn) \
- ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_body(iseq, (line), BIN(insn), 0))
+#define ADD_INSN(seq, line_node, insn) \
+ ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_body(iseq, (line_node), BIN(insn), 0))
/* insert an instruction before next */
-#define INSERT_BEFORE_INSN(next, line, insn) \
- ELEM_INSERT_PREV(&(next)->link, (LINK_ELEMENT *) new_insn_body(iseq, (line), BIN(insn), 0))
+#define INSERT_BEFORE_INSN(next, line_node, insn) \
+ ELEM_INSERT_PREV(&(next)->link, (LINK_ELEMENT *) new_insn_body(iseq, (line_node), BIN(insn), 0))
/* insert an instruction after prev */
-#define INSERT_AFTER_INSN(prev, line, insn) \
- ELEM_INSERT_NEXT(&(prev)->link, (LINK_ELEMENT *) new_insn_body(iseq, (line), BIN(insn), 0))
+#define INSERT_AFTER_INSN(prev, line_node, insn) \
+ ELEM_INSERT_NEXT(&(prev)->link, (LINK_ELEMENT *) new_insn_body(iseq, (line_node), BIN(insn), 0))
/* add an instruction with some operands (1, 2, 3, 5) */
-#define ADD_INSN1(seq, line, insn, op1) \
+#define ADD_INSN1(seq, line_node, insn, op1) \
ADD_ELEM((seq), (LINK_ELEMENT *) \
- new_insn_body(iseq, (line), BIN(insn), 1, (VALUE)(op1)))
+ new_insn_body(iseq, (line_node), BIN(insn), 1, (VALUE)(op1)))
/* insert an instruction with some operands (1, 2, 3, 5) before next */
-#define INSERT_BEFORE_INSN1(next, line, insn, op1) \
+#define INSERT_BEFORE_INSN1(next, line_node, insn, op1) \
ELEM_INSERT_PREV(&(next)->link, (LINK_ELEMENT *) \
- new_insn_body(iseq, (line), BIN(insn), 1, (VALUE)(op1)))
+ new_insn_body(iseq, (line_node), BIN(insn), 1, (VALUE)(op1)))
/* insert an instruction with some operands (1, 2, 3, 5) after prev */
-#define INSERT_AFTER_INSN1(prev, line, insn, op1) \
+#define INSERT_AFTER_INSN1(prev, line_node, insn, op1) \
ELEM_INSERT_NEXT(&(prev)->link, (LINK_ELEMENT *) \
- new_insn_body(iseq, (line), BIN(insn), 1, (VALUE)(op1)))
+ new_insn_body(iseq, (line_node), BIN(insn), 1, (VALUE)(op1)))
#define LABEL_REF(label) ((label)->refcnt++)
/* add an instruction with label operand (alias of ADD_INSN1) */
-#define ADD_INSNL(seq, line, insn, label) (ADD_INSN1(seq, line, insn, label), LABEL_REF(label))
+#define ADD_INSNL(seq, line_node, insn, label) (ADD_INSN1(seq, line_node, insn, label), LABEL_REF(label))
-#define ADD_INSN2(seq, line, insn, op1, op2) \
+#define ADD_INSN2(seq, line_node, insn, op1, op2) \
ADD_ELEM((seq), (LINK_ELEMENT *) \
- new_insn_body(iseq, (line), BIN(insn), 2, (VALUE)(op1), (VALUE)(op2)))
+ new_insn_body(iseq, (line_node), BIN(insn), 2, (VALUE)(op1), (VALUE)(op2)))
-#define ADD_INSN3(seq, line, insn, op1, op2, op3) \
+#define ADD_INSN3(seq, line_node, insn, op1, op2, op3) \
ADD_ELEM((seq), (LINK_ELEMENT *) \
- new_insn_body(iseq, (line), BIN(insn), 3, (VALUE)(op1), (VALUE)(op2), (VALUE)(op3)))
+ new_insn_body(iseq, (line_node), BIN(insn), 3, (VALUE)(op1), (VALUE)(op2), (VALUE)(op3)))
/* Specific Insn factory */
-#define ADD_SEND(seq, line, id, argc) \
- ADD_SEND_R((seq), (line), (id), (argc), NULL, (VALUE)INT2FIX(0), NULL)
+#define ADD_SEND(seq, line_node, id, argc) \
+ ADD_SEND_R((seq), (line_node), (id), (argc), NULL, (VALUE)INT2FIX(0), NULL)
-#define ADD_SEND_WITH_FLAG(seq, line, id, argc, flag) \
- ADD_SEND_R((seq), (line), (id), (argc), NULL, (VALUE)(flag), NULL)
+#define ADD_SEND_WITH_FLAG(seq, line_node, id, argc, flag) \
+ ADD_SEND_R((seq), (line_node), (id), (argc), NULL, (VALUE)(flag), NULL)
-#define ADD_SEND_WITH_BLOCK(seq, line, id, argc, block) \
- ADD_SEND_R((seq), (line), (id), (argc), (block), (VALUE)INT2FIX(0), NULL)
+#define ADD_SEND_WITH_BLOCK(seq, line_node, id, argc, block) \
+ ADD_SEND_R((seq), (line_node), (id), (argc), (block), (VALUE)INT2FIX(0), NULL)
-#define ADD_CALL_RECEIVER(seq, line) \
- ADD_INSN((seq), (line), putself)
+#define ADD_CALL_RECEIVER(seq, line_node) \
+ ADD_INSN((seq), (line_node), putself)
-#define ADD_CALL(seq, line, id, argc) \
- ADD_SEND_R((seq), (line), (id), (argc), NULL, (VALUE)INT2FIX(VM_CALL_FCALL), NULL)
+#define ADD_CALL(seq, line_node, id, argc) \
+ ADD_SEND_R((seq), (line_node), (id), (argc), NULL, (VALUE)INT2FIX(VM_CALL_FCALL), NULL)
-#define ADD_CALL_WITH_BLOCK(seq, line, id, argc, block) \
- ADD_SEND_R((seq), (line), (id), (argc), (block), (VALUE)INT2FIX(VM_CALL_FCALL), NULL)
+#define ADD_CALL_WITH_BLOCK(seq, line_node, id, argc, block) \
+ ADD_SEND_R((seq), (line_node), (id), (argc), (block), (VALUE)INT2FIX(VM_CALL_FCALL), NULL)
-#define ADD_SEND_R(seq, line, id, argc, block, flag, keywords) \
- ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_send(iseq, (line), (id), (VALUE)(argc), (block), (VALUE)(flag), (keywords)))
+#define ADD_SEND_R(seq, line_node, id, argc, block, flag, keywords) \
+ ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_send(iseq, (line_node), (id), (VALUE)(argc), (block), (VALUE)(flag), (keywords)))
#define ADD_TRACE(seq, event) \
ADD_ELEM((seq), (LINK_ELEMENT *)new_trace_body(iseq, (event), 0))
#define ADD_TRACE_WITH_DATA(seq, event, data) \
ADD_ELEM((seq), (LINK_ELEMENT *)new_trace_body(iseq, (event), (data)))
-static void iseq_add_getlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, int line, int idx, int level);
-static void iseq_add_setlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, int line, int idx, int level);
+static void iseq_add_getlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, const NODE *const line_node, int idx, int level);
+static void iseq_add_setlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, const NODE *const line_node, int idx, int level);
-#define ADD_GETLOCAL(seq, line, idx, level) iseq_add_getlocal(iseq, (seq), (line), (idx), (level))
-#define ADD_SETLOCAL(seq, line, idx, level) iseq_add_setlocal(iseq, (seq), (line), (idx), (level))
+#define ADD_GETLOCAL(seq, line_node, idx, level) iseq_add_getlocal(iseq, (seq), (line_node), (idx), (level))
+#define ADD_SETLOCAL(seq, line_node, idx, level) iseq_add_setlocal(iseq, (seq), (line_node), (idx), (level))
/* add label */
#define ADD_LABEL(seq, label) \
@@ -295,8 +297,8 @@ static void iseq_add_setlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, int line,
#define APPEND_LABEL(seq, before, label) \
APPEND_ELEM((seq), (before), (LINK_ELEMENT *) (label))
-#define ADD_ADJUST(seq, line, label) \
- ADD_ELEM((seq), (LINK_ELEMENT *) new_adjust_body(iseq, (label), (line)))
+#define ADD_ADJUST(seq, line_node, label) \
+ ADD_ELEM((seq), (LINK_ELEMENT *) new_adjust_body(iseq, (label), nd_line(line_node)))
#define ADD_ADJUST_RESTORE(seq, label) \
ADD_ELEM((seq), (LINK_ELEMENT *) new_adjust_body(iseq, (label), -1))
@@ -332,7 +334,7 @@ static void iseq_add_setlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, int line,
#define COMPILE_RECV(anchor, desc, node) \
(private_recv_p(node) ? \
- (ADD_INSN(anchor, nd_line(node), putself), VM_CALL_FCALL) : \
+ (ADD_INSN(anchor, node, putself), VM_CALL_FCALL) : \
COMPILE(anchor, desc, node->nd_recv) ? 0 : -1)
#define OPERAND_AT(insn, idx) \
@@ -468,7 +470,7 @@ static void dump_disasm_list(const LINK_ELEMENT *elem);
static int insn_data_length(INSN *iobj);
static int calc_sp_depth(int depth, INSN *iobj);
-static INSN *new_insn_body(rb_iseq_t *iseq, int line_no, enum ruby_vminsn_type insn_id, int argc, ...);
+static INSN *new_insn_body(rb_iseq_t *iseq, const NODE *const line_node, enum ruby_vminsn_type insn_id, int argc, ...);
static LABEL *new_label_body(rb_iseq_t *iseq, long line);
static ADJUST *new_adjust_body(rb_iseq_t *iseq, LABEL *label, int line);
static TRACE *new_trace_body(rb_iseq_t *iseq, rb_event_flag_t event, long data);
@@ -645,6 +647,15 @@ decl_branch_base(rb_iseq_t *iseq, const NODE *node, const char *type)
return branches;
}
+static NODE
+generate_dummy_line_node(int lineno, int node_id)
+{
+ NODE dummy = { 0 };
+ nd_set_line(&dummy, lineno);
+ nd_set_node_id(&dummy, node_id);
+ return dummy;
+}
+
static void
add_trace_branch_coverage(rb_iseq_t *iseq, LINK_ANCHOR *const seq, const NODE *node, int branch_id, const char *type, VALUE branches)
{
@@ -683,7 +694,9 @@ add_trace_branch_coverage(rb_iseq_t *iseq, LINK_ANCHOR *const seq, const NODE *n
}
ADD_TRACE_WITH_DATA(seq, RUBY_EVENT_COVERAGE_BRANCH, counter_idx);
- ADD_INSN(seq, last_lineno, nop);
+
+ NODE dummy_line_node = generate_dummy_line_node(last_lineno, nd_node_id(node));
+ ADD_INSN(seq, &dummy_line_node, nop);
}
#define ISEQ_LAST_LINE(iseq) (ISEQ_COMPILE_DATA(iseq)->last_line)
@@ -718,7 +731,8 @@ rb_iseq_compile_callback(rb_iseq_t *iseq, const struct rb_iseq_new_with_callback
(*ifunc->func)(iseq, ret, ifunc->data);
- ADD_INSN(ret, ISEQ_COMPILE_DATA(iseq)->last_line, leave);
+ NODE dummy_line_node = generate_dummy_line_node(ISEQ_COMPILE_DATA(iseq)->last_line, -1);
+ ADD_INSN(ret, &dummy_line_node, leave);
CHECK(iseq_setup_insn(iseq, ret));
return iseq_setup(iseq, ret);
@@ -754,7 +768,8 @@ rb_iseq_compile_node(rb_iseq_t *iseq, const NODE *node)
end->rescued = LABEL_RESCUE_END;
ADD_TRACE(ret, RUBY_EVENT_B_CALL);
- ADD_INSN (ret, FIX2INT(iseq->body->location.first_lineno), nop);
+ NODE dummy_line_node = generate_dummy_line_node(FIX2INT(iseq->body->location.first_lineno), -1);
+ ADD_INSN (ret, &dummy_line_node, nop);
ADD_LABEL(ret, start);
CHECK(COMPILE(ret, "block body", node->nd_body));
ADD_LABEL(ret, end);
@@ -821,11 +836,13 @@ rb_iseq_compile_node(rb_iseq_t *iseq, const NODE *node)
}
if (iseq->body->type == ISEQ_TYPE_RESCUE || iseq->body->type == ISEQ_TYPE_ENSURE) {
- ADD_GETLOCAL(ret, 0, LVAR_ERRINFO, 0);
- ADD_INSN1(ret, 0, throw, INT2FIX(0) /* continue throw */ );
+ NODE dummy_line_node = generate_dummy_line_node(0, -1);
+ ADD_GETLOCAL(ret, &dummy_line_node, LVAR_ERRINFO, 0);
+ ADD_INSN1(ret, &dummy_line_node, throw, INT2FIX(0) /* continue throw */ );
}
else {
- ADD_INSN(ret, ISEQ_COMPILE_DATA(iseq)->last_line, leave);
+ NODE dummy_line_node = generate_dummy_line_node(ISEQ_COMPILE_DATA(iseq)->last_line, -1);
+ ADD_INSN(ret, &dummy_line_node, leave);
}
#if OPT_SUPPORT_JOKE
@@ -1099,19 +1116,6 @@ LAST_ELEMENT(LINK_ANCHOR *const anchor)
}
static LINK_ELEMENT *
-POP_ELEMENT(ISEQ_ARG_DECLARE LINK_ANCHOR *const anchor)
-{
- LINK_ELEMENT *elem = anchor->last;
- anchor->last = anchor->last->prev;
- anchor->last->next = 0;
- verify_list("pop", anchor);
- return elem;
-}
-#if CPDEBUG < 0
-#define POP_ELEMENT(anchor) POP_ELEMENT(iseq, (anchor))
-#endif
-
-static LINK_ELEMENT *
ELEM_FIRST_INSN(LINK_ELEMENT *elem)
{
while (elem) {
@@ -1240,17 +1244,18 @@ new_adjust_body(rb_iseq_t *iseq, LABEL *label, int line)
}
static INSN *
-new_insn_core(rb_iseq_t *iseq, int line_no,
+new_insn_core(rb_iseq_t *iseq, const NODE *line_node,
int insn_id, int argc, VALUE *argv)
{
INSN *iobj = compile_data_alloc_insn(iseq);
- /* printf("insn_id: %d, line: %d\n", insn_id, line_no); */
+ /* printf("insn_id: %d, line: %d\n", insn_id, nd_line(line_node)); */
iobj->link.type = ISEQ_ELEMENT_INSN;
iobj->link.next = 0;
iobj->insn_id = insn_id;
- iobj->insn_info.line_no = line_no;
+ iobj->insn_info.line_no = nd_line(line_node);
+ iobj->insn_info.node_id = nd_node_id(line_node);
iobj->insn_info.events = 0;
iobj->operands = argv;
iobj->operand_size = argc;
@@ -1259,7 +1264,7 @@ new_insn_core(rb_iseq_t *iseq, int line_no,
}
static INSN *
-new_insn_body(rb_iseq_t *iseq, int line_no, enum ruby_vminsn_type insn_id, int argc, ...)
+new_insn_body(rb_iseq_t *iseq, const NODE *const line_node, enum ruby_vminsn_type insn_id, int argc, ...)
{
VALUE *operands = 0;
va_list argv;
@@ -1273,7 +1278,7 @@ new_insn_body(rb_iseq_t *iseq, int line_no, enum ruby_vminsn_type insn_id, int a
}
va_end(argv);
}
- return new_insn_core(iseq, line_no, insn_id, argc, operands);
+ return new_insn_core(iseq, line_node, insn_id, argc, operands);
}
static const struct rb_callinfo *
@@ -1299,7 +1304,7 @@ new_callinfo(rb_iseq_t *iseq, ID mid, int argc, unsigned int flag, struct rb_cal
}
static INSN *
-new_insn_send(rb_iseq_t *iseq, int line_no, ID id, VALUE argc, const rb_iseq_t *blockiseq, VALUE flag, struct rb_callinfo_kwarg *keywords)
+new_insn_send(rb_iseq_t *iseq, const NODE *const line_node, ID id, VALUE argc, const rb_iseq_t *blockiseq, VALUE flag, struct rb_callinfo_kwarg *keywords)
{
VALUE *operands = compile_data_calloc2(iseq, sizeof(VALUE), 2);
VALUE ci = (VALUE)new_callinfo(iseq, id, FIX2INT(argc), FIX2INT(flag), keywords, blockiseq != NULL);
@@ -1308,7 +1313,7 @@ new_insn_send(rb_iseq_t *iseq, int line_no, ID id, VALUE argc, const rb_iseq_t *
if (blockiseq) {
RB_OBJ_WRITTEN(iseq, Qundef, blockiseq);
}
- INSN *insn = new_insn_core(iseq, line_no, BIN(send), 2, operands);
+ INSN *insn = new_insn_core(iseq, line_node, BIN(send), 2, operands);
RB_OBJ_WRITTEN(iseq, Qundef, ci);
RB_GC_GUARD(ci);
return insn;
@@ -1323,7 +1328,7 @@ new_child_iseq(rb_iseq_t *iseq, const NODE *const node,
ast.root = node;
ast.compile_option = 0;
- ast.line_count = -1;
+ ast.script_lines = INT2FIX(-1);
debugs("[new_child_iseq]> ---------------------------------------\n");
int isolated_depth = ISEQ_COMPILE_DATA(iseq)->isolated_depth;
@@ -1378,11 +1383,7 @@ update_catch_except_flags(struct rb_iseq_constant_body *body)
BREAK/NEXT/REDO catch table entries are used only when `throw` insn is used in the block. */
pos = 0;
while (pos < body->iseq_size) {
-#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
- insn = rb_vm_insn_addr2insn((void *)body->iseq_encoded[pos]);
-#else
- insn = (int)body->iseq_encoded[pos];
-#endif
+ insn = rb_vm_insn_decode(body->iseq_encoded[pos]);
if (insn == BIN(throw)) {
set_catch_except_p(body);
break;
@@ -1426,7 +1427,8 @@ iseq_insert_nop_between_end_and_cont(rb_iseq_t *iseq)
for (e = end; e && (IS_LABEL(e) || IS_TRACE(e)); e = e->next) {
if (e == cont) {
- INSN *nop = new_insn_core(iseq, 0, BIN(nop), 0, 0);
+ NODE dummy_line_node = generate_dummy_line_node(0, -1);
+ INSN *nop = new_insn_core(iseq, &dummy_line_node, BIN(nop), 0, 0);
ELEM_INSERT_NEXT(end, &nop->link);
break;
}
@@ -1672,25 +1674,25 @@ iseq_lvar_id(const rb_iseq_t *iseq, int idx, int level)
}
static void
-iseq_add_getlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, int line, int idx, int level)
+iseq_add_getlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, const NODE *const line_node, int idx, int level)
{
if (iseq_local_block_param_p(iseq, idx, level)) {
- ADD_INSN2(seq, line, getblockparam, INT2FIX((idx) + VM_ENV_DATA_SIZE - 1), INT2FIX(level));
+ ADD_INSN2(seq, line_node, getblockparam, INT2FIX((idx) + VM_ENV_DATA_SIZE - 1), INT2FIX(level));
}
else {
- ADD_INSN2(seq, line, getlocal, INT2FIX((idx) + VM_ENV_DATA_SIZE - 1), INT2FIX(level));
+ ADD_INSN2(seq, line_node, getlocal, INT2FIX((idx) + VM_ENV_DATA_SIZE - 1), INT2FIX(level));
}
if (level > 0) access_outer_variables(iseq, level, iseq_lvar_id(iseq, idx, level), Qfalse);
}
static void
-iseq_add_setlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, int line, int idx, int level)
+iseq_add_setlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, const NODE *const line_node, int idx, int level)
{
if (iseq_local_block_param_p(iseq, idx, level)) {
- ADD_INSN2(seq, line, setblockparam, INT2FIX((idx) + VM_ENV_DATA_SIZE - 1), INT2FIX(level));
+ ADD_INSN2(seq, line_node, setblockparam, INT2FIX((idx) + VM_ENV_DATA_SIZE - 1), INT2FIX(level));
}
else {
- ADD_INSN2(seq, line, setlocal, INT2FIX((idx) + VM_ENV_DATA_SIZE - 1), INT2FIX(level));
+ ADD_INSN2(seq, line_node, setlocal, INT2FIX((idx) + VM_ENV_DATA_SIZE - 1), INT2FIX(level));
}
if (level > 0) access_outer_variables(iseq, level, iseq_lvar_id(iseq, idx, level), Qtrue);
}
@@ -1965,8 +1967,8 @@ iseq_set_local_table(rb_iseq_t *iseq, const ID *tbl)
return COMPILE_OK;
}
-static int
-cdhash_cmp(VALUE val, VALUE lit)
+int
+rb_iseq_cdhash_cmp(VALUE val, VALUE lit)
{
int tval, tlit;
@@ -1999,13 +2001,26 @@ cdhash_cmp(VALUE val, VALUE lit)
else if (tlit == T_FLOAT) {
return rb_float_cmp(lit, val);
}
+ else if (tlit == T_RATIONAL) {
+ const struct RRational *rat1 = RRATIONAL(val);
+ const struct RRational *rat2 = RRATIONAL(lit);
+ return rb_iseq_cdhash_cmp(rat1->num, rat2->num) || rb_iseq_cdhash_cmp(rat1->den, rat2->den);
+ }
+ else if (tlit == T_COMPLEX) {
+ const struct RComplex *comp1 = RCOMPLEX(val);
+ const struct RComplex *comp2 = RCOMPLEX(lit);
+ return rb_iseq_cdhash_cmp(comp1->real, comp2->real) || rb_iseq_cdhash_cmp(comp1->imag, comp2->imag);
+ }
+ else if (tlit == T_REGEXP) {
+ return rb_reg_equal(val, lit) ? 0 : -1;
+ }
else {
UNREACHABLE_RETURN(-1);
}
}
-static st_index_t
-cdhash_hash(VALUE a)
+st_index_t
+rb_iseq_cdhash_hash(VALUE a)
{
switch (OBJ_BUILTIN_TYPE(a)) {
case -1:
@@ -2017,14 +2032,20 @@ cdhash_hash(VALUE a)
return FIX2LONG(rb_big_hash(a));
case T_FLOAT:
return rb_dbl_long_hash(RFLOAT_VALUE(a));
+ case T_RATIONAL:
+ return rb_rational_hash(a);
+ case T_COMPLEX:
+ return rb_complex_hash(a);
+ case T_REGEXP:
+ return NUM2LONG(rb_reg_hash(a));
default:
UNREACHABLE_RETURN(0);
}
}
static const struct st_hash_type cdhash_type = {
- cdhash_cmp,
- cdhash_hash,
+ rb_iseq_cdhash_cmp,
+ rb_iseq_cdhash_hash,
};
struct cdhash_set_label_struct {
@@ -2134,7 +2155,8 @@ fix_sp_depth(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
}
if (lobj->sp == -1) {
lobj->sp = sp;
- } else if (lobj->sp != sp) {
+ }
+ else if (lobj->sp != sp) {
debugs("%s:%d: sp inconsistency found but ignored (" LABEL_FORMAT " sp: %d, calculated sp: %d)\n",
RSTRING_PTR(rb_iseq_path(iseq)), line,
lobj->label_no, lobj->sp, sp);
@@ -2194,8 +2216,14 @@ add_insn_info(struct iseq_insn_info_entry *insns_info, unsigned int *positions,
{
if (insns_info_index == 0 ||
insns_info[insns_info_index-1].line_no != iobj->insn_info.line_no ||
+#ifdef USE_ISEQ_NODE_ID
+ insns_info[insns_info_index-1].node_id != iobj->insn_info.node_id ||
+#endif
insns_info[insns_info_index-1].events != iobj->insn_info.events) {
insns_info[insns_info_index].line_no = iobj->insn_info.line_no;
+#ifdef USE_ISEQ_NODE_ID
+ insns_info[insns_info_index].node_id = iobj->insn_info.node_id;
+#endif
insns_info[insns_info_index].events = iobj->insn_info.events;
positions[insns_info_index] = code_index;
return TRUE;
@@ -2789,7 +2817,7 @@ optimize_checktype(rb_iseq_t *iseq, INSN *iobj)
* jump L2
* L2:
*/
- int line;
+ int line, node_id;
INSN *niobj, *ciobj, *dup = 0;
LABEL *dest = 0;
VALUE type;
@@ -2835,6 +2863,8 @@ optimize_checktype(rb_iseq_t *iseq, INSN *iobj)
return FALSE;
}
line = ciobj->insn_info.line_no;
+ node_id = ciobj->insn_info.node_id;
+ NODE dummy_line_node = generate_dummy_line_node(line, node_id);
if (!dest) {
if (niobj->link.next && IS_LABEL(niobj->link.next)) {
dest = (LABEL *)niobj->link.next; /* reuse label */
@@ -2844,9 +2874,9 @@ optimize_checktype(rb_iseq_t *iseq, INSN *iobj)
ELEM_INSERT_NEXT(&niobj->link, &dest->link);
}
}
- INSERT_AFTER_INSN1(iobj, line, jump, dest);
+ INSERT_AFTER_INSN1(iobj, &dummy_line_node, jump, dest);
LABEL_REF(dest);
- if (!dup) INSERT_AFTER_INSN(iobj, line, pop);
+ if (!dup) INSERT_AFTER_INSN(iobj, &dummy_line_node, pop);
return TRUE;
}
@@ -2898,7 +2928,8 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
}
else if (iobj != diobj && IS_INSN(&diobj->link) &&
IS_INSN_ID(diobj, jump) &&
- OPERAND_AT(iobj, 0) != OPERAND_AT(diobj, 0)) {
+ OPERAND_AT(iobj, 0) != OPERAND_AT(diobj, 0) &&
+ diobj->insn_info.events == 0) {
/*
* useless jump elimination:
* jump LABEL1
@@ -2979,8 +3010,8 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
* pop
* jump L1
*/
- INSN *popiobj = new_insn_core(iseq, iobj->insn_info.line_no,
- BIN(pop), 0, 0);
+ NODE dummy_line_node = generate_dummy_line_node(iobj->insn_info.line_no, iobj->insn_info.node_id);
+ INSN *popiobj = new_insn_core(iseq, &dummy_line_node, BIN(pop), 0, 0);
ELEM_REPLACE(&piobj->link, &popiobj->link);
}
}
@@ -2998,13 +3029,12 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
*
* putobject "beg".."end"
*/
- if (IS_INSN_ID(iobj, checkmatch)) {
- INSN *range = (INSN *)get_prev_insn(iobj);
+ if (IS_INSN_ID(iobj, newrange)) {
+ INSN *const range = iobj;
INSN *beg, *end;
VALUE str_beg, str_end;
- if (range && IS_INSN_ID(range, newrange) &&
- (end = (INSN *)get_prev_insn(range)) != 0 &&
+ if ((end = (INSN *)get_prev_insn(range)) != 0 &&
is_frozen_putstring(end, &str_end) &&
(beg = (INSN *)get_prev_insn(end)) != 0 &&
is_frozen_putstring(beg, &str_beg)) {
@@ -3143,12 +3173,14 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
ELEM_REMOVE(iobj->link.prev);
}
else if (!iseq_pop_newarray(iseq, pobj)) {
- pobj = new_insn_core(iseq, pobj->insn_info.line_no, BIN(pop), 0, NULL);
+ NODE dummy_line_node = generate_dummy_line_node(pobj->insn_info.line_no, pobj->insn_info.node_id);
+ pobj = new_insn_core(iseq, &dummy_line_node, BIN(pop), 0, NULL);
ELEM_INSERT_PREV(&iobj->link, &pobj->link);
}
if (cond) {
if (prev_dup) {
- pobj = new_insn_core(iseq, pobj->insn_info.line_no, BIN(putnil), 0, NULL);
+ NODE dummy_line_node = generate_dummy_line_node(pobj->insn_info.line_no, pobj->insn_info.node_id);
+ pobj = new_insn_core(iseq, &dummy_line_node, BIN(putnil), 0, NULL);
ELEM_INSERT_NEXT(&iobj->link, &pobj->link);
}
iobj->insn_id = BIN(jump);
@@ -3194,7 +3226,8 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
}
else if (previ == BIN(concatarray)) {
INSN *piobj = (INSN *)prev;
- INSERT_BEFORE_INSN1(piobj, piobj->insn_info.line_no, splatarray, Qfalse);
+ NODE dummy_line_node = generate_dummy_line_node(piobj->insn_info.line_no, piobj->insn_info.node_id);
+ INSERT_BEFORE_INSN1(piobj, &dummy_line_node, splatarray, Qfalse);
INSN_OF(piobj) = BIN(pop);
}
else if (previ == BIN(concatstrings)) {
@@ -3610,7 +3643,8 @@ new_unified_insn(rb_iseq_t *iseq,
list = list->next;
}
- return new_insn_core(iseq, iobj->insn_info.line_no, insn_id, argc, operands);
+ NODE dummy_line_node = generate_dummy_line_node(iobj->insn_info.line_no, iobj->insn_info.node_id);
+ return new_insn_core(iseq, &dummy_line_node, insn_id, argc, operands);
}
#endif
@@ -3761,8 +3795,9 @@ iseq_set_sequence_stackcaching(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
{
/* exception merge point */
if (state != SCS_AX) {
+ NODE dummy_line_node = generate_dummy_line_node(0, -1);
INSN *rpobj =
- new_insn_body(iseq, 0, BIN(reput), 0);
+ new_insn_body(iseq, &dummy_line_node, BIN(reput), 0);
/* replace this insn */
ELEM_REPLACE(list, (LINK_ELEMENT *)rpobj);
@@ -3870,7 +3905,7 @@ compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *cons
return COMPILE_NG;
}
lit = rb_fstring(lit);
- ADD_INSN1(ret, nd_line(node), putobject, lit);
+ ADD_INSN1(ret, node, putobject, lit);
RB_OBJ_WRITTEN(iseq, Qundef, lit);
if (RSTRING_LEN(lit) == 0) first_lit = LAST_ELEMENT(ret);
}
@@ -3879,7 +3914,7 @@ compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *cons
const NODE *const head = list->nd_head;
if (nd_type(head) == NODE_STR) {
lit = rb_fstring(head->nd_lit);
- ADD_INSN1(ret, nd_line(head), putobject, lit);
+ ADD_INSN1(ret, head, putobject, lit);
RB_OBJ_WRITTEN(iseq, Qundef, lit);
lit = Qnil;
}
@@ -3904,13 +3939,12 @@ compile_dstr(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node)
int cnt;
if (!node->nd_next) {
VALUE lit = rb_fstring(node->nd_lit);
- const int line = (int)nd_line(node);
- ADD_INSN1(ret, line, putstring, lit);
+ ADD_INSN1(ret, node, putstring, lit);
RB_OBJ_WRITTEN(iseq, Qundef, lit);
}
else {
CHECK(compile_dstr_fragments(iseq, ret, node, &cnt));
- ADD_INSN1(ret, nd_line(node), concatstrings, INT2FIX(cnt));
+ ADD_INSN1(ret, node, concatstrings, INT2FIX(cnt));
}
return COMPILE_OK;
}
@@ -3920,7 +3954,7 @@ compile_dregx(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node)
{
int cnt;
CHECK(compile_dstr_fragments(iseq, ret, node, &cnt));
- ADD_INSN2(ret, nd_line(node), toregexp, INT2FIX(node->nd_cflag), INT2FIX(cnt));
+ ADD_INSN2(ret, node, toregexp, INT2FIX(node->nd_cflag), INT2FIX(cnt));
return COMPILE_OK;
}
@@ -3934,25 +3968,25 @@ compile_flip_flop(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const nod
+ VM_SVAR_FLIPFLOP_START;
VALUE key = INT2FIX(cnt);
- ADD_INSN2(ret, line, getspecial, key, INT2FIX(0));
- ADD_INSNL(ret, line, branchif, lend);
+ ADD_INSN2(ret, node, getspecial, key, INT2FIX(0));
+ ADD_INSNL(ret, node, branchif, lend);
/* *flip == 0 */
CHECK(COMPILE(ret, "flip2 beg", node->nd_beg));
- ADD_INSNL(ret, line, branchunless, else_label);
- ADD_INSN1(ret, line, putobject, Qtrue);
- ADD_INSN1(ret, line, setspecial, key);
+ ADD_INSNL(ret, node, branchunless, else_label);
+ ADD_INSN1(ret, node, putobject, Qtrue);
+ ADD_INSN1(ret, node, setspecial, key);
if (!again) {
- ADD_INSNL(ret, line, jump, then_label);
+ ADD_INSNL(ret, node, jump, then_label);
}
/* *flip == 1 */
ADD_LABEL(ret, lend);
CHECK(COMPILE(ret, "flip2 end", node->nd_end));
- ADD_INSNL(ret, line, branchunless, then_label);
- ADD_INSN1(ret, line, putobject, Qfalse);
- ADD_INSN1(ret, line, setspecial, key);
- ADD_INSNL(ret, line, jump, then_label);
+ ADD_INSNL(ret, node, branchunless, then_label);
+ ADD_INSN1(ret, node, putobject, Qfalse);
+ ADD_INSN1(ret, node, setspecial, key);
+ ADD_INSNL(ret, node, jump, then_label);
return COMPILE_OK;
}
@@ -3969,7 +4003,7 @@ compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *co
CHECK(compile_branch_condition(iseq, ret, cond->nd_1st, label,
else_label));
if (!label->refcnt) {
- ADD_INSN(ret, nd_line(cond), putnil);
+ ADD_INSN(ret, cond, putnil);
break;
}
ADD_LABEL(ret, label);
@@ -3982,7 +4016,7 @@ compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *co
CHECK(compile_branch_condition(iseq, ret, cond->nd_1st, then_label,
label));
if (!label->refcnt) {
- ADD_INSN(ret, nd_line(cond), putnil);
+ ADD_INSN(ret, cond, putnil);
break;
}
ADD_LABEL(ret, label);
@@ -3995,19 +4029,19 @@ compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *co
case NODE_ZLIST:
case NODE_LAMBDA:
/* printf("useless condition eliminate (%s)\n", ruby_node_name(nd_type(cond))); */
- ADD_INSNL(ret, nd_line(cond), jump, then_label);
+ ADD_INSNL(ret, cond, jump, then_label);
return COMPILE_OK;
case NODE_FALSE:
case NODE_NIL:
/* printf("useless condition eliminate (%s)\n", ruby_node_name(nd_type(cond))); */
- ADD_INSNL(ret, nd_line(cond), jump, else_label);
+ ADD_INSNL(ret, cond, jump, else_label);
return COMPILE_OK;
case NODE_LIST:
case NODE_ARGSCAT:
case NODE_DREGX:
case NODE_DSTR:
CHECK(COMPILE_POPPED(ret, "branch condition", cond));
- ADD_INSNL(ret, nd_line(cond), jump, then_label);
+ ADD_INSNL(ret, cond, jump, then_label);
return COMPILE_OK;
case NODE_FLIP2:
CHECK(compile_flip_flop(iseq, ret, cond, TRUE, then_label, else_label));
@@ -4023,8 +4057,8 @@ compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *co
break;
}
- ADD_INSNL(ret, nd_line(cond), branchunless, else_label);
- ADD_INSNL(ret, nd_line(cond), jump, then_label);
+ ADD_INSNL(ret, cond, branchunless, else_label);
+ ADD_INSNL(ret, cond, jump, then_label);
return COMPILE_OK;
}
@@ -4172,11 +4206,11 @@ static_literal_value(const NODE *node, rb_iseq_t *iseq)
static int
compile_array(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int popped)
{
- int line = (int)nd_line(node);
+ const NODE *line_node = node;
if (nd_type(node) == NODE_ZLIST) {
if (!popped) {
- ADD_INSN1(ret, line, newarray, INT2FIX(0));
+ ADD_INSN1(ret, line_node, newarray, INT2FIX(0));
}
return 0;
}
@@ -4235,8 +4269,8 @@ compile_array(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int pop
/* Convert pushed elements to an array, and concatarray if needed */
#define FLUSH_CHUNK(newarrayinsn) \
if (stack_len) { \
- ADD_INSN1(ret, line, newarrayinsn, INT2FIX(stack_len)); \
- if (!first_chunk) ADD_INSN(ret, line, concatarray); \
+ ADD_INSN1(ret, line_node, newarrayinsn, INT2FIX(stack_len)); \
+ if (!first_chunk) ADD_INSN(ret, line_node, concatarray); \
first_chunk = stack_len = 0; \
}
@@ -4262,12 +4296,12 @@ compile_array(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int pop
/* Emit optimized code */
FLUSH_CHUNK(newarray);
if (first_chunk) {
- ADD_INSN1(ret, line, duparray, ary);
+ ADD_INSN1(ret, line_node, duparray, ary);
first_chunk = 0;
}
else {
- ADD_INSN1(ret, line, putobject, ary);
- ADD_INSN(ret, line, concatarray);
+ ADD_INSN1(ret, line_node, putobject, ary);
+ ADD_INSN(ret, line_node, concatarray);
}
RB_OBJ_WRITTEN(iseq, Qundef, ary);
}
@@ -4307,13 +4341,13 @@ static_literal_node_pair_p(const NODE *node, const rb_iseq_t *iseq)
static int
compile_hash(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int method_call_keywords, int popped)
{
- int line = (int)nd_line(node);
+ const NODE *line_node = node;
node = node->nd_head;
if (!node || nd_type(node) == NODE_ZLIST) {
if (!popped) {
- ADD_INSN1(ret, line, newhash, INT2FIX(0));
+ ADD_INSN1(ret, line_node, newhash, INT2FIX(0));
}
return 0;
}
@@ -4357,13 +4391,13 @@ compile_hash(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int meth
if (stack_len) { \
if (first_chunk) { \
APPEND_LIST(ret, anchor); \
- ADD_INSN1(ret, line, newhash, INT2FIX(stack_len)); \
+ ADD_INSN1(ret, line_node, newhash, INT2FIX(stack_len)); \
} \
else { \
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); \
- ADD_INSN(ret, line, swap); \
+ ADD_INSN1(ret, line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); \
+ ADD_INSN(ret, line_node, swap); \
APPEND_LIST(ret, anchor); \
- ADD_SEND(ret, line, id_core_hash_merge_ptr, INT2FIX(stack_len + 1)); \
+ ADD_SEND(ret, line_node, id_core_hash_merge_ptr, INT2FIX(stack_len + 1)); \
} \
INIT_ANCHOR(anchor); \
first_chunk = stack_len = 0; \
@@ -4398,16 +4432,16 @@ compile_hash(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int meth
/* Emit optimized code */
FLUSH_CHUNK();
if (first_chunk) {
- ADD_INSN1(ret, line, duphash, hash);
+ ADD_INSN1(ret, line_node, duphash, hash);
first_chunk = 0;
}
else {
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN(ret, line, swap);
+ ADD_INSN1(ret, line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN(ret, line_node, swap);
- ADD_INSN1(ret, line, putobject, hash);
+ ADD_INSN1(ret, line_node, putobject, hash);
- ADD_SEND(ret, line, id_core_hash_merge_kwd, INT2FIX(2));
+ ADD_SEND(ret, line_node, id_core_hash_merge_kwd, INT2FIX(2));
}
RB_OBJ_WRITTEN(iseq, Qundef, hash);
}
@@ -4454,7 +4488,7 @@ compile_hash(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int meth
/* **{} appears as the first keyword argument, so it may be modified.
* We need to create a fresh hash object.
*/
- ADD_INSN1(ret, line, newhash, INT2FIX(0));
+ ADD_INSN1(ret, line_node, newhash, INT2FIX(0));
}
/* Any empty keyword splats that are not the first can be ignored.
* since merging an empty hash into the existing hash is the same
@@ -4474,13 +4508,13 @@ compile_hash(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int meth
* call. In that case, we need to add an empty hash (if first keyword),
* or merge the hash to the accumulated hash (if not the first keyword).
*/
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- if (first_kw) ADD_INSN1(ret, line, newhash, INT2FIX(0));
- else ADD_INSN(ret, line, swap);
+ ADD_INSN1(ret, line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ if (first_kw) ADD_INSN1(ret, line_node, newhash, INT2FIX(0));
+ else ADD_INSN(ret, line_node, swap);
NO_CHECK(COMPILE(ret, "keyword splat", kw));
- ADD_SEND(ret, line, id_core_hash_merge_kwd, INT2FIX(2));
+ ADD_SEND(ret, line_node, id_core_hash_merge_kwd, INT2FIX(2));
}
}
@@ -4505,6 +4539,9 @@ rb_node_case_when_optimizable_literal(const NODE *const node)
modf(RFLOAT_VALUE(v), &ival) == 0.0) {
return FIXABLE(ival) ? LONG2FIX((long)ival) : rb_dbl2big(ival);
}
+ if (RB_TYPE_P(v, T_RATIONAL) || RB_TYPE_P(v, T_COMPLEX)) {
+ return Qundef;
+ }
if (SYMBOL_P(v) || rb_obj_is_kind_of(v, rb_cNumeric)) {
return v;
}
@@ -4537,20 +4574,20 @@ when_vals(rb_iseq_t *iseq, LINK_ANCHOR *const cond_seq, const NODE *vals,
rb_hash_aset(literals, lit, (VALUE)(l1) | 1);
}
- ADD_INSN(cond_seq, nd_line(val), dup); /* dup target */
-
if (nd_type(val) == NODE_STR) {
debugp_param("nd_lit", val->nd_lit);
lit = rb_fstring(val->nd_lit);
- ADD_INSN1(cond_seq, nd_line(val), putobject, lit);
+ ADD_INSN1(cond_seq, val, putobject, lit);
RB_OBJ_WRITTEN(iseq, Qundef, lit);
}
else {
if (!COMPILE(cond_seq, "when cond", val)) return -1;
}
- ADD_INSN1(cond_seq, nd_line(vals), checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE));
- ADD_INSNL(cond_seq, nd_line(val), branchif, l1);
+ // Emit patern === target
+ ADD_INSN1(cond_seq, vals, topn, INT2FIX(1));
+ ADD_CALL(cond_seq, vals, idEqq, INT2FIX(1));
+ ADD_INSNL(cond_seq, val, branchif, l1);
vals = vals->nd_next;
}
return only_special_literals;
@@ -4560,7 +4597,7 @@ static int
when_splat_vals(rb_iseq_t *iseq, LINK_ANCHOR *const cond_seq, const NODE *vals,
LABEL *l1, int only_special_literals, VALUE literals)
{
- const int line = nd_line(vals);
+ const NODE *line_node = vals;
switch (nd_type(vals)) {
case NODE_LIST:
@@ -4568,11 +4605,11 @@ when_splat_vals(rb_iseq_t *iseq, LINK_ANCHOR *const cond_seq, const NODE *vals,
return COMPILE_NG;
break;
case NODE_SPLAT:
- ADD_INSN (cond_seq, line, dup);
+ ADD_INSN (cond_seq, line_node, dup);
CHECK(COMPILE(cond_seq, "when splat", vals->nd_head));
- ADD_INSN1(cond_seq, line, splatarray, Qfalse);
- ADD_INSN1(cond_seq, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE | VM_CHECKMATCH_ARRAY));
- ADD_INSNL(cond_seq, line, branchif, l1);
+ ADD_INSN1(cond_seq, line_node, splatarray, Qfalse);
+ ADD_INSN1(cond_seq, line_node, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE | VM_CHECKMATCH_ARRAY));
+ ADD_INSNL(cond_seq, line_node, branchif, l1);
break;
case NODE_ARGSCAT:
CHECK(when_splat_vals(iseq, cond_seq, vals->nd_head, l1, only_special_literals, literals));
@@ -4580,60 +4617,212 @@ when_splat_vals(rb_iseq_t *iseq, LINK_ANCHOR *const cond_seq, const NODE *vals,
break;
case NODE_ARGSPUSH:
CHECK(when_splat_vals(iseq, cond_seq, vals->nd_head, l1, only_special_literals, literals));
- ADD_INSN (cond_seq, line, dup);
+ ADD_INSN (cond_seq, line_node, dup);
CHECK(COMPILE(cond_seq, "when argspush body", vals->nd_body));
- ADD_INSN1(cond_seq, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE));
- ADD_INSNL(cond_seq, line, branchif, l1);
+ ADD_INSN1(cond_seq, line_node, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE));
+ ADD_INSNL(cond_seq, line_node, branchif, l1);
break;
default:
- ADD_INSN (cond_seq, line, dup);
+ ADD_INSN (cond_seq, line_node, dup);
CHECK(COMPILE(cond_seq, "when val", vals));
- ADD_INSN1(cond_seq, line, splatarray, Qfalse);
- ADD_INSN1(cond_seq, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE | VM_CHECKMATCH_ARRAY));
- ADD_INSNL(cond_seq, line, branchif, l1);
+ ADD_INSN1(cond_seq, line_node, splatarray, Qfalse);
+ ADD_INSN1(cond_seq, line_node, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE | VM_CHECKMATCH_ARRAY));
+ ADD_INSNL(cond_seq, line_node, branchif, l1);
break;
}
return COMPILE_OK;
}
+/* Multiple Assignment Handling
+ *
+ * In order to handle evaluation of multiple assignment such that the left hand side
+ * is evaluated before the right hand side, we need to process the left hand side
+ * and see if there are any attributes that need to be assigned. If so, we add
+ * instructions to evaluate the receiver of any assigned attributes before we
+ * process the right hand side.
+ *
+ * For a multiple assignment such as:
+ *
+ * l1.m1, l2[0] = r3, r4
+ *
+ * We start off evaluating l1 and l2, then we evaluate r3 and r4, then we
+ * assign the result of r3 to l1.m1, and then the result of r4 to l2.m2.
+ * On the VM stack, this looks like:
+ *
+ * self # putself
+ * l1 # send
+ * l1, self # putself
+ * l1, l2 # send
+ * l1, l2, 0 # putobject 0
+ * l1, l2, 0, [r3, r4] # after evaluation of RHS
+ * l1, l2, 0, [r3, r4], r4, r3 # expandarray
+ * l1, l2, 0, [r3, r4], r4, r3, l1 # topn 5
+ * l1, l2, 0, [r3, r4], r4, l1, r3 # swap
+ * l1, l2, 0, [r3, r4], r4, m1= # send
+ * l1, l2, 0, [r3, r4], r4 # pop
+ * l1, l2, 0, [r3, r4], r4, l2 # topn 3
+ * l1, l2, 0, [r3, r4], r4, l2, 0 # topn 3
+ * l1, l2, 0, [r3, r4], r4, l2, 0, r4 # topn 2
+ * l1, l2, 0, [r3, r4], r4, []= # send
+ * l1, l2, 0, [r3, r4], r4 # pop
+ * l1, l2, 0, [r3, r4] # pop
+ * [r3, r4], l2, 0, [r3, r4] # setn 3
+ * [r3, r4], l2, 0 # pop
+ * [r3, r4], l2 # pop
+ * [r3, r4] # pop
+ *
+ * This is made more complex when you have to handle splats, post args,
+ * and arbitrary levels of nesting. You need to keep track of the total
+ * number of attributes to set, and for each attribute, how many entries
+ * are on the stack before the final attribute, in order to correctly
+ * calculate the topn value to use to get the receiver of the attribute
+ * setter method.
+ *
+ * A brief description of the VM stack for simple multiple assignment
+ * with no splat (rhs_array will not be present if the return value of
+ * the multiple assignment is not needed):
+ *
+ * lhs_attr1, lhs_attr2, ..., rhs_array, ..., rhs_arg2, rhs_arg1
+ *
+ * For multiple assignment with splats, while processing the part before
+ * the splat (splat+post here is an array of the splat and the post arguments):
+ *
+ * lhs_attr1, lhs_attr2, ..., rhs_array, splat+post, ..., rhs_arg2, rhs_arg1
+ *
+ * When processing the splat and post arguments:
+ *
+ * lhs_attr1, lhs_attr2, ..., rhs_array, ..., post_arg2, post_arg1, splat
+ *
+ * When processing nested multiple assignment, existing values on the stack
+ * are kept. So for:
+ *
+ * (l1.m1, l2.m2), l3.m3, l4* = [r1, r2], r3, r4
+ *
+ * The stack layout would be the following before processing the nested
+ * multiple assignment:
+ *
+ * l1, l2, [[r1, r2], r3, r4], [r4], r3, [r1, r2]
+ *
+ * In order to handle this correctly, we need to keep track of the nesting
+ * level for each attribute assignment, as well as the attribute number
+ * (left hand side attributes are processed left to right) and number of
+ * arguments to pass to the setter method. struct masgn_attrasgn tracks
+ * this information.
+ *
+ * We also need to track information for the entire multiple assignment, such
+ * as the total number of arguments, and the current nesting level, to
+ * handle both nested multiple assignment as well as cases where the
+ * rhs is not needed. We also need to keep track of all attribute
+ * assignments in this, which we do using a linked listed. struct masgn_state
+ * tracks this information.
+ */
+
+struct masgn_attrasgn {
+ INSN *before_insn;
+ struct masgn_attrasgn *next;
+ const NODE *line_node;
+ int argn;
+ int num_args;
+ int lhs_pos;
+};
+
+struct masgn_state {
+ struct masgn_attrasgn *first_memo;
+ struct masgn_attrasgn *last_memo;
+ int lhs_level;
+ int num_args;
+ bool nested;
+};
+
+static int compile_massign0(rb_iseq_t *iseq, LINK_ANCHOR *const pre, LINK_ANCHOR *const rhs, LINK_ANCHOR *const lhs, LINK_ANCHOR *const post, const NODE *const node, struct masgn_state *state, int popped);
static int
-compile_massign_lhs(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node)
+compile_massign_lhs(rb_iseq_t *iseq, LINK_ANCHOR *const pre, LINK_ANCHOR *const rhs, LINK_ANCHOR *const lhs, LINK_ANCHOR *const post, const NODE *const node, struct masgn_state *state, int lhs_pos)
{
switch (nd_type(node)) {
case NODE_ATTRASGN: {
+ if (!state) {
+ rb_bug("no masgn_state");
+ }
+
INSN *iobj;
- VALUE dupidx;
- int line = nd_line(node);
+ const NODE *line_node = node;
- CHECK(COMPILE_POPPED(ret, "masgn lhs (NODE_ATTRASGN)", node));
+ CHECK(COMPILE_POPPED(pre, "masgn lhs (NODE_ATTRASGN)", node));
+
+ LINK_ELEMENT *insn_element = LAST_ELEMENT(pre);
+ iobj = (INSN *)get_prev_insn((INSN *)insn_element); /* send insn */
+ ELEM_REMOVE(LAST_ELEMENT(pre));
+ ELEM_REMOVE((LINK_ELEMENT *)iobj);
+ pre->last = iobj->link.prev;
- iobj = (INSN *)get_prev_insn((INSN *)LAST_ELEMENT(ret)); /* send insn */
const struct rb_callinfo *ci = (struct rb_callinfo *)OPERAND_AT(iobj, 0);
int argc = vm_ci_argc(ci) + 1;
ci = ci_argc_set(iseq, ci, argc);
OPERAND_AT(iobj, 0) = (VALUE)ci;
RB_OBJ_WRITTEN(iseq, Qundef, ci);
- dupidx = INT2FIX(argc);
- INSERT_BEFORE_INSN1(iobj, line, topn, dupidx);
+ if (argc == 1) {
+ ADD_INSN(lhs, line_node, swap);
+ }
+ else {
+ ADD_INSN1(lhs, line_node, topn, INT2FIX(argc));
+ }
+
+ struct masgn_attrasgn *memo;
+ memo = malloc(sizeof(struct masgn_attrasgn));
+ if (!memo) {
+ return 0;
+ }
+ memo->before_insn = (INSN *)LAST_ELEMENT(lhs);
+ memo->line_node = line_node;
+ memo->argn = state->num_args + 1;
+ memo->num_args = argc;
+ state->num_args += argc;
+ memo->lhs_pos = lhs_pos;
+ memo->next = NULL;
+ if (!state->first_memo) {
+ state->first_memo = memo;
+ }
+ else {
+ state->last_memo->next = memo;
+ }
+ state->last_memo = memo;
+
+ ADD_ELEM(lhs, (LINK_ELEMENT *)iobj);
if (vm_ci_flag(ci) & VM_CALL_ARGS_SPLAT) {
int argc = vm_ci_argc(ci);
ci = ci_argc_set(iseq, ci, argc - 1);
OPERAND_AT(iobj, 0) = (VALUE)ci;
RB_OBJ_WRITTEN(iseq, Qundef, iobj);
- INSERT_BEFORE_INSN1(iobj, line, newarray, INT2FIX(1));
- INSERT_BEFORE_INSN(iobj, line, concatarray);
+ INSERT_BEFORE_INSN1(iobj, line_node, newarray, INT2FIX(1));
+ INSERT_BEFORE_INSN(iobj, line_node, concatarray);
}
- ADD_INSN(ret, line, pop); /* result */
+ ADD_INSN(lhs, line_node, pop);
+ if (argc != 1) {
+ ADD_INSN(lhs, line_node, pop);
+ }
+ for (int i=0; i < argc; i++) {
+ ADD_INSN(post, line_node, pop);
+ }
break;
}
case NODE_MASGN: {
- DECL_ANCHOR(anchor);
- INIT_ANCHOR(anchor);
- CHECK(COMPILE_POPPED(anchor, "nest masgn lhs", node));
- ELEM_REMOVE(FIRST_ELEMENT(anchor));
- ADD_SEQ(ret, anchor);
+ DECL_ANCHOR(nest_rhs);
+ INIT_ANCHOR(nest_rhs);
+ DECL_ANCHOR(nest_lhs);
+ INIT_ANCHOR(nest_lhs);
+
+ int prev_level = state->lhs_level;
+ bool prev_nested = state->nested;
+ state->nested = 1;
+ state->lhs_level = lhs_pos - 1;
+ CHECK(compile_massign0(iseq, pre, nest_rhs, nest_lhs, post, node, state, 1));
+ state->lhs_level = prev_level;
+ state->nested = prev_nested;
+
+ ADD_SEQ(lhs, nest_rhs);
+ ADD_SEQ(lhs, nest_lhs);
break;
}
default: {
@@ -4641,7 +4830,7 @@ compile_massign_lhs(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const n
INIT_ANCHOR(anchor);
CHECK(COMPILE_POPPED(anchor, "masgn lhs", node));
ELEM_REMOVE(FIRST_ELEMENT(anchor));
- ADD_SEQ(ret, anchor);
+ ADD_SEQ(lhs, anchor);
}
}
@@ -4653,7 +4842,7 @@ compile_massign_opt_lhs(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *lhs
{
if (lhsn) {
CHECK(compile_massign_opt_lhs(iseq, ret, lhsn->nd_next));
- CHECK(compile_massign_lhs(iseq, ret, lhsn->nd_head));
+ CHECK(compile_massign_lhs(iseq, ret, ret, ret, ret, lhsn->nd_head, NULL, 0));
}
return COMPILE_OK;
}
@@ -4714,7 +4903,7 @@ compile_massign_opt(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
if (llen > rlen) {
for (i=0; i<llen-rlen; i++) {
- ADD_INSN(ret, nd_line(orig_lhsn), putnil);
+ ADD_INSN(ret, orig_lhsn, putnil);
}
}
@@ -4722,98 +4911,110 @@ compile_massign_opt(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
return 1;
}
-static void
-adjust_stack(rb_iseq_t *iseq, LINK_ANCHOR *const ret, int line, int rlen, int llen)
-{
- if (rlen < llen) {
- do {ADD_INSN(ret, line, putnil);} while (++rlen < llen);
- }
- else if (rlen > llen) {
- do {ADD_INSN(ret, line, pop);} while (--rlen > llen);
- }
-}
-
static int
-compile_massign(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped)
+compile_massign0(rb_iseq_t *iseq, LINK_ANCHOR *const pre, LINK_ANCHOR *const rhs, LINK_ANCHOR *const lhs, LINK_ANCHOR *const post, const NODE *const node, struct masgn_state *state, int popped)
{
const NODE *rhsn = node->nd_value;
const NODE *splatn = node->nd_args;
const NODE *lhsn = node->nd_head;
+ const NODE *lhsn_count = lhsn;
int lhs_splat = (splatn && NODE_NAMED_REST_P(splatn)) ? 1 : 0;
- if (!popped || splatn || !compile_massign_opt(iseq, ret, rhsn, lhsn)) {
- int llen = 0;
- int expand = 1;
- DECL_ANCHOR(lhsseq);
+ int llen = 0;
+ int lpos = 0;
+ int expand = 1;
- INIT_ANCHOR(lhsseq);
+ while (lhsn_count) {
+ llen++;
+ lhsn_count = lhsn_count->nd_next;
+ }
+ while (lhsn) {
+ CHECK(compile_massign_lhs(iseq, pre, rhs, lhs, post, lhsn->nd_head, state, (llen - lpos) + lhs_splat + state->lhs_level));
+ lpos++;
+ lhsn = lhsn->nd_next;
+ }
- while (lhsn) {
- CHECK(compile_massign_lhs(iseq, lhsseq, lhsn->nd_head));
- llen += 1;
- lhsn = lhsn->nd_next;
- }
+ if (lhs_splat) {
+ if (nd_type(splatn) == NODE_POSTARG) {
+ /*a, b, *r, p1, p2 */
+ const NODE *postn = splatn->nd_2nd;
+ const NODE *restn = splatn->nd_1st;
+ int plen = (int)postn->nd_alen;
+ int ppos = 0;
+ int flag = 0x02 | (NODE_NAMED_REST_P(restn) ? 0x01 : 0x00);
- NO_CHECK(COMPILE(ret, "normal masgn rhs", rhsn));
+ ADD_INSN2(lhs, splatn, expandarray, INT2FIX(plen), INT2FIX(flag));
+
+ if (NODE_NAMED_REST_P(restn)) {
+ CHECK(compile_massign_lhs(iseq, pre, rhs, lhs, post, restn, state, 1 + plen + state->lhs_level));
+ }
+ while (postn) {
+ CHECK(compile_massign_lhs(iseq, pre, rhs, lhs, post, postn->nd_head, state, (plen - ppos) + state->lhs_level));
+ ppos++;
+ postn = postn->nd_next;
+ }
+ }
+ else {
+ /* a, b, *r */
+ CHECK(compile_massign_lhs(iseq, pre, rhs, lhs, post, splatn, state, 1 + state->lhs_level));
+ }
+ }
- if (!popped) {
- ADD_INSN(ret, nd_line(node), dup);
- }
- else if (!lhs_splat) {
- INSN *last = (INSN*)ret->last;
- if (IS_INSN(&last->link) &&
- IS_INSN_ID(last, newarray) &&
- last->operand_size == 1) {
- int rlen = FIX2INT(OPERAND_AT(last, 0));
- /* special case: assign to aset or attrset */
- if (llen == 2) {
- POP_ELEMENT(ret);
- adjust_stack(iseq, ret, nd_line(node), rlen, llen);
- ADD_INSN(ret, nd_line(node), swap);
- expand = 0;
- }
- else if (llen > 2 && llen != rlen) {
- POP_ELEMENT(ret);
- adjust_stack(iseq, ret, nd_line(node), rlen, llen);
- ADD_INSN1(ret, nd_line(node), reverse, INT2FIX(llen));
- expand = 0;
- }
- else if (llen > 2) {
- last->insn_id = BIN(reverse);
- expand = 0;
- }
- }
- }
- if (expand) {
- ADD_INSN2(ret, nd_line(node), expandarray,
- INT2FIX(llen), INT2FIX(lhs_splat));
- }
- ADD_SEQ(ret, lhsseq);
- if (lhs_splat) {
- if (nd_type(splatn) == NODE_POSTARG) {
- /*a, b, *r, p1, p2 */
- const NODE *postn = splatn->nd_2nd;
- const NODE *restn = splatn->nd_1st;
- int num = (int)postn->nd_alen;
- int flag = 0x02 | (NODE_NAMED_REST_P(restn) ? 0x01 : 0x00);
+ if (!state->nested) {
+ NO_CHECK(COMPILE(rhs, "normal masgn rhs", rhsn));
+ }
- ADD_INSN2(ret, nd_line(splatn), expandarray,
- INT2FIX(num), INT2FIX(flag));
+ if (!popped) {
+ ADD_INSN(rhs, node, dup);
+ }
+ if (expand) {
+ ADD_INSN2(rhs, node, expandarray, INT2FIX(llen), INT2FIX(lhs_splat));
+ }
+ return COMPILE_OK;
+}
- if (NODE_NAMED_REST_P(restn)) {
- CHECK(compile_massign_lhs(iseq, ret, restn));
- }
- while (postn) {
- CHECK(compile_massign_lhs(iseq, ret, postn->nd_head));
- postn = postn->nd_next;
- }
- }
- else {
- /* a, b, *r */
- CHECK(compile_massign_lhs(iseq, ret, splatn));
- }
- }
+static int
+compile_massign(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped)
+{
+ if (!popped || node->nd_args || !compile_massign_opt(iseq, ret, node->nd_value, node->nd_head)) {
+ struct masgn_state state;
+ state.lhs_level = popped ? 0 : 1;
+ state.nested = 0;
+ state.num_args = 0;
+ state.first_memo = NULL;
+ state.last_memo = NULL;
+
+ DECL_ANCHOR(pre);
+ INIT_ANCHOR(pre);
+ DECL_ANCHOR(rhs);
+ INIT_ANCHOR(rhs);
+ DECL_ANCHOR(lhs);
+ INIT_ANCHOR(lhs);
+ DECL_ANCHOR(post);
+ INIT_ANCHOR(post);
+ int ok = compile_massign0(iseq, pre, rhs, lhs, post, node, &state, popped);
+
+ struct masgn_attrasgn *memo = state.first_memo, *tmp_memo;
+ while (memo) {
+ VALUE topn_arg = INT2FIX((state.num_args - memo->argn) + memo->lhs_pos);
+ for (int i = 0; i < memo->num_args; i++) {
+ INSERT_BEFORE_INSN1(memo->before_insn, memo->line_node, topn, topn_arg);
+ }
+ tmp_memo = memo->next;
+ free(memo);
+ memo = tmp_memo;
+ }
+ CHECK(ok);
+
+ ADD_SEQ(ret, pre);
+ ADD_SEQ(ret, rhs);
+ ADD_SEQ(ret, lhs);
+ if (!popped && state.num_args >= 1) {
+ /* make sure rhs array is returned before popping */
+ ADD_INSN1(ret, node, setn, INT2FIX(state.num_args));
+ }
+ ADD_SEQ(ret, post);
}
return COMPILE_OK;
}
@@ -4825,21 +5026,21 @@ compile_const_prefix(rb_iseq_t *iseq, const NODE *const node,
switch (nd_type(node)) {
case NODE_CONST:
debugi("compile_const_prefix - colon", node->nd_vid);
- ADD_INSN1(body, nd_line(node), putobject, Qtrue);
- ADD_INSN1(body, nd_line(node), getconstant, ID2SYM(node->nd_vid));
+ ADD_INSN1(body, node, putobject, Qtrue);
+ ADD_INSN1(body, node, getconstant, ID2SYM(node->nd_vid));
break;
case NODE_COLON3:
debugi("compile_const_prefix - colon3", node->nd_mid);
- ADD_INSN(body, nd_line(node), pop);
- ADD_INSN1(body, nd_line(node), putobject, rb_cObject);
- ADD_INSN1(body, nd_line(node), putobject, Qtrue);
- ADD_INSN1(body, nd_line(node), getconstant, ID2SYM(node->nd_mid));
+ ADD_INSN(body, node, pop);
+ ADD_INSN1(body, node, putobject, rb_cObject);
+ ADD_INSN1(body, node, putobject, Qtrue);
+ ADD_INSN1(body, node, getconstant, ID2SYM(node->nd_mid));
break;
case NODE_COLON2:
CHECK(compile_const_prefix(iseq, node->nd_head, pref, body));
debugi("compile_const_prefix - colon2", node->nd_mid);
- ADD_INSN1(body, nd_line(node), putobject, Qfalse);
- ADD_INSN1(body, nd_line(node), getconstant, ID2SYM(node->nd_mid));
+ ADD_INSN1(body, node, putobject, Qfalse);
+ ADD_INSN1(body, node, getconstant, ID2SYM(node->nd_mid));
break;
default:
CHECK(COMPILE(pref, "const colon2 prefix", node));
@@ -4853,7 +5054,7 @@ compile_cpath(LINK_ANCHOR *const ret, rb_iseq_t *iseq, const NODE *cpath)
{
if (nd_type(cpath) == NODE_COLON3) {
/* toplevel class ::Foo */
- ADD_INSN1(ret, nd_line(cpath), putobject, rb_cObject);
+ ADD_INSN1(ret, cpath, putobject, rb_cObject);
return VM_DEFINECLASS_FLAG_SCOPED;
}
else if (cpath->nd_head) {
@@ -4863,7 +5064,7 @@ compile_cpath(LINK_ANCHOR *const ret, rb_iseq_t *iseq, const NODE *cpath)
}
else {
/* class at cbase Foo */
- ADD_INSN1(ret, nd_line(cpath), putspecialobject,
+ ADD_INSN1(ret, cpath, putspecialobject,
INT2FIX(VM_SPECIAL_OBJECT_CONST_BASE));
return 0;
}
@@ -4884,7 +5085,7 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
const NODE *const node, LABEL **lfinish, VALUE needstr);
static int
-compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, const enum node_type type, int line, int popped, bool assume_receiver);
+compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, const enum node_type type, const NODE *const line_node, int popped, bool assume_receiver);
static void
defined_expr0(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
@@ -4894,6 +5095,7 @@ defined_expr0(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
enum defined_type expr_type = DEFINED_NOT_DEFINED;
enum node_type type;
const int line = nd_line(node);
+ const NODE *line_node = node;
switch (type = nd_type(node)) {
@@ -4920,7 +5122,7 @@ defined_expr0(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
if (!lfinish[1]) {
lfinish[1] = NEW_LABEL(line);
}
- ADD_INSNL(ret, line, branchunless, lfinish[1]);
+ ADD_INSNL(ret, line_node, branchunless, lfinish[1]);
} while ((vals = vals->nd_next) != NULL);
}
/* fall through */
@@ -4941,26 +5143,26 @@ defined_expr0(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
#define PUSH_VAL(type) (needstr == Qfalse ? Qtrue : rb_iseq_defined_string(type))
case NODE_IVAR:
- ADD_INSN(ret, line, putnil);
- ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_IVAR),
+ ADD_INSN(ret, line_node, putnil);
+ ADD_INSN3(ret, line_node, defined, INT2FIX(DEFINED_IVAR),
ID2SYM(node->nd_vid), PUSH_VAL(DEFINED_IVAR));
return;
case NODE_GVAR:
- ADD_INSN(ret, line, putnil);
- ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_GVAR),
+ ADD_INSN(ret, line_node, putnil);
+ ADD_INSN3(ret, line_node, defined, INT2FIX(DEFINED_GVAR),
ID2SYM(node->nd_entry), PUSH_VAL(DEFINED_GVAR));
return;
case NODE_CVAR:
- ADD_INSN(ret, line, putnil);
- ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_CVAR),
+ ADD_INSN(ret, line_node, putnil);
+ ADD_INSN3(ret, line_node, defined, INT2FIX(DEFINED_CVAR),
ID2SYM(node->nd_vid), PUSH_VAL(DEFINED_CVAR));
return;
case NODE_CONST:
- ADD_INSN(ret, line, putnil);
- ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_CONST),
+ ADD_INSN(ret, line_node, putnil);
+ ADD_INSN3(ret, line_node, defined, INT2FIX(DEFINED_CONST),
ID2SYM(node->nd_vid), PUSH_VAL(DEFINED_CONST));
return;
case NODE_COLON2:
@@ -4968,21 +5170,21 @@ defined_expr0(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
lfinish[1] = NEW_LABEL(line);
}
defined_expr0(iseq, ret, node->nd_head, lfinish, Qfalse, false);
- ADD_INSNL(ret, line, branchunless, lfinish[1]);
+ ADD_INSNL(ret, line_node, branchunless, lfinish[1]);
NO_CHECK(COMPILE(ret, "defined/colon2#nd_head", node->nd_head));
if (rb_is_const_id(node->nd_mid)) {
- ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_CONST_FROM),
+ ADD_INSN3(ret, line_node, defined, INT2FIX(DEFINED_CONST_FROM),
ID2SYM(node->nd_mid), PUSH_VAL(DEFINED_CONST));
}
else {
- ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_METHOD),
+ ADD_INSN3(ret, line_node, defined, INT2FIX(DEFINED_METHOD),
ID2SYM(node->nd_mid), PUSH_VAL(DEFINED_METHOD));
}
return;
case NODE_COLON3:
- ADD_INSN1(ret, line, putobject, rb_cObject);
- ADD_INSN3(ret, line, defined,
+ ADD_INSN1(ret, line_node, putobject, rb_cObject);
+ ADD_INSN3(ret, line_node, defined,
INT2FIX(DEFINED_CONST_FROM), ID2SYM(node->nd_mid), PUSH_VAL(DEFINED_CONST));
return;
@@ -5006,59 +5208,59 @@ defined_expr0(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
}
if (node->nd_args) {
defined_expr0(iseq, ret, node->nd_args, lfinish, Qfalse, false);
- ADD_INSNL(ret, line, branchunless, lfinish[1]);
+ ADD_INSNL(ret, line_node, branchunless, lfinish[1]);
}
if (explicit_receiver) {
defined_expr0(iseq, ret, node->nd_recv, lfinish, Qfalse, true);
- switch(nd_type(node->nd_recv)) {
+ switch (nd_type(node->nd_recv)) {
case NODE_CALL:
case NODE_OPCALL:
case NODE_VCALL:
case NODE_FCALL:
case NODE_ATTRASGN:
- ADD_INSNL(ret, line, branchunless, lfinish[2]);
- compile_call(iseq, ret, node->nd_recv, nd_type(node->nd_recv), line, 0, true);
+ ADD_INSNL(ret, line_node, branchunless, lfinish[2]);
+ compile_call(iseq, ret, node->nd_recv, nd_type(node->nd_recv), line_node, 0, true);
break;
default:
- ADD_INSNL(ret, line, branchunless, lfinish[1]);
+ ADD_INSNL(ret, line_node, branchunless, lfinish[1]);
NO_CHECK(COMPILE(ret, "defined/recv", node->nd_recv));
break;
}
if (keep_result) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
}
- ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_METHOD),
+ ADD_INSN3(ret, line_node, defined, INT2FIX(DEFINED_METHOD),
ID2SYM(node->nd_mid), PUSH_VAL(DEFINED_METHOD));
}
else {
- ADD_INSN(ret, line, putself);
+ ADD_INSN(ret, line_node, putself);
if (keep_result) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
}
- ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_FUNC),
+ ADD_INSN3(ret, line_node, defined, INT2FIX(DEFINED_FUNC),
ID2SYM(node->nd_mid), PUSH_VAL(DEFINED_METHOD));
}
return;
}
case NODE_YIELD:
- ADD_INSN(ret, line, putnil);
- ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_YIELD), 0,
+ ADD_INSN(ret, line_node, putnil);
+ ADD_INSN3(ret, line_node, defined, INT2FIX(DEFINED_YIELD), 0,
PUSH_VAL(DEFINED_YIELD));
return;
case NODE_BACK_REF:
case NODE_NTH_REF:
- ADD_INSN(ret, line, putnil);
- ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_REF),
+ ADD_INSN(ret, line_node, putnil);
+ ADD_INSN3(ret, line_node, defined, INT2FIX(DEFINED_REF),
INT2FIX((node->nd_nth << 1) | (type == NODE_BACK_REF)),
PUSH_VAL(DEFINED_GVAR));
return;
case NODE_SUPER:
case NODE_ZSUPER:
- ADD_INSN(ret, line, putnil);
- ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_ZSUPER), 0,
+ ADD_INSN(ret, line_node, putnil);
+ ADD_INSN3(ret, line_node, defined, INT2FIX(DEFINED_ZSUPER), 0,
PUSH_VAL(DEFINED_ZSUPER));
return;
@@ -5083,17 +5285,18 @@ defined_expr0(rb_iseq_t *iseq, LINK_ANCHOR *const ret,
if (needstr != Qfalse) {
VALUE str = rb_iseq_defined_string(expr_type);
- ADD_INSN1(ret, line, putobject, str);
+ ADD_INSN1(ret, line_node, putobject, str);
}
else {
- ADD_INSN1(ret, line, putobject, Qtrue);
+ ADD_INSN1(ret, line_node, putobject, Qtrue);
}
}
static void
build_defined_rescue_iseq(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const void *unused)
{
- ADD_INSN(ret, 0, putnil);
+ NODE dummy_line_node = generate_dummy_line_node(0, -1);
+ ADD_INSN(ret, &dummy_line_node, putnil);
iseq_set_exception_local_table(iseq);
}
@@ -5126,9 +5329,10 @@ static int
compile_defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, VALUE needstr)
{
const int line = nd_line(node);
+ const NODE *line_node = node;
if (!node->nd_head) {
VALUE str = rb_iseq_defined_string(DEFINED_NIL);
- ADD_INSN1(ret, line, putobject, str);
+ ADD_INSN1(ret, line_node, putobject, str);
}
else {
LABEL *lfinish[3];
@@ -5138,12 +5342,12 @@ compile_defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const
lfinish[2] = 0;
defined_expr(iseq, ret, node->nd_head, lfinish, needstr);
if (lfinish[1]) {
- ELEM_INSERT_NEXT(last, &new_insn_body(iseq, line, BIN(putnil), 0)->link);
- ADD_INSN(ret, line, swap);
+ ELEM_INSERT_NEXT(last, &new_insn_body(iseq, line_node, BIN(putnil), 0)->link);
+ ADD_INSN(ret, line_node, swap);
if (lfinish[2]) {
ADD_LABEL(ret, lfinish[2]);
}
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
ADD_LABEL(ret, lfinish[1]);
}
ADD_LABEL(ret, lfinish[0]);
@@ -5203,9 +5407,24 @@ add_ensure_range(rb_iseq_t *iseq, struct ensure_range *erange,
erange->next = ne;
}
+static bool
+can_add_ensure_iseq(const rb_iseq_t *iseq)
+{
+ struct iseq_compile_data_ensure_node_stack *e;
+ if (ISEQ_COMPILE_DATA(iseq)->in_rescue && (e = ISEQ_COMPILE_DATA(iseq)->ensure_node_stack) != NULL) {
+ while (e) {
+ if (e->ensure_node) return false;
+ e = e->prev;
+ }
+ }
+ return true;
+}
+
static void
add_ensure_iseq(LINK_ANCHOR *const ret, rb_iseq_t *iseq, int is_return)
{
+ assert(can_add_ensure_iseq(iseq));
+
struct iseq_compile_data_ensure_node_stack *enlp =
ISEQ_COMPILE_DATA(iseq)->ensure_node_stack;
struct iseq_compile_data_ensure_node_stack *prev_enlp = enlp;
@@ -5261,7 +5480,7 @@ setup_args_core(rb_iseq_t *iseq, LINK_ANCHOR *const args, const NODE *argn,
switch (nd_type(argn)) {
case NODE_SPLAT: {
NO_CHECK(COMPILE(args, "args (splat)", argn->nd_head));
- ADD_INSN1(args, nd_line(argn), splatarray, dup_rest ? Qtrue : Qfalse);
+ ADD_INSN1(args, argn, splatarray, dup_rest ? Qtrue : Qfalse);
if (flag) *flag |= VM_CALL_ARGS_SPLAT;
return INT2FIX(1);
}
@@ -5272,7 +5491,7 @@ setup_args_core(rb_iseq_t *iseq, LINK_ANCHOR *const args, const NODE *argn,
if (nd_type(argn->nd_body) == NODE_LIST) {
/* This branch is needed to avoid "newarraykwsplat" [Bug #16442] */
int rest_len = compile_args(iseq, args, argn->nd_body, NULL, NULL);
- ADD_INSN1(args, nd_line(argn), newarray, INT2FIX(rest_len));
+ ADD_INSN1(args, argn, newarray, INT2FIX(rest_len));
}
else {
NO_CHECK(COMPILE(args, "args (cat: splat)", argn->nd_body));
@@ -5286,18 +5505,18 @@ setup_args_core(rb_iseq_t *iseq, LINK_ANCHOR *const args, const NODE *argn,
}
if (nd_type(argn) == NODE_ARGSCAT) {
if (next_is_list) {
- ADD_INSN1(args, nd_line(argn), splatarray, Qtrue);
+ ADD_INSN1(args, argn, splatarray, Qtrue);
return INT2FIX(FIX2INT(argc) + 1);
}
else {
- ADD_INSN1(args, nd_line(argn), splatarray, Qfalse);
- ADD_INSN(args, nd_line(argn), concatarray);
+ ADD_INSN1(args, argn, splatarray, Qfalse);
+ ADD_INSN(args, argn, concatarray);
return argc;
}
}
else {
- ADD_INSN1(args, nd_line(argn), newarray, INT2FIX(1));
- ADD_INSN(args, nd_line(argn), concatarray);
+ ADD_INSN1(args, argn, newarray, INT2FIX(1));
+ ADD_INSN(args, argn, concatarray);
return argc;
}
}
@@ -5353,8 +5572,8 @@ build_postexe_iseq(rb_iseq_t *iseq, LINK_ANCHOR *ret, const void *ptr)
VALUE argc = INT2FIX(0);
const rb_iseq_t *block = NEW_CHILD_ISEQ(body, make_name_for_block(iseq->body->parent_iseq), ISEQ_TYPE_BLOCK, line);
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_CALL_WITH_BLOCK(ret, line, id_core_set_postexe, argc, block);
+ ADD_INSN1(ret, body, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_CALL_WITH_BLOCK(ret, body, id_core_set_postexe, argc, block);
RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)block);
iseq_set_local_table(iseq, 0);
}
@@ -5365,25 +5584,26 @@ compile_named_capture_assign(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE
const NODE *vars;
LINK_ELEMENT *last;
int line = nd_line(node);
+ const NODE *line_node = node;
LABEL *fail_label = NEW_LABEL(line), *end_label = NEW_LABEL(line);
#if !(defined(NAMED_CAPTURE_BY_SVAR) && NAMED_CAPTURE_BY_SVAR-0)
- ADD_INSN1(ret, line, getglobal, ID2SYM(idBACKREF));
+ ADD_INSN1(ret, line_node, getglobal, ID2SYM(idBACKREF));
#else
- ADD_INSN2(ret, line, getspecial, INT2FIX(1) /* '~' */, INT2FIX(0));
+ ADD_INSN2(ret, line_node, getspecial, INT2FIX(1) /* '~' */, INT2FIX(0));
#endif
- ADD_INSN(ret, line, dup);
- ADD_INSNL(ret, line, branchunless, fail_label);
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSNL(ret, line_node, branchunless, fail_label);
for (vars = node; vars; vars = vars->nd_next) {
INSN *cap;
if (vars->nd_next) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
}
last = ret->last;
NO_CHECK(COMPILE_POPPED(ret, "capture", vars->nd_head));
last = last->next; /* putobject :var */
- cap = new_insn_send(iseq, line, idAREF, INT2FIX(1),
+ cap = new_insn_send(iseq, line_node, idAREF, INT2FIX(1),
NULL, INT2FIX(0), NULL);
ELEM_INSERT_PREV(last->next, (LINK_ELEMENT *)cap);
#if !defined(NAMED_CAPTURE_SINGLE_OPT) || NAMED_CAPTURE_SINGLE_OPT-0
@@ -5392,11 +5612,11 @@ compile_named_capture_assign(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE
DECL_ANCHOR(nom);
INIT_ANCHOR(nom);
- ADD_INSNL(nom, line, jump, end_label);
+ ADD_INSNL(nom, line_node, jump, end_label);
ADD_LABEL(nom, fail_label);
# if 0 /* $~ must be MatchData or nil */
- ADD_INSN(nom, line, pop);
- ADD_INSN(nom, line, putnil);
+ ADD_INSN(nom, line_node, pop);
+ ADD_INSN(nom, line_node, putnil);
# endif
ADD_LABEL(nom, end_label);
(nom->last->next = cap->link.next)->prev = nom->last;
@@ -5405,9 +5625,9 @@ compile_named_capture_assign(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE
}
#endif
}
- ADD_INSNL(ret, line, jump, end_label);
+ ADD_INSNL(ret, line_node, jump, end_label);
ADD_LABEL(ret, fail_label);
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
for (vars = node; vars; vars = vars->nd_next) {
last = ret->last;
NO_CHECK(COMPILE_POPPED(ret, "capture", vars->nd_head));
@@ -5440,6 +5660,7 @@ compile_if(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int
const NODE *const node_else = type == NODE_IF ? node->nd_else : node->nd_body;
const int line = nd_line(node);
+ const NODE *line_node = node;
DECL_ANCHOR(cond_seq);
DECL_ANCHOR(then_seq);
DECL_ANCHOR(else_seq);
@@ -5498,9 +5719,9 @@ compile_if(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int
type == NODE_IF ? "then" : "else",
branches);
end_label = NEW_LABEL(line);
- ADD_INSNL(then_seq, line, jump, end_label);
+ ADD_INSNL(then_seq, line_node, jump, end_label);
if (!popped) {
- ADD_INSN(then_seq, line, pop);
+ ADD_INSN(then_seq, line_node, pop);
}
}
ADD_SEQ(ret, then_seq);
@@ -5540,6 +5761,7 @@ compile_case(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_nod
VALUE literals = rb_hash_new();
int line;
enum node_type type;
+ const NODE *line_node;
VALUE branches = Qfalse;
int branch_id = 0;
@@ -5557,6 +5779,7 @@ compile_case(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_nod
EXPECT_NODE("NODE_CASE", node, NODE_WHEN, COMPILE_NG);
type = nd_type(node);
line = nd_line(node);
+ line_node = node;
endlabel = NEW_LABEL(line);
elselabel = NEW_LABEL(line);
@@ -5568,7 +5791,7 @@ compile_case(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_nod
l1 = NEW_LABEL(line);
ADD_LABEL(body_seq, l1);
- ADD_INSN(body_seq, line, pop);
+ ADD_INSN(body_seq, line_node, pop);
add_trace_branch_coverage(
iseq,
body_seq,
@@ -5577,7 +5800,7 @@ compile_case(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_nod
"when",
branches);
CHECK(COMPILE_(body_seq, "when body", node->nd_body, popped));
- ADD_INSNL(body_seq, line, jump, endlabel);
+ ADD_INSNL(body_seq, line_node, jump, endlabel);
vals = node->nd_head;
if (vals) {
@@ -5606,29 +5829,30 @@ compile_case(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_nod
}
type = nd_type(node);
line = nd_line(node);
+ line_node = node;
}
/* else */
if (node) {
ADD_LABEL(cond_seq, elselabel);
- ADD_INSN(cond_seq, line, pop);
+ ADD_INSN(cond_seq, line_node, pop);
add_trace_branch_coverage(iseq, cond_seq, node, branch_id, "else", branches);
CHECK(COMPILE_(cond_seq, "else", node, popped));
- ADD_INSNL(cond_seq, line, jump, endlabel);
+ ADD_INSNL(cond_seq, line_node, jump, endlabel);
}
else {
debugs("== else (implicit)\n");
ADD_LABEL(cond_seq, elselabel);
- ADD_INSN(cond_seq, nd_line(orig_node), pop);
+ ADD_INSN(cond_seq, orig_node, pop);
add_trace_branch_coverage(iseq, cond_seq, orig_node, branch_id, "else", branches);
if (!popped) {
- ADD_INSN(cond_seq, nd_line(orig_node), putnil);
+ ADD_INSN(cond_seq, orig_node, putnil);
}
- ADD_INSNL(cond_seq, nd_line(orig_node), jump, endlabel);
+ ADD_INSNL(cond_seq, orig_node, jump, endlabel);
}
if (only_special_literals && ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) {
- ADD_INSN(ret, nd_line(orig_node), dup);
- ADD_INSN2(ret, nd_line(orig_node), opt_case_dispatch, literals, elselabel);
+ ADD_INSN(ret, orig_node, dup);
+ ADD_INSN2(ret, orig_node, opt_case_dispatch, literals, elselabel);
RB_OBJ_WRITTEN(iseq, Qundef, literals);
LABEL_REF(elselabel);
}
@@ -5667,7 +5891,7 @@ compile_case2(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
"when",
branches);
CHECK(COMPILE_(body_seq, "when", node->nd_body, popped));
- ADD_INSNL(body_seq, line, jump, endlabel);
+ ADD_INSNL(body_seq, node, jump, endlabel);
vals = node->nd_head;
if (!vals) {
@@ -5688,10 +5912,10 @@ compile_case2(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
case NODE_SPLAT:
case NODE_ARGSCAT:
case NODE_ARGSPUSH:
- ADD_INSN(ret, nd_line(vals), putnil);
+ ADD_INSN(ret, vals, putnil);
CHECK(COMPILE(ret, "when2/cond splat", vals));
- ADD_INSN1(ret, nd_line(vals), checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_WHEN | VM_CHECKMATCH_ARRAY));
- ADD_INSNL(ret, nd_line(vals), branchif, l1);
+ ADD_INSN1(ret, vals, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_WHEN | VM_CHECKMATCH_ARRAY));
+ ADD_INSNL(ret, vals, branchif, l1);
break;
default:
UNKNOWN_NODE("NODE_WHEN", vals, COMPILE_NG);
@@ -5707,7 +5931,7 @@ compile_case2(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
"else",
branches);
CHECK(COMPILE_(ret, "else", node, popped));
- ADD_INSNL(ret, nd_line(orig_node), jump, endlabel);
+ ADD_INSNL(ret, orig_node, jump, endlabel);
ADD_SEQ(ret, body_seq);
ADD_LABEL(ret, endlabel);
@@ -5722,6 +5946,7 @@ static int
iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, LABEL *matched, LABEL *unmatched, int in_alt_pattern, int deconstructed_pos)
{
const int line = nd_line(node);
+ const NODE *line_node = node;
switch (nd_type(node)) {
case NODE_ARYPTN: {
@@ -5794,97 +6019,97 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c
deconstructed = NEW_LABEL(line);
if (use_rest_num) {
- ADD_INSN1(ret, line, putobject, INT2FIX(0)); /* allocate stack for rest_num */
- ADD_INSN(ret, line, swap);
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(0)); /* allocate stack for rest_num */
+ ADD_INSN(ret, line_node, swap);
if (deconstructed_pos) {
deconstructed_pos++;
}
}
if (node->nd_pconst) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
CHECK(COMPILE(ret, "constant", node->nd_pconst));
- ADD_INSN1(ret, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE));
- ADD_INSNL(ret, line, branchunless, match_failed);
+ ADD_INSN1(ret, line_node, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE));
+ ADD_INSNL(ret, line_node, branchunless, match_failed);
}
CHECK(iseq_compile_array_deconstruct(iseq, ret, node, deconstruct, deconstructed, match_failed, type_error, deconstructed_pos));
- ADD_INSN(ret, line, dup);
- ADD_SEND(ret, line, idLength, INT2FIX(0));
- ADD_INSN1(ret, line, putobject, INT2FIX(min_argc));
- ADD_SEND(ret, line, apinfo->rest_arg ? idGE : idEq, INT2FIX(1));
- ADD_INSNL(ret, line, branchunless, match_failed);
+ ADD_INSN(ret, line_node, dup);
+ ADD_SEND(ret, line_node, idLength, INT2FIX(0));
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(min_argc));
+ ADD_SEND(ret, line_node, apinfo->rest_arg ? idGE : idEq, INT2FIX(1));
+ ADD_INSNL(ret, line_node, branchunless, match_failed);
for (i = 0; i < pre_args_num; i++) {
- ADD_INSN(ret, line, dup);
- ADD_INSN1(ret, line, putobject, INT2FIX(i));
- ADD_SEND(ret, line, idAREF, INT2FIX(1));
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(i));
+ ADD_SEND(ret, line_node, idAREF, INT2FIX(1));
CHECK(iseq_compile_pattern_match(iseq, ret, args->nd_head, match_failed, in_alt_pattern, FALSE));
args = args->nd_next;
}
if (apinfo->rest_arg) {
if (NODE_NAMED_REST_P(apinfo->rest_arg)) {
- ADD_INSN(ret, line, dup);
- ADD_INSN1(ret, line, putobject, INT2FIX(pre_args_num));
- ADD_INSN1(ret, line, topn, INT2FIX(1));
- ADD_SEND(ret, line, idLength, INT2FIX(0));
- ADD_INSN1(ret, line, putobject, INT2FIX(min_argc));
- ADD_SEND(ret, line, idMINUS, INT2FIX(1));
- ADD_INSN1(ret, line, setn, INT2FIX(4));
- ADD_SEND(ret, line, idAREF, INT2FIX(2));
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(pre_args_num));
+ ADD_INSN1(ret, line_node, topn, INT2FIX(1));
+ ADD_SEND(ret, line_node, idLength, INT2FIX(0));
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(min_argc));
+ ADD_SEND(ret, line_node, idMINUS, INT2FIX(1));
+ ADD_INSN1(ret, line_node, setn, INT2FIX(4));
+ ADD_SEND(ret, line_node, idAREF, INT2FIX(2));
CHECK(iseq_compile_pattern_match(iseq, ret, apinfo->rest_arg, match_failed, in_alt_pattern, FALSE));
}
else {
if (post_args_num > 0) {
- ADD_INSN(ret, line, dup);
- ADD_SEND(ret, line, idLength, INT2FIX(0));
- ADD_INSN1(ret, line, putobject, INT2FIX(min_argc));
- ADD_SEND(ret, line, idMINUS, INT2FIX(1));
- ADD_INSN1(ret, line, setn, INT2FIX(2));
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, dup);
+ ADD_SEND(ret, line_node, idLength, INT2FIX(0));
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(min_argc));
+ ADD_SEND(ret, line_node, idMINUS, INT2FIX(1));
+ ADD_INSN1(ret, line_node, setn, INT2FIX(2));
+ ADD_INSN(ret, line_node, pop);
}
}
}
args = apinfo->post_args;
for (i = 0; i < post_args_num; i++) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
- ADD_INSN1(ret, line, putobject, INT2FIX(pre_args_num + i));
- ADD_INSN1(ret, line, topn, INT2FIX(3));
- ADD_SEND(ret, line, idPLUS, INT2FIX(1));
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(pre_args_num + i));
+ ADD_INSN1(ret, line_node, topn, INT2FIX(3));
+ ADD_SEND(ret, line_node, idPLUS, INT2FIX(1));
- ADD_SEND(ret, line, idAREF, INT2FIX(1));
+ ADD_SEND(ret, line_node, idAREF, INT2FIX(1));
CHECK(iseq_compile_pattern_match(iseq, ret, args->nd_head, match_failed, in_alt_pattern, FALSE));
args = args->nd_next;
}
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
if (use_rest_num) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
- ADD_INSNL(ret, line, jump, matched);
- ADD_INSN(ret, line, putnil);
+ ADD_INSNL(ret, line_node, jump, matched);
+ ADD_INSN(ret, line_node, putnil);
if (use_rest_num) {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
}
ADD_LABEL(ret, type_error);
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN1(ret, line, putobject, rb_eTypeError);
- ADD_INSN1(ret, line, putobject, rb_fstring_lit("deconstruct must return Array"));
- ADD_SEND(ret, line, id_core_raise, INT2FIX(2));
- ADD_INSN(ret, line, pop);
+ ADD_INSN1(ret, line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN1(ret, line_node, putobject, rb_eTypeError);
+ ADD_INSN1(ret, line_node, putobject, rb_fstring_lit("deconstruct must return Array"));
+ ADD_SEND(ret, line_node, id_core_raise, INT2FIX(2));
+ ADD_INSN(ret, line_node, pop);
ADD_LABEL(ret, match_failed);
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
if (use_rest_num) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
- ADD_INSNL(ret, line, jump, unmatched);
+ ADD_INSNL(ret, line_node, jump, unmatched);
break;
}
@@ -5948,19 +6173,19 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c
deconstructed = NEW_LABEL(line);
if (node->nd_pconst) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
CHECK(COMPILE(ret, "constant", node->nd_pconst));
- ADD_INSN1(ret, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE));
- ADD_INSNL(ret, line, branchunless, match_failed);
+ ADD_INSN1(ret, line_node, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE));
+ ADD_INSNL(ret, line_node, branchunless, match_failed);
}
CHECK(iseq_compile_array_deconstruct(iseq, ret, node, deconstruct, deconstructed, match_failed, type_error, deconstructed_pos));
- ADD_INSN(ret, line, dup);
- ADD_SEND(ret, line, idLength, INT2FIX(0));
- ADD_INSN1(ret, line, putobject, INT2FIX(args_num));
- ADD_SEND(ret, line, idGE, INT2FIX(1));
- ADD_INSNL(ret, line, branchunless, match_failed);
+ ADD_INSN(ret, line_node, dup);
+ ADD_SEND(ret, line_node, idLength, INT2FIX(0));
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(args_num));
+ ADD_SEND(ret, line_node, idGE, INT2FIX(1));
+ ADD_INSNL(ret, line_node, branchunless, match_failed);
{
LABEL *while_begin = NEW_LABEL(nd_line(node));
@@ -5969,85 +6194,85 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c
LABEL *find_failed = NEW_LABEL(nd_line(node));
int j;
- ADD_INSN(ret, line, dup); /* allocate stack for len */
- ADD_SEND(ret, line, idLength, INT2FIX(0));
+ ADD_INSN(ret, line_node, dup); /* allocate stack for len */
+ ADD_SEND(ret, line_node, idLength, INT2FIX(0));
- ADD_INSN(ret, line, dup); /* allocate stack for limit */
- ADD_INSN1(ret, line, putobject, INT2FIX(args_num));
- ADD_SEND(ret, line, idMINUS, INT2FIX(1));
+ ADD_INSN(ret, line_node, dup); /* allocate stack for limit */
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(args_num));
+ ADD_SEND(ret, line_node, idMINUS, INT2FIX(1));
- ADD_INSN1(ret, line, putobject, INT2FIX(0)); /* allocate stack for i */
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(0)); /* allocate stack for i */
ADD_LABEL(ret, while_begin);
- ADD_INSN(ret, line, dup);
- ADD_INSN1(ret, line, topn, INT2FIX(2));
- ADD_SEND(ret, line, idLE, INT2FIX(1));
- ADD_INSNL(ret, line, branchunless, find_failed);
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSN1(ret, line_node, topn, INT2FIX(2));
+ ADD_SEND(ret, line_node, idLE, INT2FIX(1));
+ ADD_INSNL(ret, line_node, branchunless, find_failed);
for (j = 0; j < args_num; j++) {
- ADD_INSN1(ret, line, topn, INT2FIX(3));
- ADD_INSN1(ret, line, topn, INT2FIX(1));
+ ADD_INSN1(ret, line_node, topn, INT2FIX(3));
+ ADD_INSN1(ret, line_node, topn, INT2FIX(1));
if (j != 0) {
- ADD_INSN1(ret, line, putobject, INT2FIX(j));
- ADD_SEND(ret, line, idPLUS, INT2FIX(1));
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(j));
+ ADD_SEND(ret, line_node, idPLUS, INT2FIX(1));
}
- ADD_SEND(ret, line, idAREF, INT2FIX(1));
+ ADD_SEND(ret, line_node, idAREF, INT2FIX(1));
CHECK(iseq_compile_pattern_match(iseq, ret, args->nd_head, next_loop, in_alt_pattern, FALSE));
args = args->nd_next;
}
if (NODE_NAMED_REST_P(fpinfo->pre_rest_arg)) {
- ADD_INSN1(ret, line, topn, INT2FIX(3));
- ADD_INSN1(ret, line, putobject, INT2FIX(0));
- ADD_INSN1(ret, line, topn, INT2FIX(2));
- ADD_SEND(ret, line, idAREF, INT2FIX(2));
+ ADD_INSN1(ret, line_node, topn, INT2FIX(3));
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(0));
+ ADD_INSN1(ret, line_node, topn, INT2FIX(2));
+ ADD_SEND(ret, line_node, idAREF, INT2FIX(2));
CHECK(iseq_compile_pattern_match(iseq, ret, fpinfo->pre_rest_arg, find_failed, in_alt_pattern, FALSE));
}
if (NODE_NAMED_REST_P(fpinfo->post_rest_arg)) {
- ADD_INSN1(ret, line, topn, INT2FIX(3));
- ADD_INSN1(ret, line, topn, INT2FIX(1));
- ADD_INSN1(ret, line, putobject, INT2FIX(args_num));
- ADD_SEND(ret, line, idPLUS, INT2FIX(1));
- ADD_INSN1(ret, line, topn, INT2FIX(3));
- ADD_SEND(ret, line, idAREF, INT2FIX(2));
+ ADD_INSN1(ret, line_node, topn, INT2FIX(3));
+ ADD_INSN1(ret, line_node, topn, INT2FIX(1));
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(args_num));
+ ADD_SEND(ret, line_node, idPLUS, INT2FIX(1));
+ ADD_INSN1(ret, line_node, topn, INT2FIX(3));
+ ADD_SEND(ret, line_node, idAREF, INT2FIX(2));
CHECK(iseq_compile_pattern_match(iseq, ret, fpinfo->post_rest_arg, find_failed, in_alt_pattern, FALSE));
}
- ADD_INSNL(ret, line, jump, find_succeeded);
+ ADD_INSNL(ret, line_node, jump, find_succeeded);
ADD_LABEL(ret, next_loop);
- ADD_INSN1(ret, line, putobject, INT2FIX(1));
- ADD_SEND(ret, line, idPLUS, INT2FIX(1));
- ADD_INSNL(ret, line, jump, while_begin);
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(1));
+ ADD_SEND(ret, line_node, idPLUS, INT2FIX(1));
+ ADD_INSNL(ret, line_node, jump, while_begin);
ADD_LABEL(ret, find_failed);
- ADD_INSN(ret, line, pop);
- ADD_INSN(ret, line, pop);
- ADD_INSN(ret, line, pop);
- ADD_INSNL(ret, line, jump, match_failed);
- ADD_INSN1(ret, line, dupn, INT2FIX(3));
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSNL(ret, line_node, jump, match_failed);
+ ADD_INSN1(ret, line_node, dupn, INT2FIX(3));
ADD_LABEL(ret, find_succeeded);
- ADD_INSN(ret, line, pop);
- ADD_INSN(ret, line, pop);
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSN(ret, line_node, pop);
}
- ADD_INSN(ret, line, pop);
- ADD_INSNL(ret, line, jump, matched);
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSNL(ret, line_node, jump, matched);
+ ADD_INSN(ret, line_node, putnil);
ADD_LABEL(ret, type_error);
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN1(ret, line, putobject, rb_eTypeError);
- ADD_INSN1(ret, line, putobject, rb_fstring_lit("deconstruct must return Array"));
- ADD_SEND(ret, line, id_core_raise, INT2FIX(2));
- ADD_INSN(ret, line, pop);
+ ADD_INSN1(ret, line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN1(ret, line_node, putobject, rb_eTypeError);
+ ADD_INSN1(ret, line_node, putobject, rb_fstring_lit("deconstruct must return Array"));
+ ADD_SEND(ret, line_node, id_core_raise, INT2FIX(2));
+ ADD_INSN(ret, line_node, pop);
ADD_LABEL(ret, match_failed);
- ADD_INSN(ret, line, pop);
- ADD_INSNL(ret, line, jump, unmatched);
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSNL(ret, line_node, jump, unmatched);
break;
}
@@ -6127,32 +6352,32 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c
}
if (node->nd_pconst) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
CHECK(COMPILE(ret, "constant", node->nd_pconst));
- ADD_INSN1(ret, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE));
- ADD_INSNL(ret, line, branchunless, match_failed);
+ ADD_INSN1(ret, line_node, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE));
+ ADD_INSNL(ret, line_node, branchunless, match_failed);
}
- ADD_INSN(ret, line, dup);
- ADD_INSN1(ret, line, putobject, ID2SYM(rb_intern("deconstruct_keys")));
- ADD_SEND(ret, line, idRespond_to, INT2FIX(1));
- ADD_INSNL(ret, line, branchunless, match_failed);
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSN1(ret, line_node, putobject, ID2SYM(rb_intern("deconstruct_keys")));
+ ADD_SEND(ret, line_node, idRespond_to, INT2FIX(1));
+ ADD_INSNL(ret, line_node, branchunless, match_failed);
if (NIL_P(keys)) {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
}
else {
- ADD_INSN1(ret, line, duparray, keys);
+ ADD_INSN1(ret, line_node, duparray, keys);
RB_OBJ_WRITTEN(iseq, Qundef, rb_obj_hide(keys));
}
- ADD_SEND(ret, line, rb_intern("deconstruct_keys"), INT2FIX(1));
+ ADD_SEND(ret, line_node, rb_intern("deconstruct_keys"), INT2FIX(1));
- ADD_INSN(ret, line, dup);
- ADD_INSN1(ret, line, checktype, INT2FIX(T_HASH));
- ADD_INSNL(ret, line, branchunless, type_error);
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSN1(ret, line_node, checktype, INT2FIX(T_HASH));
+ ADD_INSNL(ret, line_node, branchunless, type_error);
if (node->nd_pkwrestarg) {
- ADD_SEND(ret, line, rb_intern("dup"), INT2FIX(0));
+ ADD_SEND(ret, line_node, rb_intern("dup"), INT2FIX(0));
}
if (node->nd_pkwargs) {
@@ -6174,14 +6399,14 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c
}
key = key_node->nd_lit;
- ADD_INSN(ret, line, dup);
- ADD_INSN1(ret, line, putobject, key);
- ADD_SEND(ret, line, rb_intern("key?"), INT2FIX(1));
- ADD_INSNL(ret, line, branchunless, match_failed);
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSN1(ret, line_node, putobject, key);
+ ADD_SEND(ret, line_node, rb_intern("key?"), INT2FIX(1));
+ ADD_INSNL(ret, line_node, branchunless, match_failed);
- ADD_INSN(match_values, line, dup);
- ADD_INSN1(match_values, line, putobject, key);
- ADD_SEND(match_values, line, node->nd_pkwrestarg ? rb_intern("delete") : idAREF, INT2FIX(1));
+ ADD_INSN(match_values, line_node, dup);
+ ADD_INSN1(match_values, line_node, putobject, key);
+ ADD_SEND(match_values, line_node, node->nd_pkwrestarg ? rb_intern("delete") : idAREF, INT2FIX(1));
CHECK(iseq_compile_pattern_match(iseq, match_values, value_node, match_failed, in_alt_pattern, FALSE));
args = args->nd_next->nd_next;
}
@@ -6189,37 +6414,37 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c
}
}
else {
- ADD_INSN(ret, line, dup);
- ADD_SEND(ret, line, idEmptyP, INT2FIX(0));
- ADD_INSNL(ret, line, branchunless, match_failed);
+ ADD_INSN(ret, line_node, dup);
+ ADD_SEND(ret, line_node, idEmptyP, INT2FIX(0));
+ ADD_INSNL(ret, line_node, branchunless, match_failed);
}
if (node->nd_pkwrestarg) {
if (node->nd_pkwrestarg == NODE_SPECIAL_NO_REST_KEYWORD) {
- ADD_INSN(ret, line, dup);
- ADD_SEND(ret, line, idEmptyP, INT2FIX(0));
- ADD_INSNL(ret, line, branchunless, match_failed);
+ ADD_INSN(ret, line_node, dup);
+ ADD_SEND(ret, line_node, idEmptyP, INT2FIX(0));
+ ADD_INSNL(ret, line_node, branchunless, match_failed);
}
else {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
CHECK(iseq_compile_pattern_match(iseq, ret, node->nd_pkwrestarg, match_failed, in_alt_pattern, FALSE));
}
}
- ADD_INSN(ret, line, pop);
- ADD_INSNL(ret, line, jump, matched);
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSNL(ret, line_node, jump, matched);
+ ADD_INSN(ret, line_node, putnil);
ADD_LABEL(ret, type_error);
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN1(ret, line, putobject, rb_eTypeError);
- ADD_INSN1(ret, line, putobject, rb_fstring_lit("deconstruct_keys must return Hash"));
- ADD_SEND(ret, line, id_core_raise, INT2FIX(2));
- ADD_INSN(ret, line, pop);
+ ADD_INSN1(ret, line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN1(ret, line_node, putobject, rb_eTypeError);
+ ADD_INSN1(ret, line_node, putobject, rb_fstring_lit("deconstruct_keys must return Hash"));
+ ADD_SEND(ret, line_node, id_core_raise, INT2FIX(2));
+ ADD_INSN(ret, line_node, pop);
ADD_LABEL(ret, match_failed);
- ADD_INSN(ret, line, pop);
- ADD_INSNL(ret, line, jump, unmatched);
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSNL(ret, line_node, jump, unmatched);
break;
}
case NODE_LIT:
@@ -6244,9 +6469,9 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c
case NODE_COLON3:
case NODE_BEGIN:
CHECK(COMPILE(ret, "case in literal", node));
- ADD_INSN1(ret, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE));
- ADD_INSNL(ret, line, branchif, matched);
- ADD_INSNL(ret, line, jump, unmatched);
+ ADD_INSN1(ret, line_node, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_CASE));
+ ADD_INSNL(ret, line_node, branchif, matched);
+ ADD_INSNL(ret, line_node, jump, unmatched);
break;
case NODE_LASGN: {
struct rb_iseq_constant_body *const body = iseq->body;
@@ -6262,8 +6487,8 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c
}
}
- ADD_SETLOCAL(ret, line, idx, get_lvar_level(iseq));
- ADD_INSNL(ret, line, jump, matched);
+ ADD_SETLOCAL(ret, line_node, idx, get_lvar_level(iseq));
+ ADD_INSNL(ret, line_node, jump, matched);
break;
}
case NODE_DASGN:
@@ -6287,8 +6512,8 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c
rb_id2str(id));
return COMPILE_NG;
}
- ADD_SETLOCAL(ret, line, ls - idx, lv);
- ADD_INSNL(ret, line, jump, matched);
+ ADD_SETLOCAL(ret, line_node, ls - idx, lv);
+ ADD_INSNL(ret, line_node, jump, matched);
break;
}
case NODE_IF:
@@ -6298,12 +6523,12 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c
CHECK(iseq_compile_pattern_match(iseq, ret, node->nd_body, unmatched, in_alt_pattern, deconstructed_pos));
CHECK(COMPILE(ret, "case in if", node->nd_cond));
if (nd_type(node) == NODE_IF) {
- ADD_INSNL(ret, line, branchunless, match_failed);
+ ADD_INSNL(ret, line_node, branchunless, match_failed);
}
else {
- ADD_INSNL(ret, line, branchif, match_failed);
+ ADD_INSNL(ret, line_node, branchif, match_failed);
}
- ADD_INSNL(ret, line, jump, matched);
+ ADD_INSNL(ret, line_node, jump, matched);
break;
}
case NODE_HASH: {
@@ -6317,14 +6542,14 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c
return COMPILE_NG;
}
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
CHECK(iseq_compile_pattern_match(iseq, ret, n->nd_head, match_failed, in_alt_pattern, deconstructed_pos ? deconstructed_pos + 1 : FALSE));
CHECK(iseq_compile_pattern_each(iseq, ret, n->nd_next->nd_head, matched, match_failed, in_alt_pattern, FALSE));
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
ADD_LABEL(ret, match_failed);
- ADD_INSN(ret, line, pop);
- ADD_INSNL(ret, line, jump, unmatched);
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSNL(ret, line_node, jump, unmatched);
break;
}
case NODE_OR: {
@@ -6332,12 +6557,12 @@ iseq_compile_pattern_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *c
match_succeeded = NEW_LABEL(line);
fin = NEW_LABEL(line);
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
CHECK(iseq_compile_pattern_each(iseq, ret, node->nd_1st, match_succeeded, fin, TRUE, deconstructed_pos ? deconstructed_pos + 1 : FALSE));
ADD_LABEL(ret, match_succeeded);
- ADD_INSN(ret, line, pop);
- ADD_INSNL(ret, line, jump, matched);
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSNL(ret, line_node, jump, matched);
+ ADD_INSN(ret, line_node, putnil);
ADD_LABEL(ret, fin);
CHECK(iseq_compile_pattern_each(iseq, ret, node->nd_2nd, matched, unmatched, TRUE, deconstructed_pos));
break;
@@ -6360,7 +6585,7 @@ iseq_compile_pattern_match(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *
static int
iseq_compile_array_deconstruct(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, LABEL *deconstruct, LABEL *deconstructed, LABEL *match_failed, LABEL *type_error, int deconstructed_pos)
{
- const int line = nd_line(node);
+ const NODE *line_node = node;
// NOTE: this optimization allows us to re-use the #deconstruct value
// (or its absence).
@@ -6368,45 +6593,45 @@ iseq_compile_array_deconstruct(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NO
// where the value is stored.
if (deconstructed_pos) {
// If value is nil then we haven't tried to deconstruct
- ADD_INSN1(ret, line, topn, INT2FIX(deconstructed_pos));
- ADD_INSNL(ret, line, branchnil, deconstruct);
+ ADD_INSN1(ret, line_node, topn, INT2FIX(deconstructed_pos));
+ ADD_INSNL(ret, line_node, branchnil, deconstruct);
// If false then the value is not deconstructable
- ADD_INSN1(ret, line, topn, INT2FIX(deconstructed_pos));
- ADD_INSNL(ret, line, branchunless, match_failed);
+ ADD_INSN1(ret, line_node, topn, INT2FIX(deconstructed_pos));
+ ADD_INSNL(ret, line_node, branchunless, match_failed);
// Drop value, add deconstructed to the stack and jump
- ADD_INSN(ret, line, pop);
- ADD_INSN1(ret, line, topn, INT2FIX(deconstructed_pos - 1));
- ADD_INSNL(ret, line, jump, deconstructed);
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSN1(ret, line_node, topn, INT2FIX(deconstructed_pos - 1));
+ ADD_INSNL(ret, line_node, jump, deconstructed);
}
else {
- ADD_INSNL(ret, line, jump, deconstruct);
+ ADD_INSNL(ret, line_node, jump, deconstruct);
}
ADD_LABEL(ret, deconstruct);
- ADD_INSN(ret, line, dup);
- ADD_INSN1(ret, line, putobject, ID2SYM(rb_intern("deconstruct")));
- ADD_SEND(ret, line, idRespond_to, INT2FIX(1));
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSN1(ret, line_node, putobject, ID2SYM(rb_intern("deconstruct")));
+ ADD_SEND(ret, line_node, idRespond_to, INT2FIX(1));
// Cache the result of respond_to? (in case it's false is stays there, if true - it's overwritten after #deconstruct)
if (deconstructed_pos) {
- ADD_INSN1(ret, line, setn, INT2FIX(deconstructed_pos + 1));
+ ADD_INSN1(ret, line_node, setn, INT2FIX(deconstructed_pos + 1));
}
- ADD_INSNL(ret, line, branchunless, match_failed);
+ ADD_INSNL(ret, line_node, branchunless, match_failed);
- ADD_SEND(ret, line, rb_intern("deconstruct"), INT2FIX(0));
+ ADD_SEND(ret, line_node, rb_intern("deconstruct"), INT2FIX(0));
// Cache the result (if it's cacheable - currently, only top-level array patterns)
if (deconstructed_pos) {
- ADD_INSN1(ret, line, setn, INT2FIX(deconstructed_pos));
+ ADD_INSN1(ret, line_node, setn, INT2FIX(deconstructed_pos));
}
- ADD_INSN(ret, line, dup);
- ADD_INSN1(ret, line, checktype, INT2FIX(T_ARRAY));
- ADD_INSNL(ret, line, branchunless, type_error);
- ADD_INSNL(ret, line, jump, deconstructed);
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSN1(ret, line_node, checktype, INT2FIX(T_ARRAY));
+ ADD_INSNL(ret, line_node, branchunless, type_error);
+ ADD_INSNL(ret, line_node, jump, deconstructed);
ADD_LABEL(ret, deconstructed);
@@ -6424,6 +6649,7 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
DECL_ANCHOR(cond_seq);
int line;
enum node_type type;
+ const NODE *line_node;
VALUE branches = 0;
int branch_id = 0;
@@ -6437,11 +6663,12 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
EXPECT_NODE("NODE_CASE3", node, NODE_IN, COMPILE_NG);
type = nd_type(node);
line = nd_line(node);
+ line_node = node;
endlabel = NEW_LABEL(line);
elselabel = NEW_LABEL(line);
- ADD_INSN(head, line, putnil); /* allocate stack for cached #deconstruct value */
+ ADD_INSN(head, line_node, putnil); /* allocate stack for cached #deconstruct value */
CHECK(COMPILE(head, "case base", orig_node->nd_head));
@@ -6451,12 +6678,12 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
LABEL *l1;
if (branch_id) {
- ADD_INSN(body_seq, line, putnil);
+ ADD_INSN(body_seq, line_node, putnil);
}
l1 = NEW_LABEL(line);
ADD_LABEL(body_seq, l1);
- ADD_INSN(body_seq, line, pop);
- ADD_INSN(body_seq, line, pop); /* discard cached #deconstruct value */
+ ADD_INSN(body_seq, line_node, pop);
+ ADD_INSN(body_seq, line_node, pop); /* discard cached #deconstruct value */
add_trace_branch_coverage(
iseq,
body_seq,
@@ -6465,13 +6692,13 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
"in",
branches);
CHECK(COMPILE_(body_seq, "in body", node->nd_body, popped));
- ADD_INSNL(body_seq, line, jump, endlabel);
+ ADD_INSNL(body_seq, line_node, jump, endlabel);
pattern = node->nd_head;
if (pattern) {
int pat_line = nd_line(pattern);
LABEL *next_pat = NEW_LABEL(pat_line);
- ADD_INSN (cond_seq, pat_line, dup);
+ ADD_INSN (cond_seq, pattern, dup);
// NOTE: set deconstructed_pos to the current cached value location
// (it's "under" the matchee value, so it's position is 2)
CHECK(iseq_compile_pattern_each(iseq, cond_seq, pattern, l1, next_pat, FALSE, 2));
@@ -6489,38 +6716,39 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
}
type = nd_type(node);
line = nd_line(node);
+ line_node = node;
}
/* else */
if (node) {
ADD_LABEL(cond_seq, elselabel);
- ADD_INSN(cond_seq, line, pop);
- ADD_INSN(cond_seq, line, pop); /* discard cached #deconstruct value */
+ ADD_INSN(cond_seq, line_node, pop);
+ ADD_INSN(cond_seq, line_node, pop); /* discard cached #deconstruct value */
add_trace_branch_coverage(iseq, cond_seq, node, branch_id, "else", branches);
CHECK(COMPILE_(cond_seq, "else", node, popped));
- ADD_INSNL(cond_seq, line, jump, endlabel);
- ADD_INSN(cond_seq, line, putnil);
+ ADD_INSNL(cond_seq, line_node, jump, endlabel);
+ ADD_INSN(cond_seq, line_node, putnil);
if (popped) {
- ADD_INSN(cond_seq, line, putnil);
+ ADD_INSN(cond_seq, line_node, putnil);
}
}
else {
debugs("== else (implicit)\n");
ADD_LABEL(cond_seq, elselabel);
add_trace_branch_coverage(iseq, cond_seq, orig_node, branch_id, "else", branches);
- ADD_INSN1(cond_seq, nd_line(orig_node), putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN1(cond_seq, nd_line(orig_node), putobject, rb_eNoMatchingPatternError);
- ADD_INSN1(cond_seq, nd_line(orig_node), topn, INT2FIX(2));
- ADD_SEND(cond_seq, nd_line(orig_node), id_core_raise, INT2FIX(2));
- ADD_INSN(cond_seq, nd_line(orig_node), pop);
- ADD_INSN(cond_seq, nd_line(orig_node), pop);
- ADD_INSN(cond_seq, nd_line(orig_node), pop); /* discard cached #deconstruct value */
+ ADD_INSN1(cond_seq, orig_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN1(cond_seq, orig_node, putobject, rb_eNoMatchingPatternError);
+ ADD_INSN1(cond_seq, orig_node, topn, INT2FIX(2));
+ ADD_SEND(cond_seq, orig_node, id_core_raise, INT2FIX(2));
+ ADD_INSN(cond_seq, orig_node, pop);
+ ADD_INSN(cond_seq, orig_node, pop);
+ ADD_INSN(cond_seq, orig_node, pop); /* discard cached #deconstruct value */
if (!popped) {
- ADD_INSN(cond_seq, nd_line(orig_node), putnil);
+ ADD_INSN(cond_seq, orig_node, putnil);
}
- ADD_INSNL(cond_seq, nd_line(orig_node), jump, endlabel);
- ADD_INSN(cond_seq, line, putnil);
+ ADD_INSNL(cond_seq, orig_node, jump, endlabel);
+ ADD_INSN(cond_seq, line_node, putnil);
if (popped) {
- ADD_INSN(cond_seq, line, putnil);
+ ADD_INSN(cond_seq, line_node, putnil);
}
}
@@ -6534,6 +6762,7 @@ static int
compile_loop(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped, const enum node_type type)
{
const int line = (int)nd_line(node);
+ const NODE *line_node = node;
LABEL *prev_start_label = ISEQ_COMPILE_DATA(iseq)->start_label;
LABEL *prev_end_label = ISEQ_COMPILE_DATA(iseq)->end_label;
@@ -6556,17 +6785,17 @@ compile_loop(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in
push_ensure_entry(iseq, &enl, NULL, NULL);
if (node->nd_state == 1) {
- ADD_INSNL(ret, line, jump, next_label);
+ ADD_INSNL(ret, line_node, jump, next_label);
}
else {
tmp_label = NEW_LABEL(line);
- ADD_INSNL(ret, line, jump, tmp_label);
+ ADD_INSNL(ret, line_node, jump, tmp_label);
}
ADD_LABEL(ret, adjust_label);
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
ADD_LABEL(ret, next_catch_label);
- ADD_INSN(ret, line, pop);
- ADD_INSNL(ret, line, jump, next_label);
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSNL(ret, line_node, jump, next_label);
if (tmp_label) ADD_LABEL(ret, tmp_label);
ADD_LABEL(ret, redo_label);
@@ -6595,18 +6824,18 @@ compile_loop(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in
ADD_ADJUST_RESTORE(ret, adjust_label);
if (node->nd_state == Qundef) {
- /* ADD_INSN(ret, line, putundef); */
+ /* ADD_INSN(ret, line_node, putundef); */
COMPILE_ERROR(ERROR_ARGS "unsupported: putundef");
return COMPILE_NG;
}
else {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
}
ADD_LABEL(ret, break_label); /* break */
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
ADD_CATCH_ENTRY(CATCH_TYPE_BREAK, redo_label, break_label, NULL,
@@ -6628,6 +6857,7 @@ static int
compile_iter(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped)
{
const int line = nd_line(node);
+ const NODE *line_node = node;
const rb_iseq_t *prevblock = ISEQ_COMPILE_DATA(iseq)->current_block;
LABEL *retry_label = NEW_LABEL(line);
LABEL *retry_end_l = NEW_LABEL(line);
@@ -6640,7 +6870,7 @@ compile_iter(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in
ISEQ_COMPILE_DATA(iseq)->current_block = child_iseq =
NEW_CHILD_ISEQ(node->nd_body, make_name_for_block(iseq),
ISEQ_TYPE_BLOCK, line);
- ADD_SEND_WITH_BLOCK(ret, line, idEach, INT2FIX(0), child_iseq);
+ ADD_SEND_WITH_BLOCK(ret, line_node, idEach, INT2FIX(0), child_iseq);
}
else {
ISEQ_COMPILE_DATA(iseq)->current_block = child_iseq =
@@ -6651,7 +6881,7 @@ compile_iter(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in
ADD_LABEL(ret, retry_end_l);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
ISEQ_COMPILE_DATA(iseq)->current_block = prevblock;
@@ -6666,27 +6896,27 @@ compile_for_masgn(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const nod
/* massign to var in "for"
* (args.length == 1 && Array.try_convert(args[0])) || args
*/
- const int line = nd_line(node);
+ const NODE *line_node = node;
const NODE *var = node->nd_var;
LABEL *not_single = NEW_LABEL(nd_line(var));
LABEL *not_ary = NEW_LABEL(nd_line(var));
CHECK(COMPILE(ret, "for var", var));
- ADD_INSN(ret, line, dup);
- ADD_CALL(ret, line, idLength, INT2FIX(0));
- ADD_INSN1(ret, line, putobject, INT2FIX(1));
- ADD_CALL(ret, line, idEq, INT2FIX(1));
- ADD_INSNL(ret, line, branchunless, not_single);
- ADD_INSN(ret, line, dup);
- ADD_INSN1(ret, line, putobject, INT2FIX(0));
- ADD_CALL(ret, line, idAREF, INT2FIX(1));
- ADD_INSN1(ret, line, putobject, rb_cArray);
- ADD_INSN(ret, line, swap);
- ADD_CALL(ret, line, rb_intern("try_convert"), INT2FIX(1));
- ADD_INSN(ret, line, dup);
- ADD_INSNL(ret, line, branchunless, not_ary);
- ADD_INSN(ret, line, swap);
+ ADD_INSN(ret, line_node, dup);
+ ADD_CALL(ret, line_node, idLength, INT2FIX(0));
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(1));
+ ADD_CALL(ret, line_node, idEq, INT2FIX(1));
+ ADD_INSNL(ret, line_node, branchunless, not_single);
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(0));
+ ADD_CALL(ret, line_node, idAREF, INT2FIX(1));
+ ADD_INSN1(ret, line_node, putobject, rb_cArray);
+ ADD_INSN(ret, line_node, swap);
+ ADD_CALL(ret, line_node, rb_intern("try_convert"), INT2FIX(1));
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSNL(ret, line_node, branchunless, not_ary);
+ ADD_INSN(ret, line_node, swap);
ADD_LABEL(ret, not_ary);
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
ADD_LABEL(ret, not_single);
return COMPILE_OK;
}
@@ -6694,22 +6924,22 @@ compile_for_masgn(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const nod
static int
compile_break(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped)
{
- const int line = nd_line(node);
+ const NODE *line_node = node;
unsigned long throw_flag = 0;
- if (ISEQ_COMPILE_DATA(iseq)->redo_label != 0) {
+ if (ISEQ_COMPILE_DATA(iseq)->redo_label != 0 && can_add_ensure_iseq(iseq)) {
/* while/until */
LABEL *splabel = NEW_LABEL(0);
ADD_LABEL(ret, splabel);
- ADD_ADJUST(ret, line, ISEQ_COMPILE_DATA(iseq)->redo_label);
+ ADD_ADJUST(ret, line_node, ISEQ_COMPILE_DATA(iseq)->redo_label);
CHECK(COMPILE_(ret, "break val (while/until)", node->nd_stts,
ISEQ_COMPILE_DATA(iseq)->loopval_popped));
add_ensure_iseq(ret, iseq, 0);
- ADD_INSNL(ret, line, jump, ISEQ_COMPILE_DATA(iseq)->end_label);
+ ADD_INSNL(ret, line_node, jump, ISEQ_COMPILE_DATA(iseq)->end_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!popped) {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
}
}
else {
@@ -6738,9 +6968,9 @@ compile_break(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, i
/* escape from block */
CHECK(COMPILE(ret, "break val (block)", node->nd_stts));
- ADD_INSN1(ret, line, throw, INT2FIX(throw_flag | TAG_BREAK));
+ ADD_INSN1(ret, line_node, throw, INT2FIX(throw_flag | TAG_BREAK));
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
return COMPILE_OK;
}
@@ -6753,35 +6983,35 @@ compile_break(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, i
static int
compile_next(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped)
{
- const int line = nd_line(node);
+ const NODE *line_node = node;
unsigned long throw_flag = 0;
- if (ISEQ_COMPILE_DATA(iseq)->redo_label != 0) {
+ if (ISEQ_COMPILE_DATA(iseq)->redo_label != 0 && can_add_ensure_iseq(iseq)) {
LABEL *splabel = NEW_LABEL(0);
debugs("next in while loop\n");
ADD_LABEL(ret, splabel);
CHECK(COMPILE(ret, "next val/valid syntax?", node->nd_stts));
add_ensure_iseq(ret, iseq, 0);
- ADD_ADJUST(ret, line, ISEQ_COMPILE_DATA(iseq)->redo_label);
- ADD_INSNL(ret, line, jump, ISEQ_COMPILE_DATA(iseq)->start_label);
+ ADD_ADJUST(ret, line_node, ISEQ_COMPILE_DATA(iseq)->redo_label);
+ ADD_INSNL(ret, line_node, jump, ISEQ_COMPILE_DATA(iseq)->start_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!popped) {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
}
}
- else if (ISEQ_COMPILE_DATA(iseq)->end_label) {
+ else if (ISEQ_COMPILE_DATA(iseq)->end_label && can_add_ensure_iseq(iseq)) {
LABEL *splabel = NEW_LABEL(0);
debugs("next in block\n");
ADD_LABEL(ret, splabel);
- ADD_ADJUST(ret, line, ISEQ_COMPILE_DATA(iseq)->start_label);
+ ADD_ADJUST(ret, line_node, ISEQ_COMPILE_DATA(iseq)->start_label);
CHECK(COMPILE(ret, "next val", node->nd_stts));
add_ensure_iseq(ret, iseq, 0);
- ADD_INSNL(ret, line, jump, ISEQ_COMPILE_DATA(iseq)->end_label);
+ ADD_INSNL(ret, line_node, jump, ISEQ_COMPILE_DATA(iseq)->end_label);
ADD_ADJUST_RESTORE(ret, splabel);
splabel->unremovable = FALSE;
if (!popped) {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
}
}
else {
@@ -6810,10 +7040,10 @@ compile_next(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in
}
if (ip != 0) {
CHECK(COMPILE(ret, "next val", node->nd_stts));
- ADD_INSN1(ret, line, throw, INT2FIX(throw_flag | TAG_NEXT));
+ ADD_INSN1(ret, line_node, throw, INT2FIX(throw_flag | TAG_NEXT));
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
}
else {
@@ -6827,32 +7057,32 @@ compile_next(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in
static int
compile_redo(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped)
{
- const int line = nd_line(node);
+ const NODE *line_node = node;
- if (ISEQ_COMPILE_DATA(iseq)->redo_label) {
+ if (ISEQ_COMPILE_DATA(iseq)->redo_label && can_add_ensure_iseq(iseq)) {
LABEL *splabel = NEW_LABEL(0);
debugs("redo in while");
ADD_LABEL(ret, splabel);
- ADD_ADJUST(ret, line, ISEQ_COMPILE_DATA(iseq)->redo_label);
+ ADD_ADJUST(ret, line_node, ISEQ_COMPILE_DATA(iseq)->redo_label);
add_ensure_iseq(ret, iseq, 0);
- ADD_INSNL(ret, line, jump, ISEQ_COMPILE_DATA(iseq)->redo_label);
+ ADD_INSNL(ret, line_node, jump, ISEQ_COMPILE_DATA(iseq)->redo_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!popped) {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
}
}
- else if (iseq->body->type != ISEQ_TYPE_EVAL && ISEQ_COMPILE_DATA(iseq)->start_label) {
+ else if (iseq->body->type != ISEQ_TYPE_EVAL && ISEQ_COMPILE_DATA(iseq)->start_label && can_add_ensure_iseq(iseq)) {
LABEL *splabel = NEW_LABEL(0);
debugs("redo in block");
ADD_LABEL(ret, splabel);
add_ensure_iseq(ret, iseq, 0);
- ADD_ADJUST(ret, line, ISEQ_COMPILE_DATA(iseq)->start_label);
- ADD_INSNL(ret, line, jump, ISEQ_COMPILE_DATA(iseq)->start_label);
+ ADD_ADJUST(ret, line_node, ISEQ_COMPILE_DATA(iseq)->start_label);
+ ADD_INSNL(ret, line_node, jump, ISEQ_COMPILE_DATA(iseq)->start_label);
ADD_ADJUST_RESTORE(ret, splabel);
if (!popped) {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
}
}
else {
@@ -6878,11 +7108,11 @@ compile_redo(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in
ip = ip->body->parent_iseq;
}
if (ip != 0) {
- ADD_INSN(ret, line, putnil);
- ADD_INSN1(ret, line, throw, INT2FIX(VM_THROW_NO_ESCAPE_FLAG | TAG_REDO));
+ ADD_INSN(ret, line_node, putnil);
+ ADD_INSN1(ret, line_node, throw, INT2FIX(VM_THROW_NO_ESCAPE_FLAG | TAG_REDO));
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
}
else {
@@ -6896,14 +7126,14 @@ compile_redo(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in
static int
compile_retry(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped)
{
- const int line = nd_line(node);
+ const NODE *line_node = node;
if (iseq->body->type == ISEQ_TYPE_RESCUE) {
- ADD_INSN(ret, line, putnil);
- ADD_INSN1(ret, line, throw, INT2FIX(TAG_RETRY));
+ ADD_INSN(ret, line_node, putnil);
+ ADD_INSN1(ret, line_node, throw, INT2FIX(TAG_RETRY));
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
}
else {
@@ -6917,6 +7147,7 @@ static int
compile_rescue(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped)
{
const int line = nd_line(node);
+ const NODE *line_node = node;
LABEL *lstart = NEW_LABEL(line);
LABEL *lend = NEW_LABEL(line);
LABEL *lcont = NEW_LABEL(line);
@@ -6927,17 +7158,24 @@ compile_rescue(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node,
lstart->rescued = LABEL_RESCUE_BEG;
lend->rescued = LABEL_RESCUE_END;
ADD_LABEL(ret, lstart);
- CHECK(COMPILE(ret, "rescue head", node->nd_head));
+
+ bool prev_in_rescue = ISEQ_COMPILE_DATA(iseq)->in_rescue;
+ ISEQ_COMPILE_DATA(iseq)->in_rescue = true;
+ {
+ CHECK(COMPILE(ret, "rescue head", node->nd_head));
+ }
+ ISEQ_COMPILE_DATA(iseq)->in_rescue = prev_in_rescue;
+
ADD_LABEL(ret, lend);
if (node->nd_else) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
CHECK(COMPILE(ret, "rescue else", node->nd_else));
}
- ADD_INSN(ret, line, nop);
+ ADD_INSN(ret, line_node, nop);
ADD_LABEL(ret, lcont);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
/* register catch entry */
@@ -6950,6 +7188,7 @@ static int
compile_resbody(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped)
{
const int line = nd_line(node);
+ const NODE *line_node = node;
const NODE *resq = node;
const NODE *narg;
LABEL *label_miss, *label_hit;
@@ -6963,38 +7202,38 @@ compile_resbody(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node,
switch (nd_type(narg)) {
case NODE_LIST:
while (narg) {
- ADD_GETLOCAL(ret, line, LVAR_ERRINFO, 0);
+ ADD_GETLOCAL(ret, line_node, LVAR_ERRINFO, 0);
CHECK(COMPILE(ret, "rescue arg", narg->nd_head));
- ADD_INSN1(ret, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE));
- ADD_INSNL(ret, line, branchif, label_hit);
+ ADD_INSN1(ret, line_node, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE));
+ ADD_INSNL(ret, line_node, branchif, label_hit);
narg = narg->nd_next;
}
break;
case NODE_SPLAT:
case NODE_ARGSCAT:
case NODE_ARGSPUSH:
- ADD_GETLOCAL(ret, line, LVAR_ERRINFO, 0);
+ ADD_GETLOCAL(ret, line_node, LVAR_ERRINFO, 0);
CHECK(COMPILE(ret, "rescue/cond splat", narg));
- ADD_INSN1(ret, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE | VM_CHECKMATCH_ARRAY));
- ADD_INSNL(ret, line, branchif, label_hit);
+ ADD_INSN1(ret, line_node, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE | VM_CHECKMATCH_ARRAY));
+ ADD_INSNL(ret, line_node, branchif, label_hit);
break;
default:
UNKNOWN_NODE("NODE_RESBODY", narg, COMPILE_NG);
}
}
else {
- ADD_GETLOCAL(ret, line, LVAR_ERRINFO, 0);
- ADD_INSN1(ret, line, putobject, rb_eStandardError);
- ADD_INSN1(ret, line, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE));
- ADD_INSNL(ret, line, branchif, label_hit);
+ ADD_GETLOCAL(ret, line_node, LVAR_ERRINFO, 0);
+ ADD_INSN1(ret, line_node, putobject, rb_eStandardError);
+ ADD_INSN1(ret, line_node, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE));
+ ADD_INSNL(ret, line_node, branchif, label_hit);
}
- ADD_INSNL(ret, line, jump, label_miss);
+ ADD_INSNL(ret, line_node, jump, label_miss);
ADD_LABEL(ret, label_hit);
CHECK(COMPILE(ret, "resbody body", resq->nd_body));
if (ISEQ_COMPILE_DATA(iseq)->option->tailcall_optimization) {
- ADD_INSN(ret, line, nop);
+ ADD_INSN(ret, line_node, nop);
}
- ADD_INSN(ret, line, leave);
+ ADD_INSN(ret, line_node, leave);
ADD_LABEL(ret, label_miss);
resq = resq->nd_head;
}
@@ -7005,6 +7244,7 @@ static int
compile_ensure(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped)
{
const int line = nd_line(node);
+ const NODE *line_node = node;
DECL_ANCHOR(ensr);
const rb_iseq_t *ensure = NEW_CHILD_ISEQ(node->nd_ensr,
rb_str_concat(rb_str_new2 ("ensure in "), iseq->body->location.label),
@@ -7032,9 +7272,9 @@ compile_ensure(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node,
CHECK(COMPILE_(ret, "ensure head", node->nd_head, (popped | last_leave)));
ADD_LABEL(ret, lend);
ADD_SEQ(ret, ensr);
- if (!popped && last_leave) ADD_INSN(ret, line, putnil);
+ if (!popped && last_leave) ADD_INSN(ret, line_node, putnil);
ADD_LABEL(ret, lcont);
- if (last_leave) ADD_INSN(ret, line, pop);
+ if (last_leave) ADD_INSN(ret, line_node, pop);
erange = ISEQ_COMPILE_DATA(iseq)->ensure_node_stack->erange;
if (lstart->link.next != &lend->link) {
@@ -7052,7 +7292,7 @@ compile_ensure(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node,
static int
compile_return(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int popped)
{
- const int line = nd_line(node);
+ const NODE *line_node = node;
if (iseq) {
enum iseq_type type = iseq->body->type;
@@ -7083,25 +7323,25 @@ compile_return(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node,
if (type == ISEQ_TYPE_METHOD) {
splabel = NEW_LABEL(0);
ADD_LABEL(ret, splabel);
- ADD_ADJUST(ret, line, 0);
+ ADD_ADJUST(ret, line_node, 0);
}
CHECK(COMPILE(ret, "return nd_stts (return val)", retval));
- if (type == ISEQ_TYPE_METHOD) {
+ if (type == ISEQ_TYPE_METHOD && can_add_ensure_iseq(iseq)) {
add_ensure_iseq(ret, iseq, 1);
ADD_TRACE(ret, RUBY_EVENT_RETURN);
- ADD_INSN(ret, line, leave);
+ ADD_INSN(ret, line_node, leave);
ADD_ADJUST_RESTORE(ret, splabel);
if (!popped) {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
}
}
else {
- ADD_INSN1(ret, line, throw, INT2FIX(TAG_RETURN));
+ ADD_INSN1(ret, line_node, throw, INT2FIX(TAG_RETURN));
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
}
}
@@ -7115,56 +7355,57 @@ compile_evstr(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, i
if (!popped && !all_string_result_p(node)) {
const int line = nd_line(node);
+ const NODE *line_node = node;
const unsigned int flag = VM_CALL_FCALL;
LABEL *isstr = NEW_LABEL(line);
- ADD_INSN(ret, line, dup);
- ADD_INSN1(ret, line, checktype, INT2FIX(T_STRING));
- ADD_INSNL(ret, line, branchif, isstr);
- ADD_INSN(ret, line, dup);
- ADD_SEND_R(ret, line, idTo_s, INT2FIX(0), NULL, INT2FIX(flag), NULL);
- ADD_INSN(ret, line, tostring);
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSN1(ret, line_node, checktype, INT2FIX(T_STRING));
+ ADD_INSNL(ret, line_node, branchif, isstr);
+ ADD_INSN(ret, line_node, dup);
+ ADD_SEND_R(ret, line_node, idTo_s, INT2FIX(0), NULL, INT2FIX(flag), NULL);
+ ADD_INSN(ret, line_node, tostring);
ADD_LABEL(ret, isstr);
}
return COMPILE_OK;
}
static void
-compile_lvar(rb_iseq_t *iseq, LINK_ANCHOR *const ret, int line, ID id)
+compile_lvar(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *line_node, ID id)
{
int idx = iseq->body->local_iseq->body->local_table_size - get_local_var_idx(iseq, id);
debugs("id: %s idx: %d\n", rb_id2name(id), idx);
- ADD_GETLOCAL(ret, line, idx, get_lvar_level(iseq));
+ ADD_GETLOCAL(ret, line_node, idx, get_lvar_level(iseq));
}
static LABEL *
-qcall_branch_start(rb_iseq_t *iseq, LINK_ANCHOR *const recv, VALUE *branches, const NODE *node, int line)
+qcall_branch_start(rb_iseq_t *iseq, LINK_ANCHOR *const recv, VALUE *branches, const NODE *node, const NODE *line_node)
{
- LABEL *else_label = NEW_LABEL(line);
+ LABEL *else_label = NEW_LABEL(nd_line(line_node));
VALUE br = 0;
br = decl_branch_base(iseq, node, "&.");
*branches = br;
- ADD_INSN(recv, line, dup);
- ADD_INSNL(recv, line, branchnil, else_label);
+ ADD_INSN(recv, line_node, dup);
+ ADD_INSNL(recv, line_node, branchnil, else_label);
add_trace_branch_coverage(iseq, recv, node, 0, "then", br);
return else_label;
}
static void
-qcall_branch_end(rb_iseq_t *iseq, LINK_ANCHOR *const ret, LABEL *else_label, VALUE branches, const NODE *node, int line)
+qcall_branch_end(rb_iseq_t *iseq, LINK_ANCHOR *const ret, LABEL *else_label, VALUE branches, const NODE *node, const NODE *line_node)
{
LABEL *end_label;
if (!else_label) return;
- end_label = NEW_LABEL(line);
- ADD_INSNL(ret, line, jump, end_label);
+ end_label = NEW_LABEL(nd_line(line_node));
+ ADD_INSNL(ret, line_node, jump, end_label);
ADD_LABEL(ret, else_label);
add_trace_branch_coverage(iseq, ret, node, 1, "else", branches);
ADD_LABEL(ret, end_label);
}
static int
-compile_call_precheck_freeze(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int line, int popped)
+compile_call_precheck_freeze(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, const NODE *line_node, int popped)
{
/* optimization shortcut
* "literal".freeze -> opt_str_freeze("literal")
@@ -7176,16 +7417,16 @@ compile_call_precheck_freeze(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE
ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) {
VALUE str = rb_fstring(node->nd_recv->nd_lit);
if (node->nd_mid == idUMinus) {
- ADD_INSN2(ret, line, opt_str_uminus, str,
+ ADD_INSN2(ret, line_node, opt_str_uminus, str,
new_callinfo(iseq, idUMinus, 0, 0, NULL, FALSE));
}
else {
- ADD_INSN2(ret, line, opt_str_freeze, str,
+ ADD_INSN2(ret, line_node, opt_str_freeze, str,
new_callinfo(iseq, idFreeze, 0, 0, NULL, FALSE));
}
RB_OBJ_WRITTEN(iseq, Qundef, str);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
return TRUE;
}
@@ -7200,11 +7441,11 @@ compile_call_precheck_freeze(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE
ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) {
VALUE str = rb_fstring(node->nd_args->nd_head->nd_lit);
CHECK(COMPILE(ret, "recv", node->nd_recv));
- ADD_INSN2(ret, line, opt_aref_with, str,
+ ADD_INSN2(ret, line_node, opt_aref_with, str,
new_callinfo(iseq, idAREF, 1, 0, NULL, FALSE));
RB_OBJ_WRITTEN(iseq, Qundef, str);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
return TRUE;
}
@@ -7329,7 +7570,7 @@ delegate_call_p(const rb_iseq_t *iseq, unsigned int argc, const LINK_ANCHOR *arg
}
static int
-compile_builtin_arg(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int line, int popped)
+compile_builtin_arg(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, const NODE *line_node, int popped)
{
if (!node) goto no_arg;
if (nd_type(node) != NODE_LIST) goto bad_arg;
@@ -7340,7 +7581,7 @@ compile_builtin_arg(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, i
VALUE name = node->nd_lit;
if (!SYMBOL_P(name)) goto non_symbol_arg;
if (!popped) {
- compile_lvar(iseq, ret, line, SYM2ID(name));
+ compile_lvar(iseq, ret, line_node, SYM2ID(name));
}
return COMPILE_OK;
no_arg:
@@ -7358,13 +7599,13 @@ compile_builtin_arg(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, i
}
static int
-compile_builtin_function_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int line, int popped,
+compile_builtin_function_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, const NODE *line_node, int popped,
const rb_iseq_t *parent_block, LINK_ANCHOR *args, const char *builtin_func)
{
NODE *args_node = node->nd_args;
if (parent_block != NULL) {
- COMPILE_ERROR(iseq, line, "should not call builtins here.");
+ COMPILE_ERROR(iseq, nd_line(line_node), "should not call builtins here.");
return COMPILE_NG;
}
else {
@@ -7393,7 +7634,7 @@ compile_builtin_function_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NOD
return COMPILE_OK;
}
else if (strcmp("arg!", builtin_func) == 0) {
- return compile_builtin_arg(iseq, ret, args_node, line, popped);
+ return compile_builtin_arg(iseq, ret, args_node, line_node, popped);
}
else if (1) {
rb_bug("can't find builtin function:%s", builtin_func);
@@ -7416,7 +7657,7 @@ compile_builtin_function_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NOD
if (cconst) {
typedef VALUE(*builtin_func0)(void *, VALUE);
VALUE const_val = (*(builtin_func0)bf->func_ptr)(NULL, Qnil);
- ADD_INSN1(ret, line, putobject, const_val);
+ ADD_INSN1(ret, line_node, putobject, const_val);
return COMPILE_OK;
}
@@ -7434,20 +7675,20 @@ compile_builtin_function_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NOD
unsigned int start_index;
if (delegate_call_p(iseq, FIX2INT(argc), args, &start_index)) {
- ADD_INSN2(ret, line, opt_invokebuiltin_delegate, bf, INT2FIX(start_index));
+ ADD_INSN2(ret, line_node, opt_invokebuiltin_delegate, bf, INT2FIX(start_index));
}
else {
ADD_SEQ(ret, args);
- ADD_INSN1(ret,line, invokebuiltin, bf);
+ ADD_INSN1(ret, line_node, invokebuiltin, bf);
}
- if (popped) ADD_INSN(ret, line, pop);
+ if (popped) ADD_INSN(ret, line_node, pop);
return COMPILE_OK;
}
}
static int
-compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, const enum node_type type, int line, int popped, bool assume_receiver)
+compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, const enum node_type type, const NODE *const line_node, int popped, bool assume_receiver)
{
/* call: obj.method(...)
* fcall: func(...)
@@ -7476,11 +7717,11 @@ compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, co
CONST_ID(id_answer, "the_answer_to_life_the_universe_and_everything");
if (mid == id_bitblt) {
- ADD_INSN(ret, line, bitblt);
+ ADD_INSN(ret, line_node, bitblt);
return COMPILE_OK;
}
else if (mid == id_answer) {
- ADD_INSN(ret, line, answer);
+ ADD_INSN(ret, line_node, answer);
return COMPILE_OK;
}
}
@@ -7508,8 +7749,8 @@ compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, co
label_name = node->nd_args->nd_head->nd_lit;
if (!st_lookup(labels_table, (st_data_t)label_name, &data)) {
- label = NEW_LABEL(line);
- label->position = line;
+ label = NEW_LABEL(nd_line(line_node));
+ label->position = nd_line(line_node);
st_insert(labels_table, (st_data_t)label_name, (st_data_t)label);
}
else {
@@ -7522,7 +7763,7 @@ compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, co
}
if (mid == goto_id) {
- ADD_INSNL(ret, line, jump, label);
+ ADD_INSNL(ret, line_node, jump, label);
}
else {
ADD_LABEL(ret, label);
@@ -7535,7 +7776,7 @@ compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, co
const char *builtin_func;
if (UNLIKELY(iseq_has_builtin_function_table(iseq)) &&
(builtin_func = iseq_builtin_function_name(type, node->nd_recv, mid)) != NULL) {
- return compile_builtin_function_call(iseq, ret, node, line, popped, parent_block, args, builtin_func);
+ return compile_builtin_function_call(iseq, ret, node, line_node, popped, parent_block, args, builtin_func);
}
/* receiver */
@@ -7546,10 +7787,10 @@ compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, co
if (mid == idCall &&
nd_type(node->nd_recv) == NODE_LVAR &&
iseq_block_param_id_p(iseq, node->nd_recv->nd_vid, &idx, &level)) {
- ADD_INSN2(recv, nd_line(node->nd_recv), getblockparamproxy, INT2FIX(idx + VM_ENV_DATA_SIZE - 1), INT2FIX(level));
+ ADD_INSN2(recv, node->nd_recv, getblockparamproxy, INT2FIX(idx + VM_ENV_DATA_SIZE - 1), INT2FIX(level));
}
else if (private_recv_p(node)) {
- ADD_INSN(recv, nd_line(node), putself);
+ ADD_INSN(recv, node, putself);
flag |= VM_CALL_FCALL;
}
else {
@@ -7557,11 +7798,11 @@ compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, co
}
if (type == NODE_QCALL) {
- else_label = qcall_branch_start(iseq, recv, &branches, node, line);
+ else_label = qcall_branch_start(iseq, recv, &branches, node, line_node);
}
}
else if (type == NODE_FCALL || type == NODE_VCALL) {
- ADD_CALL_RECEIVER(recv, line);
+ ADD_CALL_RECEIVER(recv, line_node);
}
}
@@ -7588,11 +7829,11 @@ compile_call(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, co
flag |= VM_CALL_FCALL;
}
- ADD_SEND_R(ret, line, mid, argc, parent_block, INT2FIX(flag), keywords);
+ ADD_SEND_R(ret, line_node, mid, argc, parent_block, INT2FIX(flag), keywords);
- qcall_branch_end(iseq, ret, else_label, branches, node, line);
+ qcall_branch_end(iseq, ret, else_label, branches, node, line_node);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
return COMPILE_OK;
}
@@ -7614,7 +7855,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, const NODE *node, int poppe
int lineno = ISEQ_COMPILE_DATA(iseq)->last_line;
if (lineno == 0) lineno = FIX2INT(rb_iseq_first_lineno(iseq));
debugs("node: NODE_NIL(implicit)\n");
- ADD_INSN(ret, lineno, putnil);
+ NODE dummy_line_node = generate_dummy_line_node(lineno, -1);
+ ADD_INSN(ret, &dummy_line_node, putnil);
}
return COMPILE_OK;
}
@@ -7638,6 +7880,7 @@ static int
iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, int popped)
{
const int line = (int)nd_line(node);
+ const NODE *line_node = node;
const enum node_type type = nd_type(node);
struct rb_iseq_constant_body *const body = iseq->body;
@@ -7726,16 +7969,16 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
LABEL *end_label = NEW_LABEL(line);
CHECK(COMPILE(ret, "nd_1st", node->nd_1st));
if (!popped) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
}
if (type == NODE_AND) {
- ADD_INSNL(ret, line, branchunless, end_label);
+ ADD_INSNL(ret, line_node, branchunless, end_label);
}
else {
- ADD_INSNL(ret, line, branchif, end_label);
+ ADD_INSNL(ret, line_node, branchif, end_label);
}
if (!popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
CHECK(COMPILE_(ret, "nd_2nd", node->nd_2nd, popped));
ADD_LABEL(ret, end_label);
@@ -7755,9 +7998,9 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
CHECK(COMPILE(ret, "rvalue", node->nd_value));
if (!popped) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
}
- ADD_SETLOCAL(ret, line, idx, get_lvar_level(iseq));
+ ADD_SETLOCAL(ret, line_node, idx, get_lvar_level(iseq));
break;
}
case NODE_DASGN:
@@ -7768,7 +8011,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
debugi("dassn id", rb_id2str(id) ? id : '*');
if (!popped) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
}
idx = get_dyna_var_idx(iseq, id, &lv, &ls);
@@ -7778,24 +8021,24 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
rb_id2str(id));
goto ng;
}
- ADD_SETLOCAL(ret, line, ls - idx, lv);
+ ADD_SETLOCAL(ret, line_node, ls - idx, lv);
break;
}
case NODE_GASGN:{
CHECK(COMPILE(ret, "lvalue", node->nd_value));
if (!popped) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
}
- ADD_INSN1(ret, line, setglobal, ID2SYM(node->nd_entry));
+ ADD_INSN1(ret, line_node, setglobal, ID2SYM(node->nd_entry));
break;
}
case NODE_IASGN:{
CHECK(COMPILE(ret, "lvalue", node->nd_value));
if (!popped) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
}
- ADD_INSN2(ret, line, setinstancevariable,
+ ADD_INSN2(ret, line_node, setinstancevariable,
ID2SYM(node->nd_vid),
get_ivar_ic_value(iseq,node->nd_vid));
break;
@@ -7804,26 +8047,26 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
CHECK(COMPILE(ret, "lvalue", node->nd_value));
if (!popped) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
}
if (node->nd_vid) {
- ADD_INSN1(ret, line, putspecialobject,
+ ADD_INSN1(ret, line_node, putspecialobject,
INT2FIX(VM_SPECIAL_OBJECT_CONST_BASE));
- ADD_INSN1(ret, line, setconstant, ID2SYM(node->nd_vid));
+ ADD_INSN1(ret, line_node, setconstant, ID2SYM(node->nd_vid));
}
else {
compile_cpath(ret, iseq, node->nd_else);
- ADD_INSN1(ret, line, setconstant, ID2SYM(node->nd_else->nd_mid));
+ ADD_INSN1(ret, line_node, setconstant, ID2SYM(node->nd_else->nd_mid));
}
break;
}
case NODE_CVASGN:{
CHECK(COMPILE(ret, "cvasgn val", node->nd_value));
if (!popped) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
}
- ADD_INSN1(ret, line, setclassvariable,
+ ADD_INSN1(ret, line_node, setclassvariable,
ID2SYM(node->nd_vid));
break;
}
@@ -7858,7 +8101,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
*/
if (!popped) {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
}
asgnflag = COMPILE_RECV(ret, "NODE_OP_ASGN1 recv", node);
CHECK(asgnflag != -1);
@@ -7873,9 +8116,9 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
argc = setup_args(iseq, ret, node->nd_args->nd_head, &flag, NULL);
CHECK(!NIL_P(argc));
}
- ADD_INSN1(ret, line, dupn, FIXNUM_INC(argc, 1 + boff));
+ ADD_INSN1(ret, line_node, dupn, FIXNUM_INC(argc, 1 + boff));
flag |= asgnflag;
- ADD_SEND_WITH_FLAG(ret, line, idAREF, argc, INT2FIX(flag));
+ ADD_SEND_WITH_FLAG(ret, line_node, idAREF, argc, INT2FIX(flag));
if (id == idOROP || id == idANDOP) {
/* a[x] ||= y or a[x] &&= y
@@ -7889,75 +8132,75 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
LABEL *label = NEW_LABEL(line);
LABEL *lfin = NEW_LABEL(line);
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
if (id == idOROP) {
- ADD_INSNL(ret, line, branchif, label);
+ ADD_INSNL(ret, line_node, branchif, label);
}
else { /* idANDOP */
- ADD_INSNL(ret, line, branchunless, label);
+ ADD_INSNL(ret, line_node, branchunless, label);
}
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
CHECK(COMPILE(ret, "NODE_OP_ASGN1 args->body: ", node->nd_args->nd_body));
if (!popped) {
- ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2+boff));
+ ADD_INSN1(ret, line_node, setn, FIXNUM_INC(argc, 2+boff));
}
if (flag & VM_CALL_ARGS_SPLAT) {
- ADD_INSN1(ret, line, newarray, INT2FIX(1));
+ ADD_INSN1(ret, line_node, newarray, INT2FIX(1));
if (boff > 0) {
- ADD_INSN1(ret, line, dupn, INT2FIX(3));
- ADD_INSN(ret, line, swap);
- ADD_INSN(ret, line, pop);
+ ADD_INSN1(ret, line_node, dupn, INT2FIX(3));
+ ADD_INSN(ret, line_node, swap);
+ ADD_INSN(ret, line_node, pop);
}
- ADD_INSN(ret, line, concatarray);
+ ADD_INSN(ret, line_node, concatarray);
if (boff > 0) {
- ADD_INSN1(ret, line, setn, INT2FIX(3));
- ADD_INSN(ret, line, pop);
- ADD_INSN(ret, line, pop);
+ ADD_INSN1(ret, line_node, setn, INT2FIX(3));
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSN(ret, line_node, pop);
}
- ADD_SEND_WITH_FLAG(ret, line, idASET, argc, INT2FIX(flag));
+ ADD_SEND_WITH_FLAG(ret, line_node, idASET, argc, INT2FIX(flag));
}
else {
if (boff > 0)
- ADD_INSN(ret, line, swap);
- ADD_SEND_WITH_FLAG(ret, line, idASET, FIXNUM_INC(argc, 1), INT2FIX(flag));
+ ADD_INSN(ret, line_node, swap);
+ ADD_SEND_WITH_FLAG(ret, line_node, idASET, FIXNUM_INC(argc, 1), INT2FIX(flag));
}
- ADD_INSN(ret, line, pop);
- ADD_INSNL(ret, line, jump, lfin);
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSNL(ret, line_node, jump, lfin);
ADD_LABEL(ret, label);
if (!popped) {
- ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2+boff));
+ ADD_INSN1(ret, line_node, setn, FIXNUM_INC(argc, 2+boff));
}
- ADD_INSN1(ret, line, adjuststack, FIXNUM_INC(argc, 2+boff));
+ ADD_INSN1(ret, line_node, adjuststack, FIXNUM_INC(argc, 2+boff));
ADD_LABEL(ret, lfin);
}
else {
CHECK(COMPILE(ret, "NODE_OP_ASGN1 args->body: ", node->nd_args->nd_body));
- ADD_SEND(ret, line, id, INT2FIX(1));
+ ADD_SEND(ret, line_node, id, INT2FIX(1));
if (!popped) {
- ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2+boff));
+ ADD_INSN1(ret, line_node, setn, FIXNUM_INC(argc, 2+boff));
}
if (flag & VM_CALL_ARGS_SPLAT) {
- ADD_INSN1(ret, line, newarray, INT2FIX(1));
+ ADD_INSN1(ret, line_node, newarray, INT2FIX(1));
if (boff > 0) {
- ADD_INSN1(ret, line, dupn, INT2FIX(3));
- ADD_INSN(ret, line, swap);
- ADD_INSN(ret, line, pop);
+ ADD_INSN1(ret, line_node, dupn, INT2FIX(3));
+ ADD_INSN(ret, line_node, swap);
+ ADD_INSN(ret, line_node, pop);
}
- ADD_INSN(ret, line, concatarray);
+ ADD_INSN(ret, line_node, concatarray);
if (boff > 0) {
- ADD_INSN1(ret, line, setn, INT2FIX(3));
- ADD_INSN(ret, line, pop);
- ADD_INSN(ret, line, pop);
+ ADD_INSN1(ret, line_node, setn, INT2FIX(3));
+ ADD_INSN(ret, line_node, pop);
+ ADD_INSN(ret, line_node, pop);
}
- ADD_SEND_WITH_FLAG(ret, line, idASET, argc, INT2FIX(flag));
+ ADD_SEND_WITH_FLAG(ret, line_node, idASET, argc, INT2FIX(flag));
}
else {
if (boff > 0)
- ADD_INSN(ret, line, swap);
- ADD_SEND_WITH_FLAG(ret, line, idASET, FIXNUM_INC(argc, 1), INT2FIX(flag));
+ ADD_INSN(ret, line_node, swap);
+ ADD_SEND_WITH_FLAG(ret, line_node, idASET, FIXNUM_INC(argc, 1), INT2FIX(flag));
}
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
@@ -8015,52 +8258,52 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
CHECK(asgnflag != -1);
if (node->nd_next->nd_aid) {
lskip = NEW_LABEL(line);
- ADD_INSN(ret, line, dup);
- ADD_INSNL(ret, line, branchnil, lskip);
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSNL(ret, line_node, branchnil, lskip);
}
- ADD_INSN(ret, line, dup);
- ADD_SEND_WITH_FLAG(ret, line, vid, INT2FIX(0), INT2FIX(asgnflag));
+ ADD_INSN(ret, line_node, dup);
+ ADD_SEND_WITH_FLAG(ret, line_node, vid, INT2FIX(0), INT2FIX(asgnflag));
if (atype == idOROP || atype == idANDOP) {
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
if (atype == idOROP) {
- ADD_INSNL(ret, line, branchif, lcfin);
+ ADD_INSNL(ret, line_node, branchif, lcfin);
}
else { /* idANDOP */
- ADD_INSNL(ret, line, branchunless, lcfin);
+ ADD_INSNL(ret, line_node, branchunless, lcfin);
}
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
CHECK(COMPILE(ret, "NODE_OP_ASGN2 val", node->nd_value));
- ADD_INSN(ret, line, swap);
- ADD_INSN1(ret, line, topn, INT2FIX(1));
- ADD_SEND_WITH_FLAG(ret, line, aid, INT2FIX(1), INT2FIX(asgnflag));
- ADD_INSNL(ret, line, jump, lfin);
+ ADD_INSN(ret, line_node, swap);
+ ADD_INSN1(ret, line_node, topn, INT2FIX(1));
+ ADD_SEND_WITH_FLAG(ret, line_node, aid, INT2FIX(1), INT2FIX(asgnflag));
+ ADD_INSNL(ret, line_node, jump, lfin);
ADD_LABEL(ret, lcfin);
- ADD_INSN(ret, line, swap);
+ ADD_INSN(ret, line_node, swap);
ADD_LABEL(ret, lfin);
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
if (lskip) {
ADD_LABEL(ret, lskip);
}
if (popped) {
/* we can apply more optimize */
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
}
else {
CHECK(COMPILE(ret, "NODE_OP_ASGN2 val", node->nd_value));
- ADD_SEND(ret, line, atype, INT2FIX(1));
+ ADD_SEND(ret, line_node, atype, INT2FIX(1));
if (!popped) {
- ADD_INSN(ret, line, swap);
- ADD_INSN1(ret, line, topn, INT2FIX(1));
+ ADD_INSN(ret, line_node, swap);
+ ADD_INSN1(ret, line_node, topn, INT2FIX(1));
}
- ADD_SEND_WITH_FLAG(ret, line, aid, INT2FIX(1), INT2FIX(asgnflag));
+ ADD_SEND_WITH_FLAG(ret, line_node, aid, INT2FIX(1), INT2FIX(asgnflag));
if (lskip && popped) {
ADD_LABEL(ret, lskip);
}
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
if (lskip && !popped) {
ADD_LABEL(ret, lskip);
}
@@ -8074,7 +8317,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
switch (nd_type(node->nd_head)) {
case NODE_COLON3:
- ADD_INSN1(ret, line, putobject, rb_cObject);
+ ADD_INSN1(ret, line_node, putobject, rb_cObject);
break;
case NODE_COLON2:
CHECK(COMPILE(ret, "NODE_OP_CDECL/colon2#nd_head", node->nd_head->nd_head));
@@ -8088,49 +8331,49 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
/* cref */
if (node->nd_aid == idOROP) {
lassign = NEW_LABEL(line);
- ADD_INSN(ret, line, dup); /* cref cref */
- ADD_INSN3(ret, line, defined, INT2FIX(DEFINED_CONST_FROM),
+ ADD_INSN(ret, line_node, dup); /* cref cref */
+ ADD_INSN3(ret, line_node, defined, INT2FIX(DEFINED_CONST_FROM),
ID2SYM(mid), Qtrue); /* cref bool */
- ADD_INSNL(ret, line, branchunless, lassign); /* cref */
+ ADD_INSNL(ret, line_node, branchunless, lassign); /* cref */
}
- ADD_INSN(ret, line, dup); /* cref cref */
- ADD_INSN1(ret, line, putobject, Qtrue);
- ADD_INSN1(ret, line, getconstant, ID2SYM(mid)); /* cref obj */
+ ADD_INSN(ret, line_node, dup); /* cref cref */
+ ADD_INSN1(ret, line_node, putobject, Qtrue);
+ ADD_INSN1(ret, line_node, getconstant, ID2SYM(mid)); /* cref obj */
if (node->nd_aid == idOROP || node->nd_aid == idANDOP) {
lfin = NEW_LABEL(line);
- if (!popped) ADD_INSN(ret, line, dup); /* cref [obj] obj */
+ if (!popped) ADD_INSN(ret, line_node, dup); /* cref [obj] obj */
if (node->nd_aid == idOROP)
- ADD_INSNL(ret, line, branchif, lfin);
+ ADD_INSNL(ret, line_node, branchif, lfin);
else /* idANDOP */
- ADD_INSNL(ret, line, branchunless, lfin);
+ ADD_INSNL(ret, line_node, branchunless, lfin);
/* cref [obj] */
- if (!popped) ADD_INSN(ret, line, pop); /* cref */
+ if (!popped) ADD_INSN(ret, line_node, pop); /* cref */
if (lassign) ADD_LABEL(ret, lassign);
CHECK(COMPILE(ret, "NODE_OP_CDECL#nd_value", node->nd_value));
/* cref value */
if (popped)
- ADD_INSN1(ret, line, topn, INT2FIX(1)); /* cref value cref */
+ ADD_INSN1(ret, line_node, topn, INT2FIX(1)); /* cref value cref */
else {
- ADD_INSN1(ret, line, dupn, INT2FIX(2)); /* cref value cref value */
- ADD_INSN(ret, line, swap); /* cref value value cref */
+ ADD_INSN1(ret, line_node, dupn, INT2FIX(2)); /* cref value cref value */
+ ADD_INSN(ret, line_node, swap); /* cref value value cref */
}
- ADD_INSN1(ret, line, setconstant, ID2SYM(mid)); /* cref [value] */
+ ADD_INSN1(ret, line_node, setconstant, ID2SYM(mid)); /* cref [value] */
ADD_LABEL(ret, lfin); /* cref [value] */
- if (!popped) ADD_INSN(ret, line, swap); /* [value] cref */
- ADD_INSN(ret, line, pop); /* [value] */
+ if (!popped) ADD_INSN(ret, line_node, swap); /* [value] cref */
+ ADD_INSN(ret, line_node, pop); /* [value] */
}
else {
CHECK(COMPILE(ret, "NODE_OP_CDECL#nd_value", node->nd_value));
/* cref obj value */
- ADD_CALL(ret, line, node->nd_aid, INT2FIX(1));
+ ADD_CALL(ret, line_node, node->nd_aid, INT2FIX(1));
/* cref value */
- ADD_INSN(ret, line, swap); /* value cref */
+ ADD_INSN(ret, line_node, swap); /* value cref */
if (!popped) {
- ADD_INSN1(ret, line, topn, INT2FIX(1)); /* value cref value */
- ADD_INSN(ret, line, swap); /* value value cref */
+ ADD_INSN1(ret, line_node, topn, INT2FIX(1)); /* value cref value */
+ ADD_INSN(ret, line_node, swap); /* value value cref */
}
- ADD_INSN1(ret, line, setconstant, ID2SYM(mid));
+ ADD_INSN1(ret, line_node, setconstant, ID2SYM(mid));
}
break;
}
@@ -8148,42 +8391,42 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
if (!lassign) {
lassign = NEW_LABEL(line);
}
- ADD_INSNL(ret, line, branchunless, lassign);
+ ADD_INSNL(ret, line_node, branchunless, lassign);
}
else {
lassign = NEW_LABEL(line);
}
CHECK(COMPILE(ret, "NODE_OP_ASGN_AND/OR#nd_head", node->nd_head));
- ADD_INSN(ret, line, dup);
+ ADD_INSN(ret, line_node, dup);
if (nd_type(node) == NODE_OP_ASGN_AND) {
- ADD_INSNL(ret, line, branchunless, lfin);
+ ADD_INSNL(ret, line_node, branchunless, lfin);
}
else {
- ADD_INSNL(ret, line, branchif, lfin);
+ ADD_INSNL(ret, line_node, branchif, lfin);
}
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
ADD_LABEL(ret, lassign);
CHECK(COMPILE(ret, "NODE_OP_ASGN_AND/OR#nd_value", node->nd_value));
ADD_LABEL(ret, lfin);
if (popped) {
/* we can apply more optimize */
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
case NODE_CALL: /* obj.foo */
case NODE_OPCALL: /* foo[] */
- if (compile_call_precheck_freeze(iseq, ret, node, line, popped) == TRUE) {
+ if (compile_call_precheck_freeze(iseq, ret, node, line_node, popped) == TRUE) {
break;
}
case NODE_QCALL: /* obj&.foo */
case NODE_FCALL: /* foo() */
case NODE_VCALL: /* foo (variable or call) */
- if (compile_call(iseq, ret, node, type, line, popped, false) == COMPILE_NG) {
+ if (compile_call(iseq, ret, node, type, line_node, popped, false) == COMPILE_NG) {
goto ng;
}
break;
@@ -8215,7 +8458,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
/* normal arguments */
for (i = 0; i < local_body->param.lead_num; i++) {
int idx = local_body->local_table_size - i;
- ADD_GETLOCAL(args, line, idx, lvar_level);
+ ADD_GETLOCAL(args, line_node, idx, lvar_level);
}
if (local_body->param.flags.has_opt) {
@@ -8223,7 +8466,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
int j;
for (j = 0; j < local_body->param.opt_num; j++) {
int idx = local_body->local_table_size - (i + j);
- ADD_GETLOCAL(args, line, idx, lvar_level);
+ ADD_GETLOCAL(args, line_node, idx, lvar_level);
}
i += j;
argc = i;
@@ -8232,8 +8475,8 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
/* rest argument */
int idx = local_body->local_table_size - local_body->param.rest_start;
- ADD_GETLOCAL(args, line, idx, lvar_level);
- ADD_INSN1(args, line, splatarray, Qfalse);
+ ADD_GETLOCAL(args, line_node, idx, lvar_level);
+ ADD_INSN1(args, line_node, splatarray, Qfalse);
argc = local_body->param.rest_start + 1;
flag |= VM_CALL_ARGS_SPLAT;
@@ -8247,17 +8490,17 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
int j;
for (j=0; j<post_len; j++) {
int idx = local_body->local_table_size - (post_start + j);
- ADD_GETLOCAL(args, line, idx, lvar_level);
+ ADD_GETLOCAL(args, line_node, idx, lvar_level);
}
- ADD_INSN1(args, line, newarray, INT2FIX(j));
- ADD_INSN (args, line, concatarray);
+ ADD_INSN1(args, line_node, newarray, INT2FIX(j));
+ ADD_INSN (args, line_node, concatarray);
/* argc is settled at above */
}
else {
int j;
for (j=0; j<post_len; j++) {
int idx = local_body->local_table_size - (post_start + j);
- ADD_GETLOCAL(args, line, idx, lvar_level);
+ ADD_GETLOCAL(args, line_node, idx, lvar_level);
}
argc = post_len + post_start;
}
@@ -8267,41 +8510,41 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
int local_size = local_body->local_table_size;
argc++;
- ADD_INSN1(args, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN1(args, line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
if (local_body->param.flags.has_kwrest) {
int idx = local_body->local_table_size - local_kwd->rest_start;
- ADD_GETLOCAL(args, line, idx, lvar_level);
+ ADD_GETLOCAL(args, line_node, idx, lvar_level);
if (local_kwd->num > 0) {
- ADD_SEND(args, line, rb_intern("dup"), INT2FIX(0));
+ ADD_SEND(args, line_node, rb_intern("dup"), INT2FIX(0));
flag |= VM_CALL_KW_SPLAT_MUT;
}
}
else {
- ADD_INSN1(args, line, newhash, INT2FIX(0));
+ ADD_INSN1(args, line_node, newhash, INT2FIX(0));
flag |= VM_CALL_KW_SPLAT_MUT;
}
for (i = 0; i < local_kwd->num; ++i) {
ID id = local_kwd->table[i];
int idx = local_size - get_local_var_idx(liseq, id);
- ADD_INSN1(args, line, putobject, ID2SYM(id));
- ADD_GETLOCAL(args, line, idx, lvar_level);
+ ADD_INSN1(args, line_node, putobject, ID2SYM(id));
+ ADD_GETLOCAL(args, line_node, idx, lvar_level);
}
- ADD_SEND(args, line, id_core_hash_merge_ptr, INT2FIX(i * 2 + 1));
+ ADD_SEND(args, line_node, id_core_hash_merge_ptr, INT2FIX(i * 2 + 1));
if (local_body->param.flags.has_rest) {
- ADD_INSN1(args, line, newarray, INT2FIX(1));
- ADD_INSN (args, line, concatarray);
+ ADD_INSN1(args, line_node, newarray, INT2FIX(1));
+ ADD_INSN (args, line_node, concatarray);
--argc;
}
flag |= VM_CALL_KW_SPLAT;
}
else if (local_body->param.flags.has_kwrest) {
int idx = local_body->local_table_size - local_kwd->rest_start;
- ADD_GETLOCAL(args, line, idx, lvar_level);
+ ADD_GETLOCAL(args, line_node, idx, lvar_level);
if (local_body->param.flags.has_rest) {
- ADD_INSN1(args, line, newarray, INT2FIX(1));
- ADD_INSN (args, line, concatarray);
+ ADD_INSN1(args, line_node, newarray, INT2FIX(1));
+ ADD_INSN (args, line_node, concatarray);
}
else {
argc++;
@@ -8310,14 +8553,14 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
}
}
- ADD_INSN(ret, line, putself);
+ ADD_INSN(ret, line_node, putself);
ADD_SEQ(ret, args);
- ADD_INSN2(ret, line, invokesuper,
+ ADD_INSN2(ret, line_node, invokesuper,
new_callinfo(iseq, 0, argc, flag | VM_CALL_SUPER | (type == NODE_ZSUPER ? VM_CALL_ZSUPER : 0) | VM_CALL_FCALL, keywords, parent_block != NULL),
parent_block);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
@@ -8327,7 +8570,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
}
case NODE_ZLIST:{
if (!popped) {
- ADD_INSN1(ret, line, newarray, INT2FIX(0));
+ ADD_INSN1(ret, line_node, newarray, INT2FIX(0));
}
break;
}
@@ -8340,7 +8583,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
CHECK(COMPILE(ret, "values item", n->nd_head));
n = n->nd_next;
}
- ADD_INSN1(ret, line, newarray, INT2FIX(node->nd_alen));
+ ADD_INSN1(ret, line_node, newarray, INT2FIX(node->nd_alen));
break;
}
case NODE_HASH:
@@ -8371,10 +8614,10 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
}
ADD_SEQ(ret, args);
- ADD_INSN1(ret, line, invokeblock, new_callinfo(iseq, 0, FIX2INT(argc), flag, keywords, FALSE));
+ ADD_INSN1(ret, line_node, invokeblock, new_callinfo(iseq, 0, FIX2INT(argc), flag, keywords, FALSE));
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
int level = 0;
@@ -8387,7 +8630,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
}
case NODE_LVAR:{
if (!popped) {
- compile_lvar(iseq, ret, line, node->nd_vid);
+ compile_lvar(iseq, ret, line_node, node->nd_vid);
}
break;
}
@@ -8401,21 +8644,21 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
rb_id2str(node->nd_vid));
goto ng;
}
- ADD_GETLOCAL(ret, line, ls - idx, lv);
+ ADD_GETLOCAL(ret, line_node, ls - idx, lv);
}
break;
}
case NODE_GVAR:{
- ADD_INSN1(ret, line, getglobal, ID2SYM(node->nd_entry));
+ ADD_INSN1(ret, line_node, getglobal, ID2SYM(node->nd_entry));
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
case NODE_IVAR:{
debugi("nd_vid", node->nd_vid);
if (!popped) {
- ADD_INSN2(ret, line, getinstancevariable,
+ ADD_INSN2(ret, line_node, getinstancevariable,
ID2SYM(node->nd_vid),
get_ivar_ic_value(iseq,node->nd_vid));
}
@@ -8428,26 +8671,26 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
LABEL *lend = NEW_LABEL(line);
int ic_index = body->is_size++;
- ADD_INSN2(ret, line, opt_getinlinecache, lend, INT2FIX(ic_index));
- ADD_INSN1(ret, line, putobject, Qtrue);
- ADD_INSN1(ret, line, getconstant, ID2SYM(node->nd_vid));
- ADD_INSN1(ret, line, opt_setinlinecache, INT2FIX(ic_index));
+ ADD_INSN2(ret, line_node, opt_getinlinecache, lend, INT2FIX(ic_index));
+ ADD_INSN1(ret, line_node, putobject, Qtrue);
+ ADD_INSN1(ret, line_node, getconstant, ID2SYM(node->nd_vid));
+ ADD_INSN1(ret, line_node, opt_setinlinecache, INT2FIX(ic_index));
ADD_LABEL(ret, lend);
}
else {
- ADD_INSN(ret, line, putnil);
- ADD_INSN1(ret, line, putobject, Qtrue);
- ADD_INSN1(ret, line, getconstant, ID2SYM(node->nd_vid));
+ ADD_INSN(ret, line_node, putnil);
+ ADD_INSN1(ret, line_node, putobject, Qtrue);
+ ADD_INSN1(ret, line_node, getconstant, ID2SYM(node->nd_vid));
}
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
case NODE_CVAR:{
if (!popped) {
- ADD_INSN1(ret, line, getclassvariable,
+ ADD_INSN1(ret, line_node, getclassvariable,
ID2SYM(node->nd_vid));
}
break;
@@ -8455,17 +8698,17 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
case NODE_NTH_REF:{
if (!popped) {
if (!node->nd_nth) {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
break;
}
- ADD_INSN2(ret, line, getspecial, INT2FIX(1) /* '~' */,
+ ADD_INSN2(ret, line_node, getspecial, INT2FIX(1) /* '~' */,
INT2FIX(node->nd_nth << 1));
}
break;
}
case NODE_BACK_REF:{
if (!popped) {
- ADD_INSN2(ret, line, getspecial, INT2FIX(1) /* '~' */,
+ ADD_INSN2(ret, line_node, getspecial, INT2FIX(1) /* '~' */,
INT2FIX(0x01 | (node->nd_nth << 1)));
}
break;
@@ -8480,8 +8723,8 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
INIT_ANCHOR(val);
switch (nd_type(node)) {
case NODE_MATCH:
- ADD_INSN1(recv, line, putobject, node->nd_lit);
- ADD_INSN2(val, line, getspecial, INT2FIX(0),
+ ADD_INSN1(recv, line_node, putobject, node->nd_lit);
+ ADD_INSN2(val, line_node, getspecial, INT2FIX(0),
INT2FIX(0));
break;
case NODE_MATCH2:
@@ -8496,21 +8739,21 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
ADD_SEQ(ret, recv);
ADD_SEQ(ret, val);
- ADD_SEND(ret, line, idEqTilde, INT2FIX(1));
+ ADD_SEND(ret, line_node, idEqTilde, INT2FIX(1));
if (node->nd_args) {
compile_named_capture_assign(iseq, ret, node->nd_args);
}
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
case NODE_LIT:{
debugp_param("lit", node->nd_lit);
if (!popped) {
- ADD_INSN1(ret, line, putobject, node->nd_lit);
+ ADD_INSN1(ret, line_node, putobject, node->nd_lit);
RB_OBJ_WRITTEN(iseq, Qundef, node->nd_lit);
}
break;
@@ -8521,7 +8764,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
VALUE lit = node->nd_lit;
if (!ISEQ_COMPILE_DATA(iseq)->option->frozen_string_literal) {
lit = rb_fstring(lit);
- ADD_INSN1(ret, line, putstring, lit);
+ ADD_INSN1(ret, line_node, putstring, lit);
RB_OBJ_WRITTEN(iseq, Qundef, lit);
}
else {
@@ -8534,7 +8777,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
else {
lit = rb_fstring(lit);
}
- ADD_INSN1(ret, line, putobject, lit);
+ ADD_INSN1(ret, line_node, putobject, lit);
RB_OBJ_WRITTEN(iseq, Qundef, lit);
}
}
@@ -8544,29 +8787,29 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
compile_dstr(iseq, ret, node);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
case NODE_XSTR:{
- ADD_CALL_RECEIVER(ret, line);
+ ADD_CALL_RECEIVER(ret, line_node);
VALUE str = rb_fstring(node->nd_lit);
- ADD_INSN1(ret, line, putobject, str);
+ ADD_INSN1(ret, line_node, putobject, str);
RB_OBJ_WRITTEN(iseq, Qundef, str);
- ADD_CALL(ret, line, idBackquote, INT2FIX(1));
+ ADD_CALL(ret, line_node, idBackquote, INT2FIX(1));
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
case NODE_DXSTR:{
- ADD_CALL_RECEIVER(ret, line);
+ ADD_CALL_RECEIVER(ret, line_node);
compile_dstr(iseq, ret, node);
- ADD_CALL(ret, line, idBackquote, INT2FIX(1));
+ ADD_CALL(ret, line_node, idBackquote, INT2FIX(1));
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
@@ -8577,7 +8820,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
compile_dregx(iseq, ret, node);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
@@ -8586,51 +8829,51 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
const rb_iseq_t *block_iseq;
block_iseq = NEW_CHILD_ISEQ(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_PLAIN, line);
- ADD_INSN2(ret, line, once, block_iseq, INT2FIX(ic_index));
+ ADD_INSN2(ret, line_node, once, block_iseq, INT2FIX(ic_index));
RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)block_iseq);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
case NODE_ARGSCAT:{
if (popped) {
CHECK(COMPILE(ret, "argscat head", node->nd_head));
- ADD_INSN1(ret, line, splatarray, Qfalse);
- ADD_INSN(ret, line, pop);
+ ADD_INSN1(ret, line_node, splatarray, Qfalse);
+ ADD_INSN(ret, line_node, pop);
CHECK(COMPILE(ret, "argscat body", node->nd_body));
- ADD_INSN1(ret, line, splatarray, Qfalse);
- ADD_INSN(ret, line, pop);
+ ADD_INSN1(ret, line_node, splatarray, Qfalse);
+ ADD_INSN(ret, line_node, pop);
}
else {
CHECK(COMPILE(ret, "argscat head", node->nd_head));
CHECK(COMPILE(ret, "argscat body", node->nd_body));
- ADD_INSN(ret, line, concatarray);
+ ADD_INSN(ret, line_node, concatarray);
}
break;
}
case NODE_ARGSPUSH:{
if (popped) {
CHECK(COMPILE(ret, "arsgpush head", node->nd_head));
- ADD_INSN1(ret, line, splatarray, Qfalse);
- ADD_INSN(ret, line, pop);
+ ADD_INSN1(ret, line_node, splatarray, Qfalse);
+ ADD_INSN(ret, line_node, pop);
CHECK(COMPILE_(ret, "argspush body", node->nd_body, popped));
}
else {
CHECK(COMPILE(ret, "arsgpush head", node->nd_head));
CHECK(COMPILE_(ret, "argspush body", node->nd_body, popped));
- ADD_INSN1(ret, line, newarray, INT2FIX(1));
- ADD_INSN(ret, line, concatarray);
+ ADD_INSN1(ret, line_node, newarray, INT2FIX(1));
+ ADD_INSN(ret, line_node, concatarray);
}
break;
}
case NODE_SPLAT:{
CHECK(COMPILE(ret, "splat", node->nd_head));
- ADD_INSN1(ret, line, splatarray, Qtrue);
+ ADD_INSN1(ret, line_node, splatarray, Qtrue);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
@@ -8641,11 +8884,11 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
ISEQ_TYPE_METHOD, line);
debugp_param("defn/iseq", rb_iseqw_new(method_iseq));
- ADD_INSN2(ret, line, definemethod, ID2SYM(mid), method_iseq);
+ ADD_INSN2(ret, line_node, definemethod, ID2SYM(mid), method_iseq);
RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)method_iseq);
if (!popped) {
- ADD_INSN1(ret, line, putobject, ID2SYM(mid));
+ ADD_INSN1(ret, line_node, putobject, ID2SYM(mid));
}
break;
@@ -8658,45 +8901,45 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
debugp_param("defs/iseq", rb_iseqw_new(singleton_method_iseq));
CHECK(COMPILE(ret, "defs: recv", node->nd_recv));
- ADD_INSN2(ret, line, definesmethod, ID2SYM(mid), singleton_method_iseq);
+ ADD_INSN2(ret, line_node, definesmethod, ID2SYM(mid), singleton_method_iseq);
RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)singleton_method_iseq);
if (!popped) {
- ADD_INSN1(ret, line, putobject, ID2SYM(mid));
+ ADD_INSN1(ret, line_node, putobject, ID2SYM(mid));
}
break;
}
case NODE_ALIAS:{
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE));
+ ADD_INSN1(ret, line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN1(ret, line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE));
CHECK(COMPILE(ret, "alias arg1", node->nd_1st));
CHECK(COMPILE(ret, "alias arg2", node->nd_2nd));
- ADD_SEND(ret, line, id_core_set_method_alias, INT2FIX(3));
+ ADD_SEND(ret, line_node, id_core_set_method_alias, INT2FIX(3));
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
case NODE_VALIAS:{
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN1(ret, line, putobject, ID2SYM(node->nd_alias));
- ADD_INSN1(ret, line, putobject, ID2SYM(node->nd_orig));
- ADD_SEND(ret, line, id_core_set_variable_alias, INT2FIX(2));
+ ADD_INSN1(ret, line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN1(ret, line_node, putobject, ID2SYM(node->nd_alias));
+ ADD_INSN1(ret, line_node, putobject, ID2SYM(node->nd_orig));
+ ADD_SEND(ret, line_node, id_core_set_variable_alias, INT2FIX(2));
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
case NODE_UNDEF:{
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE));
+ ADD_INSN1(ret, line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_INSN1(ret, line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_CBASE));
CHECK(COMPILE(ret, "undef arg", node->nd_undef));
- ADD_SEND(ret, line, id_core_undef_method, INT2FIX(2));
+ ADD_SEND(ret, line_node, id_core_undef_method, INT2FIX(2));
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
@@ -8709,11 +8952,11 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
compile_cpath(ret, iseq, node->nd_cpath);
CHECK(COMPILE(ret, "super", node->nd_super));
- ADD_INSN3(ret, line, defineclass, ID2SYM(node->nd_cpath->nd_mid), class_iseq, INT2FIX(flags));
+ ADD_INSN3(ret, line_node, defineclass, ID2SYM(node->nd_cpath->nd_mid), class_iseq, INT2FIX(flags));
RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)class_iseq);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
@@ -8724,12 +8967,12 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
const int flags = VM_DEFINECLASS_TYPE_MODULE |
compile_cpath(ret, iseq, node->nd_cpath);
- ADD_INSN (ret, line, putnil); /* dummy */
- ADD_INSN3(ret, line, defineclass, ID2SYM(node->nd_cpath->nd_mid), module_iseq, INT2FIX(flags));
+ ADD_INSN (ret, line_node, putnil); /* dummy */
+ ADD_INSN3(ret, line_node, defineclass, ID2SYM(node->nd_cpath->nd_mid), module_iseq, INT2FIX(flags));
RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)module_iseq);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
@@ -8739,15 +8982,15 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
ISEQ_TYPE_CLASS, line);
CHECK(COMPILE(ret, "sclass#recv", node->nd_recv));
- ADD_INSN (ret, line, putnil);
+ ADD_INSN (ret, line_node, putnil);
CONST_ID(singletonclass, "singletonclass");
- ADD_INSN3(ret, line, defineclass,
+ ADD_INSN3(ret, line_node, defineclass,
ID2SYM(singletonclass), singleton_class,
INT2FIX(VM_DEFINECLASS_TYPE_SINGLETON_CLASS));
RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)singleton_class);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
@@ -8765,16 +9008,16 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
CHECK(compile_const_prefix(iseq, node, pref, body));
if (LIST_INSN_SIZE_ZERO(pref)) {
if (ISEQ_COMPILE_DATA(iseq)->option->inline_const_cache) {
- ADD_INSN2(ret, line, opt_getinlinecache, lend, INT2FIX(ic_index));
+ ADD_INSN2(ret, line_node, opt_getinlinecache, lend, INT2FIX(ic_index));
}
else {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
}
ADD_SEQ(ret, body);
if (ISEQ_COMPILE_DATA(iseq)->option->inline_const_cache) {
- ADD_INSN1(ret, line, opt_setinlinecache, INT2FIX(ic_index));
+ ADD_INSN1(ret, line_node, opt_setinlinecache, INT2FIX(ic_index));
ADD_LABEL(ret, lend);
}
}
@@ -8785,12 +9028,12 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
}
else {
/* function call */
- ADD_CALL_RECEIVER(ret, line);
+ ADD_CALL_RECEIVER(ret, line_node);
CHECK(COMPILE(ret, "colon2#nd_head", node->nd_head));
- ADD_CALL(ret, line, node->nd_mid, INT2FIX(1));
+ ADD_CALL(ret, line_node, node->nd_mid, INT2FIX(1));
}
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
@@ -8802,21 +9045,21 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
/* add cache insn */
if (ISEQ_COMPILE_DATA(iseq)->option->inline_const_cache) {
- ADD_INSN2(ret, line, opt_getinlinecache, lend, INT2FIX(ic_index));
- ADD_INSN(ret, line, pop);
+ ADD_INSN2(ret, line_node, opt_getinlinecache, lend, INT2FIX(ic_index));
+ ADD_INSN(ret, line_node, pop);
}
- ADD_INSN1(ret, line, putobject, rb_cObject);
- ADD_INSN1(ret, line, putobject, Qtrue);
- ADD_INSN1(ret, line, getconstant, ID2SYM(node->nd_mid));
+ ADD_INSN1(ret, line_node, putobject, rb_cObject);
+ ADD_INSN1(ret, line_node, putobject, Qtrue);
+ ADD_INSN1(ret, line_node, getconstant, ID2SYM(node->nd_mid));
if (ISEQ_COMPILE_DATA(iseq)->option->inline_const_cache) {
- ADD_INSN1(ret, line, opt_setinlinecache, INT2FIX(ic_index));
+ ADD_INSN1(ret, line_node, opt_setinlinecache, INT2FIX(ic_index));
ADD_LABEL(ret, lend);
}
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
@@ -8832,7 +9075,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
VALUE bv = nd_type(b) == NODE_LIT ? b->nd_lit : Qnil;
VALUE ev = nd_type(e) == NODE_LIT ? e->nd_lit : Qnil;
VALUE val = rb_range_new(bv, ev, excl);
- ADD_INSN1(ret, line, putobject, val);
+ ADD_INSN1(ret, line_node, putobject, val);
RB_OBJ_WRITTEN(iseq, Qundef, val);
}
}
@@ -8840,7 +9083,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
CHECK(COMPILE_(ret, "min", b, popped));
CHECK(COMPILE_(ret, "max", e, popped));
if (!popped) {
- ADD_INSN1(ret, line, newrange, flag);
+ ADD_INSN1(ret, line_node, newrange, flag);
}
}
break;
@@ -8853,41 +9096,41 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
CHECK(compile_flip_flop(iseq, ret, node, type == NODE_FLIP2,
ltrue, lfalse));
ADD_LABEL(ret, ltrue);
- ADD_INSN1(ret, line, putobject, Qtrue);
- ADD_INSNL(ret, line, jump, lend);
+ ADD_INSN1(ret, line_node, putobject, Qtrue);
+ ADD_INSNL(ret, line_node, jump, lend);
ADD_LABEL(ret, lfalse);
- ADD_INSN1(ret, line, putobject, Qfalse);
+ ADD_INSN1(ret, line_node, putobject, Qfalse);
ADD_LABEL(ret, lend);
break;
}
case NODE_SELF:{
if (!popped) {
- ADD_INSN(ret, line, putself);
+ ADD_INSN(ret, line_node, putself);
}
break;
}
case NODE_NIL:{
if (!popped) {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
}
break;
}
case NODE_TRUE:{
if (!popped) {
- ADD_INSN1(ret, line, putobject, Qtrue);
+ ADD_INSN1(ret, line_node, putobject, Qtrue);
}
break;
}
case NODE_FALSE:{
if (!popped) {
- ADD_INSN1(ret, line, putobject, Qfalse);
+ ADD_INSN1(ret, line_node, putobject, Qfalse);
}
break;
}
case NODE_ERRINFO:{
if (!popped) {
if (body->type == ISEQ_TYPE_RESCUE) {
- ADD_GETLOCAL(ret, line, LVAR_ERRINFO, 0);
+ ADD_GETLOCAL(ret, line_node, LVAR_ERRINFO, 0);
}
else {
const rb_iseq_t *ip = iseq;
@@ -8900,10 +9143,10 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
level++;
}
if (ip) {
- ADD_GETLOCAL(ret, line, LVAR_ERRINFO, level);
+ ADD_GETLOCAL(ret, line_node, LVAR_ERRINFO, level);
}
else {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
}
}
}
@@ -8925,11 +9168,11 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
new_child_iseq_with_callback(iseq, ifunc,
rb_fstring(make_name_for_block(iseq)), iseq, ISEQ_TYPE_BLOCK, line);
- ADD_INSN2(ret, line, once, once_iseq, INT2FIX(is_index));
+ ADD_INSN2(ret, line_node, once, once_iseq, INT2FIX(is_index));
RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)once_iseq);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
@@ -8958,8 +9201,8 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
int kw_bits_idx = body->local_table_size - body->param.keyword->bits_start;
int keyword_idx = body->param.keyword->num;
- ADD_INSN2(ret, line, checkkeyword, INT2FIX(kw_bits_idx + VM_ENV_DATA_SIZE - 1), INT2FIX(keyword_idx));
- ADD_INSNL(ret, line, branchif, end_label);
+ ADD_INSN2(ret, line_node, checkkeyword, INT2FIX(kw_bits_idx + VM_ENV_DATA_SIZE - 1), INT2FIX(keyword_idx));
+ ADD_INSNL(ret, line_node, branchif, end_label);
CHECK(COMPILE_POPPED(ret, "keyword default argument", node->nd_body));
ADD_LABEL(ret, end_label);
}
@@ -8969,10 +9212,10 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
case NODE_DSYM:{
compile_dstr(iseq, ret, node);
if (!popped) {
- ADD_INSN(ret, line, intern);
+ ADD_INSN(ret, line_node, intern);
}
else {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
@@ -8999,13 +9242,13 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
CHECK(COMPILE(ret, "recv", node->nd_recv));
CHECK(COMPILE(ret, "value", node->nd_args->nd_next->nd_head));
if (!popped) {
- ADD_INSN(ret, line, swap);
- ADD_INSN1(ret, line, topn, INT2FIX(1));
+ ADD_INSN(ret, line_node, swap);
+ ADD_INSN1(ret, line_node, topn, INT2FIX(1));
}
- ADD_INSN2(ret, line, opt_aset_with, str,
+ ADD_INSN2(ret, line_node, opt_aset_with, str,
new_callinfo(iseq, idASET, 2, 0, NULL, FALSE));
RB_OBJ_WRITTEN(iseq, Qundef, str);
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
break;
}
@@ -9024,40 +9267,40 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
if (!rb_is_attrset_id(mid)) {
/* safe nav attr */
mid = rb_id_attrset(mid);
- else_label = qcall_branch_start(iseq, recv, &branches, node, line);
+ else_label = qcall_branch_start(iseq, recv, &branches, node, line_node);
}
if (!popped) {
- ADD_INSN(ret, line, putnil);
+ ADD_INSN(ret, line_node, putnil);
ADD_SEQ(ret, recv);
ADD_SEQ(ret, args);
if (flag & VM_CALL_ARGS_BLOCKARG) {
- ADD_INSN1(ret, line, topn, INT2FIX(1));
+ ADD_INSN1(ret, line_node, topn, INT2FIX(1));
if (flag & VM_CALL_ARGS_SPLAT) {
- ADD_INSN1(ret, line, putobject, INT2FIX(-1));
- ADD_SEND_WITH_FLAG(ret, line, idAREF, INT2FIX(1), INT2FIX(asgnflag));
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(-1));
+ ADD_SEND_WITH_FLAG(ret, line_node, idAREF, INT2FIX(1), INT2FIX(asgnflag));
}
- ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 3));
- ADD_INSN (ret, line, pop);
+ ADD_INSN1(ret, line_node, setn, FIXNUM_INC(argc, 3));
+ ADD_INSN (ret, line_node, pop);
}
else if (flag & VM_CALL_ARGS_SPLAT) {
- ADD_INSN(ret, line, dup);
- ADD_INSN1(ret, line, putobject, INT2FIX(-1));
- ADD_SEND_WITH_FLAG(ret, line, idAREF, INT2FIX(1), INT2FIX(asgnflag));
- ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2));
- ADD_INSN (ret, line, pop);
+ ADD_INSN(ret, line_node, dup);
+ ADD_INSN1(ret, line_node, putobject, INT2FIX(-1));
+ ADD_SEND_WITH_FLAG(ret, line_node, idAREF, INT2FIX(1), INT2FIX(asgnflag));
+ ADD_INSN1(ret, line_node, setn, FIXNUM_INC(argc, 2));
+ ADD_INSN (ret, line_node, pop);
}
else {
- ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 1));
+ ADD_INSN1(ret, line_node, setn, FIXNUM_INC(argc, 1));
}
}
else {
ADD_SEQ(ret, recv);
ADD_SEQ(ret, args);
}
- ADD_SEND_WITH_FLAG(ret, line, mid, argc, INT2FIX(flag));
- qcall_branch_end(iseq, ret, else_label, branches, node, line);
- ADD_INSN(ret, line, pop);
+ ADD_SEND_WITH_FLAG(ret, line_node, mid, argc, INT2FIX(flag));
+ qcall_branch_end(iseq, ret, else_label, branches, node, line_node);
+ ADD_INSN(ret, line_node, pop);
break;
}
@@ -9066,12 +9309,12 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
const rb_iseq_t *block = NEW_CHILD_ISEQ(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, line);
VALUE argc = INT2FIX(0);
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_CALL_WITH_BLOCK(ret, line, idLambda, argc, block);
+ ADD_INSN1(ret, line_node, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
+ ADD_CALL_WITH_BLOCK(ret, line_node, idLambda, argc, block);
RB_OBJ_WRITTEN(iseq, Qundef, (VALUE)block);
if (popped) {
- ADD_INSN(ret, line, pop);
+ ADD_INSN(ret, line_node, pop);
}
break;
}
@@ -9461,13 +9704,13 @@ event_name_to_flag(VALUE sym)
static int
iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
- VALUE body, VALUE labels_wrapper)
+ VALUE body, VALUE node_ids, VALUE labels_wrapper)
{
/* TODO: body should be frozen */
long i, len = RARRAY_LEN(body);
struct st_table *labels_table = DATA_PTR(labels_wrapper);
int j;
- int line_no = 0;
+ int line_no = 0, node_id = -1, insn_idx = 0;
int ret = COMPILE_OK;
/*
@@ -9501,6 +9744,10 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
st_data_t insn_id;
VALUE insn;
+ if (node_ids) {
+ node_id = NUM2INT(rb_ary_entry(node_ids, insn_idx++));
+ }
+
insn = (argc < 0) ? Qnil : RARRAY_AREF(obj, 0);
if (st_lookup(insn_table, (st_data_t)insn, &insn_id) == 0) {
/* TODO: exception */
@@ -9521,8 +9768,9 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
argv = compile_data_calloc2(iseq, sizeof(VALUE), argc);
// add element before operand setup to make GC root
+ NODE dummy_line_node = generate_dummy_line_node(line_no, node_id);
ADD_ELEM(anchor,
- (LINK_ELEMENT*)new_insn_core(iseq, line_no,
+ (LINK_ELEMENT*)new_insn_core(iseq, &dummy_line_node,
(enum ruby_vminsn_type)insn_id, argc, argv));
for (j=0; j<argc; j++) {
@@ -9604,8 +9852,9 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
}
}
else {
+ NODE dummy_line_node = generate_dummy_line_node(line_no, node_id);
ADD_ELEM(anchor,
- (LINK_ELEMENT*)new_insn_core(iseq, line_no,
+ (LINK_ELEMENT*)new_insn_core(iseq, &dummy_line_node,
(enum ruby_vminsn_type)insn_id, argc, NULL));
}
}
@@ -9809,6 +10058,14 @@ rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc, VALUE locals, VALUE params,
#undef INT_PARAM
}
+ VALUE node_ids = Qfalse;
+#ifdef USE_ISEQ_NODE_ID
+ node_ids = rb_hash_aref(misc, ID2SYM(rb_intern("node_ids")));
+ if (!RB_TYPE_P(node_ids, T_ARRAY)) {
+ rb_raise(rb_eTypeError, "node_ids is not an array");
+ }
+#endif
+
if (RB_TYPE_P(arg_opt_labels, T_ARRAY)) {
len = RARRAY_LENINT(arg_opt_labels);
iseq->body->param.flags.has_opt = !!(len - 1 >= 0);
@@ -9858,7 +10115,7 @@ rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc, VALUE locals, VALUE params,
iseq_build_from_ary_exception(iseq, labels_table, exception);
/* body */
- iseq_build_from_ary_body(iseq, anchor, body, labels_wrapper);
+ iseq_build_from_ary_body(iseq, anchor, body, node_ids, labels_wrapper);
iseq->body->param.size = arg_size;
iseq->body->local_table_size = local_size;
@@ -9962,8 +10219,9 @@ for_self_aref(rb_iseq_t *iseq, LINK_ANCHOR *ret, const void *a)
body->param.lead_num = 0;
body->param.size = 0;
- ADD_INSN1(ret, line, putobject, args->arg);
- ADD_INSN1(ret, line, invokebuiltin, args->func);
+ NODE dummy_line_node = generate_dummy_line_node(line, -1);
+ ADD_INSN1(ret, &dummy_line_node, putobject, args->arg);
+ ADD_INSN1(ret, &dummy_line_node, invokebuiltin, args->func);
}
static void
@@ -9978,9 +10236,10 @@ for_self_aset(rb_iseq_t *iseq, LINK_ANCHOR *ret, const void *a)
body->param.lead_num = 1;
body->param.size = 1;
- ADD_GETLOCAL(ret, line, numberof(vars)-1, 0);
- ADD_INSN1(ret, line, putobject, args->arg);
- ADD_INSN1(ret, line, invokebuiltin, args->func);
+ NODE dummy_line_node = generate_dummy_line_node(line, -1);
+ ADD_GETLOCAL(ret, &dummy_line_node, numberof(vars)-1, 0);
+ ADD_INSN1(ret, &dummy_line_node, putobject, args->arg);
+ ADD_INSN1(ret, &dummy_line_node, invokebuiltin, args->func);
}
/*
@@ -10515,7 +10774,6 @@ ibf_load_code(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t bytecod
/* operands */
for (op_index=0; types[op_index]; op_index++, code_index++) {
switch (types[op_index]) {
- case TS_CDHASH:
case TS_VALUE:
{
VALUE op = ibf_load_small_value(load, &reading_pos);
@@ -10527,6 +10785,20 @@ ibf_load_code(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t bytecod
}
break;
}
+ case TS_CDHASH:
+ {
+ VALUE op = ibf_load_small_value(load, &reading_pos);
+ VALUE v = ibf_load_object(load, op);
+ v = rb_hash_dup(v); // hash dumped as frozen
+ RHASH_TBL_RAW(v)->type = &cdhash_type;
+ rb_hash_rehash(v); // hash function changed
+ freeze_hide_obj(v);
+
+ code[code_index] = v;
+ RB_OBJ_WRITTEN(iseqv, Qundef, v);
+ FL_SET(iseqv, ISEQ_MARKABLE_ISEQ);
+ break;
+ }
case TS_ISEQ:
{
VALUE op = (VALUE)ibf_load_small_value(load, &reading_pos);
@@ -10668,6 +10940,9 @@ ibf_dump_insns_info_body(struct ibf_dump *dump, const rb_iseq_t *iseq)
unsigned int i;
for (i = 0; i < iseq->body->insns_info.size; i++) {
ibf_dump_write_small_value(dump, entries[i].line_no);
+#ifdef USE_ISEQ_NODE_ID
+ ibf_dump_write_small_value(dump, entries[i].node_id);
+#endif
ibf_dump_write_small_value(dump, entries[i].events);
}
@@ -10683,6 +10958,9 @@ ibf_load_insns_info_body(const struct ibf_load *load, ibf_offset_t body_offset,
unsigned int i;
for (i = 0; i < size; i++) {
entries[i].line_no = (int)ibf_load_small_value(load, &reading_pos);
+#ifdef USE_ISEQ_NODE_ID
+ entries[i].node_id = (int)ibf_load_small_value(load, &reading_pos);
+#endif
entries[i].events = (rb_event_flag_t)ibf_load_small_value(load, &reading_pos);
}
@@ -11437,7 +11715,8 @@ ibf_load_object_string(const struct ibf_load *load, const struct ibf_object_head
VALUE str;
if (header->frozen && !header->internal) {
str = rb_enc_interned_str(ptr, len, rb_enc_from_index(encindex));
- } else {
+ }
+ else {
str = rb_enc_str_new(ptr, len, rb_enc_from_index(encindex));
if (header->internal) rb_obj_hide(str);
diff --git a/complex.c b/complex.c
index fe8def2..09e47f8 100644
--- a/complex.c
+++ b/complex.c
@@ -1272,7 +1272,7 @@ rb_complex_conjugate(VALUE self)
* Returns false, even if the complex number has no imaginary part.
*/
static VALUE
-nucomp_false(VALUE self)
+nucomp_real_p_m(VALUE self)
{
return Qfalse;
}
@@ -1326,8 +1326,8 @@ nucomp_numerator(VALUE self)
}
/* :nodoc: */
-static VALUE
-nucomp_hash(VALUE self)
+st_index_t
+rb_complex_hash(VALUE self)
{
st_index_t v, h[2];
VALUE n;
@@ -1338,7 +1338,13 @@ nucomp_hash(VALUE self)
n = rb_hash(dat->imag);
h[1] = NUM2LONG(n);
v = rb_memhash(h, sizeof(h));
- return ST2FIX(v);
+ return v;
+}
+
+static VALUE
+nucomp_hash(VALUE self)
+{
+ return ST2FIX(rb_complex_hash(self));
}
/* :nodoc: */
@@ -2379,7 +2385,7 @@ Init_Complex(void)
rb_define_method(rb_cComplex, "conjugate", rb_complex_conjugate, 0);
rb_define_method(rb_cComplex, "conj", rb_complex_conjugate, 0);
- rb_define_method(rb_cComplex, "real?", nucomp_false, 0);
+ rb_define_method(rb_cComplex, "real?", nucomp_real_p_m, 0);
rb_define_method(rb_cComplex, "numerator", nucomp_numerator, 0);
rb_define_method(rb_cComplex, "denominator", nucomp_denominator, 0);
diff --git a/configure.ac b/configure.ac
index 27899f7..38ab4bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,43 +9,43 @@ tooldir="$srcdir/tool"
AC_DISABLE_OPTION_CHECKING
-m4_include([tool/m4/_colorize_result_prepare.m4])
-m4_include([tool/m4/ac_msg_result.m4])
-m4_include([tool/m4/colorize_result.m4])
-m4_include([tool/m4/ruby_append_option.m4])
-m4_include([tool/m4/ruby_append_options.m4])
-m4_include([tool/m4/ruby_check_builtin_func.m4])
-m4_include([tool/m4/ruby_check_builtin_setjmp.m4])
-m4_include([tool/m4/ruby_check_printf_prefix.m4])
-m4_include([tool/m4/ruby_check_setjmp.m4])
-m4_include([tool/m4/ruby_check_signedness.m4])
-m4_include([tool/m4/ruby_check_sizeof.m4])
-m4_include([tool/m4/ruby_check_sysconf.m4])
-m4_include([tool/m4/ruby_cppoutfile.m4])
-m4_include([tool/m4/ruby_decl_attribute.m4])
-m4_include([tool/m4/ruby_default_arch.m4])
-m4_include([tool/m4/ruby_define_if.m4])
-m4_include([tool/m4/ruby_defint.m4])
-m4_include([tool/m4/ruby_dtrace_available.m4])
-m4_include([tool/m4/ruby_dtrace_postprocess.m4])
-m4_include([tool/m4/ruby_func_attribute.m4])
-m4_include([tool/m4/ruby_mingw32.m4])
-m4_include([tool/m4/ruby_prepend_option.m4])
-m4_include([tool/m4/ruby_prog_gnu_ld.m4])
-m4_include([tool/m4/ruby_replace_funcs.m4])
-m4_include([tool/m4/ruby_replace_type.m4])
-m4_include([tool/m4/ruby_rm_recursive.m4])
-m4_include([tool/m4/ruby_setjmp_type.m4])
-m4_include([tool/m4/ruby_stack_grow_direction.m4])
-m4_include([tool/m4/ruby_try_cflags.m4])
-m4_include([tool/m4/ruby_try_cxxflags.m4])
-m4_include([tool/m4/ruby_try_ldflags.m4])
-m4_include([tool/m4/ruby_universal_arch.m4])
-m4_include([tool/m4/ruby_werror_flag.m4])
-
-AC_ARG_VAR([cflags], [additional CFLAGS (ignored when CFLAGS is given)])
-AC_ARG_VAR([cppflags], [additional CPPFLAGS (ignored when CPPFLAGS is given)])
-AC_ARG_VAR([cxxflags], [additional CXXFLAGS (ignored when CXXFLAGS is given)])
+m4_include([tool/m4/_colorize_result_prepare.m4])dnl
+m4_include([tool/m4/ac_msg_result.m4])dnl
+m4_include([tool/m4/colorize_result.m4])dnl
+m4_include([tool/m4/ruby_append_option.m4])dnl
+m4_include([tool/m4/ruby_append_options.m4])dnl
+m4_include([tool/m4/ruby_check_builtin_func.m4])dnl
+m4_include([tool/m4/ruby_check_builtin_setjmp.m4])dnl
+m4_include([tool/m4/ruby_check_printf_prefix.m4])dnl
+m4_include([tool/m4/ruby_check_setjmp.m4])dnl
+m4_include([tool/m4/ruby_check_signedness.m4])dnl
+m4_include([tool/m4/ruby_check_sizeof.m4])dnl
+m4_include([tool/m4/ruby_check_sysconf.m4])dnl
+m4_include([tool/m4/ruby_cppoutfile.m4])dnl
+m4_include([tool/m4/ruby_decl_attribute.m4])dnl
+m4_include([tool/m4/ruby_default_arch.m4])dnl
+m4_include([tool/m4/ruby_define_if.m4])dnl
+m4_include([tool/m4/ruby_defint.m4])dnl
+m4_include([tool/m4/ruby_dtrace_available.m4])dnl
+m4_include([tool/m4/ruby_dtrace_postprocess.m4])dnl
+m4_include([tool/m4/ruby_func_attribute.m4])dnl
+m4_include([tool/m4/ruby_mingw32.m4])dnl
+m4_include([tool/m4/ruby_prepend_option.m4])dnl
+m4_include([tool/m4/ruby_prog_gnu_ld.m4])dnl
+m4_include([tool/m4/ruby_replace_funcs.m4])dnl
+m4_include([tool/m4/ruby_replace_type.m4])dnl
+m4_include([tool/m4/ruby_rm_recursive.m4])dnl
+m4_include([tool/m4/ruby_setjmp_type.m4])dnl
+m4_include([tool/m4/ruby_stack_grow_direction.m4])dnl
+m4_include([tool/m4/ruby_try_cflags.m4])dnl
+m4_include([tool/m4/ruby_try_cxxflags.m4])dnl
+m4_include([tool/m4/ruby_try_ldflags.m4])dnl
+m4_include([tool/m4/ruby_universal_arch.m4])dnl
+m4_include([tool/m4/ruby_werror_flag.m4])dnl
+
+AC_ARG_VAR([cflags], [additional CFLAGS (ignored when CFLAGS is given)])dnl
+AC_ARG_VAR([cppflags], [additional CPPFLAGS (ignored when CPPFLAGS is given)])dnl
+AC_ARG_VAR([cxxflags], [additional CXXFLAGS (ignored when CXXFLAGS is given)])dnl
: "environment section" && {
HAVE_BASERUBY=yes
@@ -135,8 +135,15 @@ AS_IF([test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"], [
AC_MSG_ERROR(cached CC is different -- throw away $cache_file
(it is also a good idea to do 'make clean' before compiling))
])
-AS_CASE(["${build_os}"], [linux*|cygwin*|msys*], [
+AS_CASE(["${build_os}"],
+[linux*|cygwin*|msys*], [
+ # Naruse prefers GCC on Linux
AC_CHECK_TOOLS([CC], [gcc clang cc])
+],
+[solaris*], [
+ # Clang on Solaris is largely untested.
+ # https://bugs.ruby-lang.org/issues/17949
+ AC_CHECK_TOOLS([CC], [cc gcc])
], [
# OpenBSD wants to prefer cc over gcc.
# See https://github.com/ruby/ruby/pull/2443
@@ -486,11 +493,10 @@ done
AC_MSG_CHECKING([whether it is Android])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- @%:@ifdef __ANDROID__
- @%:@error android
+ @%:@ifndef __ANDROID__
+ @%:@error Not android
@%:@endif
]], [[]])],
-[AC_MSG_RESULT(no)],
[
AC_MSG_RESULT(yes)
target_os=${target_os}-android
@@ -501,7 +507,8 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
AC_MSG_RESULT($rb_android_api)
RUBY_APPEND_OPTIONS(CPPFLAGS, -D__ANDROID_API__=$rb_android_api -Wno-macro-redefined)
])
-])
+],
+[AC_MSG_RESULT(no)])
AC_SUBST(RM, ['rm -f'])
AC_SUBST(CP, ['cp'])
@@ -662,6 +669,18 @@ AS_CASE(["$GCC:${warnflags+set}:${extra_warnflags:+set}:"],
])
])
done
+ AS_IF([test "$particular_werror_flags" = "yes"], [
+ wflag=-Werror=undef
+ ], [
+ wflag=-Wundef
+ ])
+ RUBY_TRY_CFLAGS($wflag, [
+ RUBY_APPEND_OPTIONS(warnflags, $wflag)
+ ], [], [
+ @%:@if !defined(RUBY_CONFIG_TEST_NEVER_DEFINED_SYMBOL)
+ @%:@elif RUBY_CONFIG_TEST_NEVER_DEFINED_SYMBOL
+ @%:@endif
+ ])
AS_CASE([" $warnflags "],[*" -Wno-missing-field-initializers "*], [wflag="-Wall -Wextra"],
[wflag=-Wall])
RUBY_TRY_CFLAGS($wflag, [warnflags="$wflag${warnflags+ $warnflags}"])
@@ -1846,10 +1865,16 @@ AS_CASE(["$target_os"],[freebsd*],[
AC_REPLACE_FUNCS(close)
])
+AC_DEFUN([RUBY_REQUIRE_FUNC], [
+ AC_CHECK_FUNCS([$1])
+ AS_IF([test "$ac_cv_func_[]AS_TR_SH($1)" = yes], [],
+ [AC_MSG_ERROR($1[() must be supported])])
+])
+m4_map_args_w([dup dup2], [RUBY_REQUIRE_FUNC(], [)])
+
AC_REPLACE_FUNCS(acosh)
AC_REPLACE_FUNCS(cbrt)
AC_REPLACE_FUNCS(crypt)
-AC_REPLACE_FUNCS(dup2)
AC_REPLACE_FUNCS(erf)
AC_REPLACE_FUNCS(explicit_bzero)
AC_REPLACE_FUNCS(ffs)
@@ -1910,7 +1935,6 @@ AC_CHECK_FUNCS(dirfd)
AC_CHECK_FUNCS(dl_iterate_phdr)
AC_CHECK_FUNCS(dlopen)
AC_CHECK_FUNCS(dladdr)
-AC_CHECK_FUNCS(dup)
AC_CHECK_FUNCS(dup3)
AC_CHECK_FUNCS(eaccess)
AC_CHECK_FUNCS(endgrent)
@@ -2106,6 +2130,7 @@ AS_IF([test x$rb_cv_builtin___builtin_choose_expr = xyes], [
])
RUBY_CHECK_BUILTIN_FUNC(__builtin_types_compatible_p, [__builtin_types_compatible_p(int, int)])
RUBY_CHECK_BUILTIN_FUNC(__builtin_trap, [__builtin_trap()])
+RUBY_CHECK_BUILTIN_FUNC(__builtin_expect, [__builtin_expect(0, 0)])
AS_IF([test "$ac_cv_func_qsort_r" != no], [
AC_CACHE_CHECK(whether qsort_r is GNU version, rb_cv_gnu_qsort_r,
@@ -2713,6 +2738,51 @@ main(int argc, char *argv[])
rb_cv_fork_with_pthread=yes)])
test x$rb_cv_fork_with_pthread = xyes || AC_DEFINE(CANNOT_FORK_WITH_PTHREAD)
])
+
+AC_CHECK_HEADERS([sys/user.h])
+AS_IF([test "x$ac_cv_func_mmap" = xyes], [
+ AC_CACHE_CHECK([whether PAGE_SIZE is compile-time const], rb_cv_const_page_size,
+ [malloc_headers=`sed -n '/MALLOC_HEADERS_BEGIN/,/MALLOC_HEADERS_END/p' ${srcdir}/gc.c`
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$malloc_headers
+ typedef char conftest_page[PAGE_SIZE];
+ ]], [[]])],
+ [rb_cv_const_page_size=yes],
+ [rb_cv_const_page_size=no])])
+])
+AS_IF([test "x$rb_cv_const_page_size" = xyes],
+ [AC_DEFINE(HAVE_CONST_PAGE_SIZE, 1)],
+ [AC_DEFINE(HAVE_CONST_PAGE_SIZE, 0)]
+)
+
+AS_IF([test "x$ac_cv_func_ioctl" = xyes], [
+ AC_CACHE_CHECK([ioctl request type], rb_cv_ioctl_request_type,
+ [rb_cv_ioctl_request_type=no
+ dnl corresponding NUM2IOCTLREQ needs to be defined
+ for type in "unsigned long:ULONG_MAX" int:INT_MAX; do
+ max=`echo $type | sed 's/.*://'`
+ type=`echo $type | sed 's/:.*//'`
+ RUBY_WERROR_FLAG([
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ @%:@include <limits.h>
+ @%:@include <sys/types.h>
+ @%:@if defined(HAVE_SYS_IOCTL_H) && !defined(_WIN32)
+ @%:@include <sys/ioctl.h>
+ @%:@endif
+ ]], [[
+ $type req = $max;
+ if (ioctl(0, req)) {/* do nothing*/};
+ ]])],
+ [rb_cv_ioctl_request_type="$type"])
+ ])
+ test "x$rb_cv_ioctl_request_type" = xno || break
+ done])
+ AS_CASE(["$rb_cv_ioctl_request_type"], [no|int], [],
+ ["unsigned long"], [
+ AC_DEFINE_UNQUOTED(IOCTL_REQ_TYPE, [$rb_cv_ioctl_request_type])
+ AC_DEFINE_UNQUOTED(NUM2IOCTLREQ(num), [NUM2ULONG(num)])
+ ])
+])
+
}
: "runtime section" && {
diff --git a/cont.c b/cont.c
index bdd3085..00ab1e9 100644
--- a/cont.c
+++ b/cont.c
@@ -436,7 +436,7 @@ fiber_pool_allocate_memory(size_t * count, size_t stride)
#if defined(MADV_FREE_REUSE)
// On Mac MADV_FREE_REUSE is necessary for the task_info api
// to keep the accounting accurate as possible when a page is marked as reusable
- // it can possibly not occuring at first call thus re-iterating if necessary.
+ // it can possibly not occurring at first call thus re-iterating if necessary.
while (madvise(base, (*count)*stride, MADV_FREE_REUSE) == -1 && errno == EAGAIN);
#endif
return base;
@@ -657,7 +657,7 @@ fiber_pool_stack_free(struct fiber_pool_stack * stack)
#elif defined(MADV_FREE_REUSABLE)
// Acknowledge the kernel down to the task info api we make this
// page reusable for future use.
- // As for MADV_FREE_REUSE below we ensure in the rare occassions the task was not
+ // As for MADV_FREE_REUSE below we ensure in the rare occasions the task was not
// completed at the time of the call to re-iterate.
while (madvise(base, size, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN);
#elif defined(MADV_FREE)
@@ -2000,7 +2000,7 @@ rb_fiber_s_scheduler(VALUE klass)
* Fiber.current_scheduler -> obj or nil
*
* Returns the Fiber scheduler, that was last set for the current thread with Fiber.set_scheduler
- * iff the current fiber is non-blocking.
+ * if and only if the current fiber is non-blocking.
*
*/
static VALUE
@@ -2041,7 +2041,6 @@ rb_fiber_start(void)
rb_proc_t *proc;
enum ruby_tag_type state;
int need_interrupt = TRUE;
- VALUE err = Qfalse;
VM_ASSERT(th->ec == GET_EC());
VM_ASSERT(FIBER_RESUMED_P(fiber));
@@ -2067,6 +2066,7 @@ rb_fiber_start(void)
}
EC_POP_TAG();
+ VALUE err = Qfalse;
if (state) {
err = th->ec->errinfo;
VM_ASSERT(FIBER_RESUMED_P(fiber));
@@ -2500,7 +2500,7 @@ rb_fiber_m_resume(int argc, VALUE *argv, VALUE fiber)
return rb_fiber_resume_kw(fiber, argc, argv, rb_keyword_given_p());
}
-static VALUE rb_fiber_transfer_kw(VALUE fiber_value, int argc, VALUE *argv, int kw_splat);
+VALUE rb_fiber_transfer_kw(VALUE fiber_value, int argc, const VALUE *argv, int kw_splat);
/*
* call-seq:
@@ -2704,8 +2704,8 @@ rb_fiber_m_transfer(int argc, VALUE *argv, VALUE fiber_value)
return rb_fiber_transfer_kw(fiber_value, argc, argv, rb_keyword_given_p());
}
-static VALUE
-rb_fiber_transfer_kw(VALUE fiber_value, int argc, VALUE *argv, int kw_splat)
+VALUE
+rb_fiber_transfer_kw(VALUE fiber_value, int argc, const VALUE *argv, int kw_splat)
{
rb_fiber_t *fiber = fiber_ptr(fiber_value);
if (RTEST(fiber->resuming_fiber)) {
diff --git a/coroutine/copy/Context.h b/coroutine/copy/Context.h
index db13604..2cb2bc1 100644
--- a/coroutine/copy/Context.h
+++ b/coroutine/copy/Context.h
@@ -23,9 +23,12 @@
#define COROUTINE __attribute__((noreturn)) void
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
#if INTPTR_MAX <= INT32_MAX
#define COROUTINE_LIMITED_ADDRESS_SPACE
#endif
+#endif
// This stack copying implementation which uses a private stack for each coroutine, including the main one.
#define COROUTINE_PRIVATE_STACK
diff --git a/coroutine/ucontext/Context.h b/coroutine/ucontext/Context.h
index 7971086..39d7ca7 100644
--- a/coroutine/ucontext/Context.h
+++ b/coroutine/ucontext/Context.h
@@ -16,9 +16,12 @@
#define COROUTINE __attribute__((noreturn)) void
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
#if INTPTR_MAX <= INT32_MAX
#define COROUTINE_LIMITED_ADDRESS_SPACE
#endif
+#endif
struct coroutine_context
{
diff --git a/coverage/README b/coverage/README
index 78a0182..a4c3dfc 100644
--- a/coverage/README
+++ b/coverage/README
@@ -13,5 +13,5 @@ Limitation
TODO
- * more reduce bundled simplecov(additional configuration, formatter, etc)
+ * more reduce bundled simplecov(additional configuration, formatter, etc.)
* measure rubyspec coverage
diff --git a/debug_counter.h b/debug_counter.h
index 3c20821..9452f4c 100644
--- a/debug_counter.h
+++ b/debug_counter.h
@@ -46,10 +46,10 @@ RB_DEBUG_COUNTER(cc_not_found_in_ccs) // count for CC lookup success in CCS
RB_DEBUG_COUNTER(cc_ent_invalidate) // count for invalidating cc (cc->klass = 0)
RB_DEBUG_COUNTER(cc_cme_invalidate) // count for invalidating CME
-RB_DEBUG_COUNTER(cc_invalidate_leaf) // count for invalidating klass if klass has no-sublcasses
+RB_DEBUG_COUNTER(cc_invalidate_leaf) // count for invalidating klass if klass has no-subclasses
RB_DEBUG_COUNTER(cc_invalidate_leaf_ccs) // corresponding CCS
RB_DEBUG_COUNTER(cc_invalidate_leaf_callable) // complimented cache (no-subclasses)
-RB_DEBUG_COUNTER(cc_invalidate_tree) // count for invalidating klass if klass has sublcasses
+RB_DEBUG_COUNTER(cc_invalidate_tree) // count for invalidating klass if klass has subclasses
RB_DEBUG_COUNTER(cc_invalidate_tree_cme) // cme if cme is found in this class or superclasses
RB_DEBUG_COUNTER(cc_invalidate_tree_callable) // complimented cache (subclasses)
RB_DEBUG_COUNTER(cc_invalidate_negative) // count for invalidating negative cache
diff --git a/defs/gmake.mk b/defs/gmake.mk
index 316ff18..dc749b8 100644
--- a/defs/gmake.mk
+++ b/defs/gmake.mk
@@ -9,6 +9,7 @@ nproc = $(subst -j,,$(filter -j%,$(MFLAGS)))
ifneq ($(filter %darwin%,$(arch)),)
INSTRUBY_ENV += SDKROOT=/
endif
+INSTRUBY_ARGS += --gnumake
CHECK_TARGETS := great exam love check test check% test% btest%
# expand test targets, and those dependents
diff --git a/dir.c b/dir.c
index 8ff812e..d6a963f 100644
--- a/dir.c
+++ b/dir.c
@@ -50,13 +50,13 @@
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
# define HAVE_DIRENT_NAMLEN 1
-# if HAVE_SYS_NDIR_H
+# ifdef HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
-# if HAVE_SYS_DIR_H
+# ifdef HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
-# if HAVE_NDIR_H
+# ifdef HAVE_NDIR_H
# include <ndir.h>
# endif
# ifdef _WIN32
@@ -216,7 +216,7 @@ typedef enum {
#else
#define FNM_SYSCASE 0
#endif
-#if _WIN32
+#ifdef _WIN32
#define FNM_SHORTNAME 0x20
#else
#define FNM_SHORTNAME 0
@@ -3180,100 +3180,7 @@ fnmatch_brace(const char *pattern, VALUE val, void *enc)
return (fnmatch(pattern, enc, RSTRING_PTR(path), arg->flags) == 0);
}
-/*
- * call-seq:
- * File.fnmatch( pattern, path, [flags] ) -> (true or false)
- * File.fnmatch?( pattern, path, [flags] ) -> (true or false)
- *
- * Returns true if +path+ matches against +pattern+. The pattern is not a
- * regular expression; instead it follows rules similar to shell filename
- * globbing. It may contain the following metacharacters:
- *
- * <code>*</code>::
- * Matches any file. Can be restricted by other values in the glob.
- * Equivalent to <code>/ .* /x</code> in regexp.
- *
- * <code>*</code>:: Matches all files regular files
- * <code>c*</code>:: Matches all files beginning with <code>c</code>
- * <code>*c</code>:: Matches all files ending with <code>c</code>
- * <code>\*c*</code>:: Matches all files that have <code>c</code> in them
- * (including at the beginning or end).
- *
- * To match hidden files (that start with a <code>.</code> set the
- * File::FNM_DOTMATCH flag.
- *
- * <code>**</code>::
- * Matches directories recursively or files expansively.
- *
- * <code>?</code>::
- * Matches any one character. Equivalent to <code>/.{1}/</code> in regexp.
- *
- * <code>[set]</code>::
- * Matches any one character in +set+. Behaves exactly like character sets
- * in Regexp, including set negation (<code>[^a-z]</code>).
- *
- * <code> \ </code>::
- * Escapes the next metacharacter.
- *
- * <code>{a,b}</code>::
- * Matches pattern a and pattern b if File::FNM_EXTGLOB flag is enabled.
- * Behaves like a Regexp union (<code>(?:a|b)</code>).
- *
- * +flags+ is a bitwise OR of the <code>FNM_XXX</code> constants. The same
- * glob pattern and flags are used by Dir::glob.
- *
- * Examples:
- *
- * File.fnmatch('cat', 'cat') #=> true # match entire string
- * File.fnmatch('cat', 'category') #=> false # only match partial string
- *
- * File.fnmatch('c{at,ub}s', 'cats') #=> false # { } isn't supported by default
- * File.fnmatch('c{at,ub}s', 'cats', File::FNM_EXTGLOB) #=> true # { } is supported on FNM_EXTGLOB
- *
- * File.fnmatch('c?t', 'cat') #=> true # '?' match only 1 character
- * File.fnmatch('c??t', 'cat') #=> false # ditto
- * File.fnmatch('c*', 'cats') #=> true # '*' match 0 or more characters
- * File.fnmatch('c*t', 'c/a/b/t') #=> true # ditto
- * File.fnmatch('ca[a-z]', 'cat') #=> true # inclusive bracket expression
- * File.fnmatch('ca[^t]', 'cat') #=> false # exclusive bracket expression ('^' or '!')
- *
- * File.fnmatch('cat', 'CAT') #=> false # case sensitive
- * File.fnmatch('cat', 'CAT', File::FNM_CASEFOLD) #=> true # case insensitive
- * File.fnmatch('cat', 'CAT', File::FNM_SYSCASE) #=> true or false # depends on the system default
- *
- * File.fnmatch('?', '/', File::FNM_PATHNAME) #=> false # wildcard doesn't match '/' on FNM_PATHNAME
- * File.fnmatch('*', '/', File::FNM_PATHNAME) #=> false # ditto
- * File.fnmatch('[/]', '/', File::FNM_PATHNAME) #=> false # ditto
- *
- * File.fnmatch('\?', '?') #=> true # escaped wildcard becomes ordinary
- * File.fnmatch('\a', 'a') #=> true # escaped ordinary remains ordinary
- * File.fnmatch('\a', '\a', File::FNM_NOESCAPE) #=> true # FNM_NOESCAPE makes '\' ordinary
- * File.fnmatch('[\?]', '?') #=> true # can escape inside bracket expression
- *
- * File.fnmatch('*', '.profile') #=> false # wildcard doesn't match leading
- * File.fnmatch('*', '.profile', File::FNM_DOTMATCH) #=> true # period by default.
- * File.fnmatch('.*', '.profile') #=> true
- *
- * rbfiles = '**' '/' '*.rb' # you don't have to do like this. just write in single string.
- * File.fnmatch(rbfiles, 'main.rb') #=> false
- * File.fnmatch(rbfiles, './main.rb') #=> false
- * File.fnmatch(rbfiles, 'lib/song.rb') #=> true
- * File.fnmatch('**.rb', 'main.rb') #=> true
- * File.fnmatch('**.rb', './main.rb') #=> false
- * File.fnmatch('**.rb', 'lib/song.rb') #=> true
- * File.fnmatch('*', 'dave/.profile') #=> true
- *
- * pattern = '*' '/' '*'
- * File.fnmatch(pattern, 'dave/.profile', File::FNM_PATHNAME) #=> false
- * File.fnmatch(pattern, 'dave/.profile', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
- *
- * pattern = '**' '/' 'foo'
- * File.fnmatch(pattern, 'a/b/c/foo', File::FNM_PATHNAME) #=> true
- * File.fnmatch(pattern, '/a/b/c/foo', File::FNM_PATHNAME) #=> true
- * File.fnmatch(pattern, 'c:/a/b/c/foo', File::FNM_PATHNAME) #=> true
- * File.fnmatch(pattern, 'a/.b/c/foo', File::FNM_PATHNAME) #=> false
- * File.fnmatch(pattern, 'a/.b/c/foo', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
- */
+/* :nodoc: */
static VALUE
file_s_fnmatch(int argc, VALUE *argv, VALUE obj)
{
@@ -3439,16 +3346,6 @@ rb_dir_s_empty_p(VALUE obj, VALUE dirname)
return result;
}
-/*
- * Objects of class Dir are directory streams representing
- * directories in the underlying file system. They provide a variety
- * of ways to list directories and their contents. See also File.
- *
- * The directory used in these examples contains the two regular files
- * (<code>config.h</code> and <code>main.rb</code>), the parent
- * directory (<code>..</code>), and the directory itself
- * (<code>.</code>).
- */
void
Init_Dir(void)
{
diff --git a/dir.rb b/dir.rb
index eb46305..91f9c7f 100644
--- a/dir.rb
+++ b/dir.rb
@@ -1,3 +1,79 @@
+# Objects of class Dir are directory streams representing
+# directories in the underlying file system. They provide a variety
+# of ways to list directories and their contents. See also File.
+#
+# The directory used in these examples contains the two regular files
+# (<code>config.h</code> and <code>main.rb</code>), the parent
+# directory (<code>..</code>), and the directory itself
+# (<code>.</code>).
+#
+# == What's Here
+#
+# \Class \Dir provides methods that are useful for:
+#
+# - {Reading}[#class-Dir-label-Reading]
+# - {Setting}[#class-Dir-label-Setting]
+# - {Querying}[#class-Dir-label-Querying]
+# - {Iterating}[#class-Dir-label-Iterating]
+# - {Other}[#class-Dir-label-Other]
+#
+# === Reading
+#
+# - #close:: Closes the directory stream for +self+.
+# - #pos=:: Sets the position in the directory stream for +self+.
+# - #read:: Reads and returns the next entry in the directory stream for +self+.
+# - #rewind:: Sets the position in the directory stream for +self+ to the first entry.
+# - #seek:: Sets the position in the directory stream for +self+
+# the entry at the given offset.
+#
+# === Setting
+#
+# - ::chdir:: Changes the working directory of the current process
+# to the given directory.
+# - ::chroot:: Changes the file-system root for the current process
+# to the given directory.
+#
+# === Querying
+#
+# - ::[]:: Same as ::glob without the ability to pass flags.
+# - ::children:: Returns an array of names of the children
+# (both files and directories) of the given directory,
+# but not including <tt>.</tt> or <tt>..</tt>.
+# - ::empty?:: Returns whether the given path is an empty directory.
+# - ::entries:: Returns an array of names of the children
+# (both files and directories) of the given directory,
+# including <tt>.</tt> and <tt>..</tt>.
+# - ::exist?:: Returns whether the given path is a directory.
+# - ::getwd (aliased as #pwd):: Returns the path to the current working directory.
+# - ::glob:: Returns an array of file paths matching the given pattern and flags.
+# - ::home:: Returns the home directory path for a given user or the current user.
+# - #children:: Returns an array of names of the children
+# (both files and directories) of +self+,
+# but not including <tt>.</tt> or <tt>..</tt>.
+# - #fileno:: Returns the integer file descriptor for +self+.
+# - #path (aliased as #to_path):: Returns the path used to create +self+.
+# - #tell (aliased as #pos):: Returns the integer position
+# in the directory stream for +self+.
+#
+# === Iterating
+#
+# - ::each_child:: Calls the given block with each entry in the given directory,
+# but not including <tt>.</tt> or <tt>..</tt>.
+# - ::foreach:: Calls the given block with each entryin the given directory,
+# including <tt>.</tt> and <tt>..</tt>.
+# - #each:: Calls the given block with each entry in +self+,
+# including <tt>.</tt> and <tt>..</tt>.
+# - #each_child:: Calls the given block with each entry in +self+,
+# but not including <tt>.</tt> or <tt>..</tt>.
+#
+# === Other
+#
+# - ::mkdir:: Creates a directory at the given path, with optional permissions.
+# - ::new:: Returns a new \Dir for the given path, with optional encoding.
+# - ::open:: Same as ::new, but if a block is given, yields the \Dir to the block,
+# closing it upon block exit.
+# - ::unlink (aliased as ::delete and ::rmdir):: Removes the given directory.
+# - #inspect:: Returns a string description of +self+.
class Dir
# Dir.open( string ) -> aDir
# Dir.open( string, encoding: enc ) -> aDir
@@ -68,7 +144,7 @@ class Dir
#
# <code>*</code>::
# Matches any file. Can be restricted by other values in the glob.
- # Equivalent to <code>/ .* /mx</code> in regexp.
+ # Equivalent to <code>/.*/mx</code> in regexp.
#
# <code>*</code>:: Matches all files
# <code>c*</code>:: Matches all files beginning with <code>c</code>
@@ -99,7 +175,7 @@ class Dir
# Matching literals may be more than one character in length. More than
# two literals may be specified.
#
- # <code> \\ </code>::
+ # <code>\\</code>::
# Escapes the next metacharacter.
#
# Note that this means you cannot use backslash on windows as part of a
@@ -134,3 +210,101 @@ class Dir
Primitive.dir_s_glob(pattern, flags, base, sort)
end
end
+
+class << File
+ # call-seq:
+ # File.fnmatch( pattern, path, [flags] ) -> (true or false)
+ # File.fnmatch?( pattern, path, [flags] ) -> (true or false)
+ #
+ # Returns true if +path+ matches against +pattern+. The pattern is not a
+ # regular expression; instead it follows rules similar to shell filename
+ # globbing. It may contain the following metacharacters:
+ #
+ # <code>*</code>::
+ # Matches any file. Can be restricted by other values in the glob.
+ # Equivalent to <code>/.*/x</code> in regexp.
+ #
+ # <code>*</code>:: Matches all files regular files
+ # <code>c*</code>:: Matches all files beginning with <code>c</code>
+ # <code>*c</code>:: Matches all files ending with <code>c</code>
+ # <code>\*c*</code>:: Matches all files that have <code>c</code> in them
+ # (including at the beginning or end).
+ #
+ # To match hidden files (that start with a <code>.</code> set the
+ # File::FNM_DOTMATCH flag.
+ #
+ # <code>**</code>::
+ # Matches directories recursively or files expansively.
+ #
+ # <code>?</code>::
+ # Matches any one character. Equivalent to <code>/.{1}/</code> in regexp.
+ #
+ # <code>[set]</code>::
+ # Matches any one character in +set+. Behaves exactly like character sets
+ # in Regexp, including set negation (<code>[^a-z]</code>).
+ #
+ # <code>\\</code>::
+ # Escapes the next metacharacter.
+ #
+ # <code>{a,b}</code>::
+ # Matches pattern a and pattern b if File::FNM_EXTGLOB flag is enabled.
+ # Behaves like a Regexp union (<code>(?:a|b)</code>).
+ #
+ # +flags+ is a bitwise OR of the <code>FNM_XXX</code> constants. The same
+ # glob pattern and flags are used by Dir::glob.
+ #
+ # Examples:
+ #
+ # File.fnmatch('cat', 'cat') #=> true # match entire string
+ # File.fnmatch('cat', 'category') #=> false # only match partial string
+ #
+ # File.fnmatch('c{at,ub}s', 'cats') #=> false # { } isn't supported by default
+ # File.fnmatch('c{at,ub}s', 'cats', File::FNM_EXTGLOB) #=> true # { } is supported on FNM_EXTGLOB
+ #
+ # File.fnmatch('c?t', 'cat') #=> true # '?' match only 1 character
+ # File.fnmatch('c??t', 'cat') #=> false # ditto
+ # File.fnmatch('c*', 'cats') #=> true # '*' match 0 or more characters
+ # File.fnmatch('c*t', 'c/a/b/t') #=> true # ditto
+ # File.fnmatch('ca[a-z]', 'cat') #=> true # inclusive bracket expression
+ # File.fnmatch('ca[^t]', 'cat') #=> false # exclusive bracket expression ('^' or '!')
+ #
+ # File.fnmatch('cat', 'CAT') #=> false # case sensitive
+ # File.fnmatch('cat', 'CAT', File::FNM_CASEFOLD) #=> true # case insensitive
+ # File.fnmatch('cat', 'CAT', File::FNM_SYSCASE) #=> true or false # depends on the system default
+ #
+ # File.fnmatch('?', '/', File::FNM_PATHNAME) #=> false # wildcard doesn't match '/' on FNM_PATHNAME
+ # File.fnmatch('*', '/', File::FNM_PATHNAME) #=> false # ditto
+ # File.fnmatch('[/]', '/', File::FNM_PATHNAME) #=> false # ditto
+ #
+ # File.fnmatch('\?', '?') #=> true # escaped wildcard becomes ordinary
+ # File.fnmatch('\a', 'a') #=> true # escaped ordinary remains ordinary
+ # File.fnmatch('\a', '\a', File::FNM_NOESCAPE) #=> true # FNM_NOESCAPE makes '\' ordinary
+ # File.fnmatch('[\?]', '?') #=> true # can escape inside bracket expression
+ #
+ # File.fnmatch('*', '.profile') #=> false # wildcard doesn't match leading
+ # File.fnmatch('*', '.profile', File::FNM_DOTMATCH) #=> true # period by default.
+ # File.fnmatch('.*', '.profile') #=> true
+ #
+ # rbfiles = '**/*.rb'
+ # File.fnmatch(rbfiles, 'main.rb') #=> false
+ # File.fnmatch(rbfiles, './main.rb') #=> false
+ # File.fnmatch(rbfiles, 'lib/song.rb') #=> true
+ # File.fnmatch('**.rb', 'main.rb') #=> true
+ # File.fnmatch('**.rb', './main.rb') #=> false
+ # File.fnmatch('**.rb', 'lib/song.rb') #=> true
+ # File.fnmatch('*', 'dave/.profile') #=> true
+ #
+ # pattern = '*/*'
+ # File.fnmatch(pattern, 'dave/.profile', File::FNM_PATHNAME) #=> false
+ # File.fnmatch(pattern, 'dave/.profile', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
+ #
+ # pattern = '**/foo'
+ # File.fnmatch(pattern, 'a/b/c/foo', File::FNM_PATHNAME) #=> true
+ # File.fnmatch(pattern, '/a/b/c/foo', File::FNM_PATHNAME) #=> true
+ # File.fnmatch(pattern, 'c:/a/b/c/foo', File::FNM_PATHNAME) #=> true
+ # File.fnmatch(pattern, 'a/.b/c/foo', File::FNM_PATHNAME) #=> false
+ # File.fnmatch(pattern, 'a/.b/c/foo', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
+ def fnmatch(pattern, path, flags = nil)
+ end
+ alias fnmatch? fnmatch
+end if false
diff --git a/dln.c b/dln.c
index b050898..ac09430 100644
--- a/dln.c
+++ b/dln.c
@@ -312,7 +312,7 @@ dln_load(const char *file)
HINSTANCE handle;
WCHAR *winfile;
char message[1024];
- void (*init_fct)();
+ void (*init_fct)(void);
char *buf;
/* Load the file as an object one */
@@ -341,7 +341,7 @@ dln_load(const char *file)
}
#endif
- if ((init_fct = (void(*)())GetProcAddress(handle, buf)) == NULL) {
+ if ((init_fct = (void(*)(void))GetProcAddress(handle, buf)) == NULL) {
dln_loaderror("%s - %s\n%s", dln_strerror(), buf, file);
}
@@ -358,7 +358,7 @@ dln_load(const char *file)
#define DLN_DEFINED
{
void *handle;
- void (*init_fct)();
+ void (*init_fct)(void);
#ifndef RTLD_LAZY
# define RTLD_LAZY 1
@@ -393,7 +393,7 @@ dln_load(const char *file)
}
# endif
- init_fct = (void(*)())(VALUE)dlsym(handle, buf);
+ init_fct = (void(*)(void))(VALUE)dlsym(handle, buf);
if (init_fct == NULL) {
const size_t errlen = strlen(error = dln_strerror()) + 1;
error = memcpy(ALLOCA_N(char, errlen), error, errlen);
@@ -412,7 +412,7 @@ dln_load(const char *file)
{
shl_t lib = NULL;
int flags;
- void (*init_fct)();
+ void (*init_fct)(void);
flags = BIND_DEFERRED;
lib = shl_load(file, flags, 0);
@@ -436,9 +436,9 @@ dln_load(const char *file)
#if defined(_AIX)
#define DLN_DEFINED
{
- void (*init_fct)();
+ void (*init_fct)(void);
- init_fct = (void(*)())load((char*)file, 1, 0);
+ init_fct = (void(*)(void))load((char*)file, 1, 0);
if (init_fct == NULL) {
aix_loaderror(file);
}
@@ -467,7 +467,7 @@ dln_load(const char *file)
/* "file" is module file name .
"buf" is pointer to initial function name with "_" . */
- void (*init_fct)();
+ void (*init_fct)(void);
dyld_result = NSCreateObjectFileImageFromFile(file, &obj_file);
diff --git a/doc/extension.rdoc b/doc/extension.rdoc
index c33dea2..f8e0a1e 100644
--- a/doc/extension.rdoc
+++ b/doc/extension.rdoc
@@ -2127,7 +2127,7 @@ To make "Ractor-safe" C extension, we need to check the following points:
(1) Do not share unshareable objects between ractors
For example, C's global variable can lead sharing an unshareable objects
-betwee ractors.
+between ractors.
VALUE g_var;
VALUE set(VALUE self, VALUE v){ return g_var = v; }
diff --git a/doc/fiber.md b/doc/fiber.md
index 840bebd..9baab4e 100644
--- a/doc/fiber.md
+++ b/doc/fiber.md
@@ -90,6 +90,13 @@ class Scheduler
def timeout_after(duration, klass, *arguments, &block)
end
+ # Resolve hostname to an array of IP addresses.
+ # This hook is optional.
+ # @parameter hostname [String] Example: "www.ruby-lang.org".
+ # @returns [Array] An array of IPv4 and/or IPv6 address strings that the hostname resolves to.
+ def address_resolve(hostname)
+ end
+
# Block the calling fiber.
# @parameter blocker [Object] What we are waiting on, informational only.
# @parameter timeout [Numeric | Nil] The amount of time to wait for in seconds.
diff --git a/doc/irb/irb.rd.ja b/doc/irb/irb.rd.ja
index 81247ce..fd03b35 100644
--- a/doc/irb/irb.rd.ja
+++ b/doc/irb/irb.rd.ja
@@ -381,7 +381,7 @@ rubyでは, 以下のプログラムはエラーになります.
パイルしてローカル変数を決定するからです. それに対し, irbは実行可能に
なる(式が閉じる)と自動的に評価しているからです. 上記の例では,
- evel "foo = 0"
+ eval "foo = 0"
を行なった時点で評価を行ない, その時点で変数が定義されるため, 次式で
変数fooは定義されているからです.
diff --git a/doc/maintainers.rdoc b/doc/maintainers.rdoc
index fbd0ed8..dc893ec 100644
--- a/doc/maintainers.rdoc
+++ b/doc/maintainers.rdoc
@@ -85,7 +85,7 @@ Yukihiro Matsumoto (matz)
https://github.com/rubygems/rubygems
https://rubygems.org/gems/bundler
[lib/cgi.rb, lib/cgi/*]
- Takeyuki Fujioka (xibbar)
+ _unmaintained_
https://github.com/ruby/cgi
https://rubygems.org/gems/cgi
[lib/csv.rb]
@@ -150,34 +150,14 @@ Yukihiro Matsumoto (matz)
Naotoshi Seo (sonots)
https://github.com/ruby/logger
https://rubygems.org/gems/logger
-[lib/matrix.rb]
- Marc-André Lafortune (marcandre)
- https://github.com/ruby/matrix
- https://rubygems.org/gems/matrix
[lib/mutex_m.rb]
Keiju ISHITSUKA (keiju)
https://github.com/ruby/mutex_m
https://rubygems.org/gems/mutex_m
-[lib/net/ftp.rb]
- Shugo Maeda (shugo)
- https://github.com/ruby/net-ftp
- https://rubygems.org/gems/net-ftp
[lib/net/http.rb, lib/net/https.rb]
NARUSE, Yui (naruse)
https://github.com/ruby/net-http
https://rubygems.org/gems/net-http
-[lib/net/imap.rb]
- Shugo Maeda (shugo)
- https://github.com/ruby/net-imap
- https://rubygems.org/gems/net-imap
-[lib/net/pop.rb]
- _unmaintained_
- https://github.com/ruby/net-pop
- https://rubygems.org/gems/net-pop
-[lib/net/smtp.rb]
- TOMITA Masahiro (tmtm)
- https://github.com/ruby/net-smtp
- https://rubygems.org/gems/net-smtp
[lib/net/protocol.rb]
_unmaintained_
https://github.com/ruby/net-protocol
@@ -205,10 +185,6 @@ Yukihiro Matsumoto (matz)
Tanaka Akira (akr)
https://github.com/ruby/prettyprint
https://rubygems.org/gems/prettyprint
-[lib/prime.rb]
- Marc-André Lafortune (marcandre)
- https://github.com/ruby/prime
- https://rubygems.org/gems/prime
[lib/pstore.rb]
_unmaintained_
https://github.com/ruby/pstore
@@ -277,10 +253,6 @@ Yukihiro Matsumoto (matz)
_unmaintained_
https://github.com/ruby/tmpdir
https://rubygems.org/gems/tmpdir
-[lib/tracer.rb]
- Keiju ISHITSUKA (keiju)
- https://github.com/ruby/tracer
- https://rubygems.org/gems/tracer
[lib/tsort.rb]
Tanaka Akira (akr)
https://github.com/ruby/tsort
@@ -316,10 +288,6 @@ Yukihiro Matsumoto (matz)
_unmaintained_
https://github.com/ruby/date
https://rubygems.org/gems/date
-[ext/dbm]
- _unmaintained_
- https://github.com/ruby/dbm
- https://rubygems.org/gems/dbm
[ext/etc]
Ruby core team
https://github.com/ruby/etc
@@ -332,10 +300,6 @@ Yukihiro Matsumoto (matz)
Aaron Patterson (tenderlove)
https://github.com/ruby/fiddle
https://rubygems.org/gems/fiddle
-[ext/gdbm]
- Yukihiro Matsumoto (matz)
- https://github.com/ruby/gdbm
- https://rubygems.org/gems/gdbm
[ext/io/console]
Nobuyuki Nakada (nobu)
https://github.com/ruby/io-console
@@ -411,6 +375,18 @@ Yukihiro Matsumoto (matz)
https://github.com/ruby/rexml
[rss]
https://github.com/ruby/rss
+[net-ftp]
+ https://github.com/ruby/net-ftp
+[net-imap]
+ https://github.com/ruby/net-imap
+[net-pop]
+ https://github.com/ruby/net-pop
+[net-smtp]
+ https://github.com/ruby/net-smtp
+[matrix]
+ https://github.com/ruby/matrix
+[prime]
+ https://github.com/ruby/prime
[rbs]
https://github.com/ruby/rbs
[typeprof]
diff --git a/doc/standard_library.rdoc b/doc/standard_library.rdoc
index e4418ae..1d35801 100644
--- a/doc/standard_library.rdoc
+++ b/doc/standard_library.rdoc
@@ -45,20 +45,14 @@ IPAddr:: Provides methods to manipulate IPv4 and IPv6 IP addresses
IRB:: Interactive Ruby command-line tool for REPL (Read Eval Print Loop)
OptionParser:: Ruby-oriented class for command-line option analysis
Logger:: Provides a simple logging utility for outputting messages
-Matrix:: Represents a mathematical matrix.
Mutex_m:: Mixin to extend objects to be handled like a Mutex
-Net::FTP:: Support for the File Transfer Protocol
Net::HTTP:: HTTP client api for Ruby
-Net::IMAP:: Ruby client api for Internet Message Access Protocol
-Net::POP3:: Ruby client library for POP3
-Net::SMTP:: Simple Mail Transfer Protocol client library for Ruby
Observable:: Provides a mechanism for publish/subscribe pattern in Ruby
Open3:: Provides access to stdin, stdout and stderr when running other programs
OpenStruct:: Class to build custom data structures, similar to a Hash
OpenURI:: An easy-to-use wrapper for Net::HTTP, Net::HTTPS and Net::FTP
PP:: Provides a PrettyPrinter for Ruby objects
PrettyPrinter:: Implements a pretty printing algorithm for readable structure
-Prime:: Prime numbers and factorization library
PStore:: Implements a file based persistence mechanism based on a Hash
Resolv:: Thread-aware DNS resolver library in Ruby
resolv-replace.rb:: Replace Socket DNS with Resolv
@@ -72,7 +66,6 @@ Tempfile:: A utility class for managing temporary files
Time:: Extends the Time class with methods for parsing and conversion
Timeout:: Auto-terminate potentially long-running operations in Ruby
tmpdir.rb:: Extends the Dir class to manage the OS temporary file path
-Tracer:: Outputs a source level execution trace of a Ruby program
TSort:: Topological sorting using Tarjan's algorithm
un.rb:: Utilities to replace common UNIX commands
URI:: A Ruby module providing support for Uniform Resource Identifiers
@@ -84,12 +77,10 @@ WeakRef:: Allows a referenced object to be garbage-collected
BigDecimal:: Provides arbitrary-precision floating point decimal arithmetic
Date:: A subclass of Object includes Comparable module for handling dates
DateTime:: Subclass of Date to handling dates, hours, minutes, seconds, offsets
-DBM:: Provides a wrapper for the UNIX-style Database Manager Library
Digest:: Provides a framework for message digest libraries
Etc:: Provides access to information typically stored in UNIX /etc directory
Fcntl:: Loads constants defined in the OS fcntl.h C header file
Fiddle:: A libffi wrapper for Ruby
-GDBM:: Ruby extension for the GNU dbm (gdbm) library
IO:: Extensions for Ruby IO class, including #wait, #nonblock and ::console
JSON:: Implements Javascript Object Notation for Ruby
NKF:: Ruby extension for Network Kanji Filter
@@ -114,5 +105,11 @@ Rake:: Ruby build program with capabilities similar to make
Test::Unit:: A compatibility layer for MiniTest
REXML:: An XML toolkit for Ruby
RSS:: Family of libraries that support various formats of XML "feeds"
+Net::FTP:: Support for the File Transfer Protocol
+Net::IMAP:: Ruby client api for Internet Message Access Protocol
+Net::POP3:: Ruby client library for POP3
+Net::SMTP:: Simple Mail Transfer Protocol client library for Ruby
+Matrix:: Represents a mathematical matrix.
+Prime:: Prime numbers and factorization library
RBS:: RBS is a language to describe the structure of Ruby programs
TypeProf:: A type analysis tool for Ruby code based on abstract interpretation
diff --git a/doc/syntax/literals.rdoc b/doc/syntax/literals.rdoc
index d6d6778..cfdbb71 100644
--- a/doc/syntax/literals.rdoc
+++ b/doc/syntax/literals.rdoc
@@ -220,7 +220,7 @@ You may indent the ending identifier if you place a "-" after <tt><<</tt>:
That might span many lines
INDENTED_HEREDOC
-Note that the while the closing identifier may be indented, the content is
+Note that while the closing identifier may be indented, the content is
always treated as if it is flush left. If you indent the content those spaces
will appear in the output.
diff --git a/doc/syntax/methods.rdoc b/doc/syntax/methods.rdoc
index 1b75922..e86cc2c 100644
--- a/doc/syntax/methods.rdoc
+++ b/doc/syntax/methods.rdoc
@@ -418,8 +418,8 @@ It is possible to gather arguments at the beginning or in the middle:
gather_arguments 1, 2, 3, 4 # prints [2, 3]
-The array argument will capture a Hash as the last entry if a hash was sent by
-the caller after all positional arguments.
+The array argument will capture a Hash as the last entry if keywords were
+provided by the caller after all positional arguments.
def gather_arguments(*arguments)
p arguments
@@ -491,83 +491,15 @@ Calling such a method with keywords or a non-empty keyword splat will
result in an ArgumentError. This syntax is supported so that keywords
can be added to the method later without affected backwards compatibility.
-=== Keyword and Positional Argument Separation
+If a method definition does not accept any keywords, and the
+<code>**nil</code> syntax is not used, any keywords provided when calling
+the method will be converted to a Hash positional argument:
-Between Ruby 2.0 and 2.6, keyword and positional arguments were not
-separated, and a keyword argument could be used as a positional argument
-and vice-versa. In Ruby 3.0, keyword and positional arguments will
-be separated if the method definition includes keyword arguments.
-In Ruby 3.0, if the method definition does not include keyword arguments,
-keyword arguments provided when calling the method will continue to be
-treated as a final positional hash argument.
-
-In Ruby 2.7, the keyword and positional arguments are not separated,
-but cases where behavior will change in Ruby 3.0 will result in a
-warning being emitted.
-
-There are a few different types of keyword argument separation issues.
-
-==== Conversion of Hash to Keywords
-
-If a method is called with the hash, the hash could be treated as
-keywords:
-
- def my_method(**keywords)
- keywords
- end
- my_method({a: 1}) # {:a => 1}
-
-This occurs even if the hash could be an optional positional argument
-or an element of a rest argument:
-
- def my_method(hash=nil, **keywords)
- [hash, keywords]
- end
- my_method({a: 1}) # [nil, {:a => 1}]
-
- def my_method(*args, **keywords)
- [args, keywords]
- end
- my_method({a: 1}) # [[], {:a => 1}]
-
-However, if the hash is needed for a mandatory positional argument,
-it would not be treated as keywords:
-
- def my_method(hash, **keywords)
- [hash, keywords]
- end
- my_method({a: 1}) # [{:a => 1}, {}]
-
-==== Conversion of Keywords to Positional Arguments
-
-If a method is called with keywords, but it is missing one
-mandatory positional argument, the keywords are converted to
-a hash and the hash used as the mandatory positional argument:
-
- def my_method(hash, **keywords)
- [hash, keywords]
- end
- my_method(a: 1) # [{:a => 1}, {}]
-
-This is also true for empty keyword splats:
-
- kw = {}
- my_method(**kw) # [{}, {}]
-
-==== Splitting of Positional Hashes or Keywords
-
-If a method definition accepts specific keywords and not arbitrary keywords,
-keywords or a positional hash may be split if the hash includes both Symbol
-keys and non-Symbol keys and the keywords or positional hash are not needed
-as a mandatory positional argument. In this case, the non-Symbol keys are
-separated into a positional argument hash, and the Symbol keys are used
-as the keyword arguments:
-
- def my_method(hash=3, a: 4)
- [hash, a]
+ def meth(arg)
+ arg
end
- my_method(a: 1, 'a' => 2) # [{"a"=>2}, 1]
- my_method({a: 1, 'a' => 2}) # [{"a"=>2}, 1]
+ meth(a: 1)
+ # => {:a=>1}
=== Block Argument
@@ -615,7 +547,7 @@ defined with <code>...</code>.
end
Since Ruby 3.0, there can be leading arguments before <code>...</code>
-both in definitions and in invokations (but in definitions they can be
+both in definitions and in invocations (but in definitions they can be
only positional arguments without default values).
def request(method, path, **headers)
diff --git a/doc/time/in.rdoc b/doc/time/in.rdoc
new file mode 100644
index 0000000..f47db76
--- /dev/null
+++ b/doc/time/in.rdoc
@@ -0,0 +1,7 @@
+- <tt>in: zone</tt>: a timezone _zone_, which may be:
+ - A string offset from UTC.
+ - A single letter offset from UTC, in the range <tt>'A'..'Z'</tt>,
+ <tt>'J'</tt> (the so-called military timezone) excluded.
+ - An integer number of seconds.
+ - A timezone object;
+ see {Timezone Argument}[#class-Time-label-Timezone+Argument] for details.
diff --git a/doc/time/mon-min.rdoc b/doc/time/mon-min.rdoc
new file mode 100644
index 0000000..5bd430c
--- /dev/null
+++ b/doc/time/mon-min.rdoc
@@ -0,0 +1,8 @@
+- +month+: a month value, which may be:
+ - An integer month in the range <tt>1..12</tt>.
+ - A 3-character string that matches regular expression
+ <tt>/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/i</tt>.
+- +day+: an integer day in the range <tt>1..31</tt>
+ (less than 31 for some months).
+- +hour+: an integer hour in the range <tt>0..23</tt>.
+- +min+: an integer minute in the range <tt>0..59</tt>.
diff --git a/doc/time/msec.rdoc b/doc/time/msec.rdoc
new file mode 100644
index 0000000..ce5d1e6
--- /dev/null
+++ b/doc/time/msec.rdoc
@@ -0,0 +1,2 @@
+- +msec+ is the number of milliseconds (Integer, Float, or Rational)
+ in the range <tt>0..1000</tt>.
diff --git a/doc/time/nsec.rdoc b/doc/time/nsec.rdoc
new file mode 100644
index 0000000..a2dfe2d
--- /dev/null
+++ b/doc/time/nsec.rdoc
@@ -0,0 +1,2 @@
+- +nsec+ is the number of nanoseconds (Integer, Float, or Rational)
+ in the range <tt>0..1000000000</tt>.
diff --git a/doc/time/sec.rdoc b/doc/time/sec.rdoc
new file mode 100644
index 0000000..049c712
--- /dev/null
+++ b/doc/time/sec.rdoc
@@ -0,0 +1,2 @@
+- +sec+ is the number of seconds (Integer, Float, or Rational)
+ in the range <tt>0..60</tt>.
diff --git a/doc/time/sec_i.rdoc b/doc/time/sec_i.rdoc
new file mode 100644
index 0000000..99c8edd
--- /dev/null
+++ b/doc/time/sec_i.rdoc
@@ -0,0 +1 @@
+- +isec_i+ is the integer number of seconds in the range <tt>0..60</tt>.
diff --git a/doc/time/usec.rdoc b/doc/time/usec.rdoc
new file mode 100644
index 0000000..bb5a464
--- /dev/null
+++ b/doc/time/usec.rdoc
@@ -0,0 +1,2 @@
+- +usec+ is the number of microseconds (Integer, Float, or Rational)
+ in the range <tt>0..1000000</tt>.
diff --git a/doc/time/year.rdoc b/doc/time/year.rdoc
new file mode 100644
index 0000000..2222b83
--- /dev/null
+++ b/doc/time/year.rdoc
@@ -0,0 +1 @@
+- +year+: an integer year.
diff --git a/doc/time/zone_and_in.rdoc b/doc/time/zone_and_in.rdoc
new file mode 100644
index 0000000..e09e228
--- /dev/null
+++ b/doc/time/zone_and_in.rdoc
@@ -0,0 +1,8 @@
+- +zone+: a timezone, which may be:
+ - A string offset from UTC.
+ - A single letter offset from UTC, in the range <tt>'A'..'Z'</tt>,
+ <tt>'J'</tt> (the so-called military timezone) excluded.
+ - An integer number of seconds.
+ - A timezone object;
+ see {Timezone Argument}[#class-Time-label-Timezone+Argument] for details.
+- <tt>in: zone</tt>: a timezone _zone_, which may be as above.
diff --git a/enc/depend b/enc/depend
index f1da87e..892e961 100644
--- a/enc/depend
+++ b/enc/depend
@@ -315,7 +315,6 @@ enc/ascii.$(OBJEXT): internal/static_assert.h
enc/ascii.$(OBJEXT): internal/stdalign.h
enc/ascii.$(OBJEXT): internal/stdbool.h
enc/ascii.$(OBJEXT): internal/symbol.h
-enc/ascii.$(OBJEXT): internal/token_paste.h
enc/ascii.$(OBJEXT): internal/value.h
enc/ascii.$(OBJEXT): internal/value_type.h
enc/ascii.$(OBJEXT): internal/variable.h
@@ -382,7 +381,6 @@ enc/big5.$(OBJEXT): internal/has/feature.h
enc/big5.$(OBJEXT): internal/has/warning.h
enc/big5.$(OBJEXT): internal/stdalign.h
enc/big5.$(OBJEXT): internal/stdbool.h
-enc/big5.$(OBJEXT): internal/token_paste.h
enc/big5.$(OBJEXT): internal/warning_push.h
enc/big5.$(OBJEXT): internal/xmalloc.h
enc/big5.$(OBJEXT): assert.h
@@ -535,7 +533,6 @@ enc/cesu_8.$(OBJEXT): internal/static_assert.h
enc/cesu_8.$(OBJEXT): internal/stdalign.h
enc/cesu_8.$(OBJEXT): internal/stdbool.h
enc/cesu_8.$(OBJEXT): internal/symbol.h
-enc/cesu_8.$(OBJEXT): internal/token_paste.h
enc/cesu_8.$(OBJEXT): internal/value.h
enc/cesu_8.$(OBJEXT): internal/value_type.h
enc/cesu_8.$(OBJEXT): internal/variable.h
@@ -603,7 +600,6 @@ enc/cp949.$(OBJEXT): internal/has/feature.h
enc/cp949.$(OBJEXT): internal/has/warning.h
enc/cp949.$(OBJEXT): internal/stdalign.h
enc/cp949.$(OBJEXT): internal/stdbool.h
-enc/cp949.$(OBJEXT): internal/token_paste.h
enc/cp949.$(OBJEXT): internal/warning_push.h
enc/cp949.$(OBJEXT): internal/xmalloc.h
enc/cp949.$(OBJEXT): assert.h
@@ -660,7 +656,6 @@ enc/emacs_mule.$(OBJEXT): internal/has/feature.h
enc/emacs_mule.$(OBJEXT): internal/has/warning.h
enc/emacs_mule.$(OBJEXT): internal/stdalign.h
enc/emacs_mule.$(OBJEXT): internal/stdbool.h
-enc/emacs_mule.$(OBJEXT): internal/token_paste.h
enc/emacs_mule.$(OBJEXT): internal/warning_push.h
enc/emacs_mule.$(OBJEXT): internal/xmalloc.h
enc/emacs_mule.$(OBJEXT): assert.h
@@ -814,7 +809,6 @@ enc/encdb.$(OBJEXT): internal/static_assert.h
enc/encdb.$(OBJEXT): internal/stdalign.h
enc/encdb.$(OBJEXT): internal/stdbool.h
enc/encdb.$(OBJEXT): internal/symbol.h
-enc/encdb.$(OBJEXT): internal/token_paste.h
enc/encdb.$(OBJEXT): internal/value.h
enc/encdb.$(OBJEXT): internal/value_type.h
enc/encdb.$(OBJEXT): internal/variable.h
@@ -883,7 +877,6 @@ enc/euc_jp.$(OBJEXT): internal/has/feature.h
enc/euc_jp.$(OBJEXT): internal/has/warning.h
enc/euc_jp.$(OBJEXT): internal/stdalign.h
enc/euc_jp.$(OBJEXT): internal/stdbool.h
-enc/euc_jp.$(OBJEXT): internal/token_paste.h
enc/euc_jp.$(OBJEXT): internal/warning_push.h
enc/euc_jp.$(OBJEXT): internal/xmalloc.h
enc/euc_jp.$(OBJEXT): assert.h
@@ -942,7 +935,6 @@ enc/euc_kr.$(OBJEXT): internal/has/feature.h
enc/euc_kr.$(OBJEXT): internal/has/warning.h
enc/euc_kr.$(OBJEXT): internal/stdalign.h
enc/euc_kr.$(OBJEXT): internal/stdbool.h
-enc/euc_kr.$(OBJEXT): internal/token_paste.h
enc/euc_kr.$(OBJEXT): internal/warning_push.h
enc/euc_kr.$(OBJEXT): internal/xmalloc.h
enc/euc_kr.$(OBJEXT): assert.h
@@ -999,7 +991,6 @@ enc/euc_tw.$(OBJEXT): internal/has/feature.h
enc/euc_tw.$(OBJEXT): internal/has/warning.h
enc/euc_tw.$(OBJEXT): internal/stdalign.h
enc/euc_tw.$(OBJEXT): internal/stdbool.h
-enc/euc_tw.$(OBJEXT): internal/token_paste.h
enc/euc_tw.$(OBJEXT): internal/warning_push.h
enc/euc_tw.$(OBJEXT): internal/xmalloc.h
enc/euc_tw.$(OBJEXT): assert.h
@@ -1056,7 +1047,6 @@ enc/gb18030.$(OBJEXT): internal/has/feature.h
enc/gb18030.$(OBJEXT): internal/has/warning.h
enc/gb18030.$(OBJEXT): internal/stdalign.h
enc/gb18030.$(OBJEXT): internal/stdbool.h
-enc/gb18030.$(OBJEXT): internal/token_paste.h
enc/gb18030.$(OBJEXT): internal/warning_push.h
enc/gb18030.$(OBJEXT): internal/xmalloc.h
enc/gb18030.$(OBJEXT): assert.h
@@ -1113,7 +1103,6 @@ enc/gb2312.$(OBJEXT): internal/has/feature.h
enc/gb2312.$(OBJEXT): internal/has/warning.h
enc/gb2312.$(OBJEXT): internal/stdalign.h
enc/gb2312.$(OBJEXT): internal/stdbool.h
-enc/gb2312.$(OBJEXT): internal/token_paste.h
enc/gb2312.$(OBJEXT): internal/warning_push.h
enc/gb2312.$(OBJEXT): internal/xmalloc.h
enc/gb2312.$(OBJEXT): assert.h
@@ -1170,7 +1159,6 @@ enc/gbk.$(OBJEXT): internal/has/feature.h
enc/gbk.$(OBJEXT): internal/has/warning.h
enc/gbk.$(OBJEXT): internal/stdalign.h
enc/gbk.$(OBJEXT): internal/stdbool.h
-enc/gbk.$(OBJEXT): internal/token_paste.h
enc/gbk.$(OBJEXT): internal/warning_push.h
enc/gbk.$(OBJEXT): internal/xmalloc.h
enc/gbk.$(OBJEXT): assert.h
@@ -1227,7 +1215,6 @@ enc/iso_8859_1.$(OBJEXT): internal/has/feature.h
enc/iso_8859_1.$(OBJEXT): internal/has/warning.h
enc/iso_8859_1.$(OBJEXT): internal/stdalign.h
enc/iso_8859_1.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_1.$(OBJEXT): internal/token_paste.h
enc/iso_8859_1.$(OBJEXT): internal/warning_push.h
enc/iso_8859_1.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_1.$(OBJEXT): assert.h
@@ -1285,7 +1272,6 @@ enc/iso_8859_10.$(OBJEXT): internal/has/feature.h
enc/iso_8859_10.$(OBJEXT): internal/has/warning.h
enc/iso_8859_10.$(OBJEXT): internal/stdalign.h
enc/iso_8859_10.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_10.$(OBJEXT): internal/token_paste.h
enc/iso_8859_10.$(OBJEXT): internal/warning_push.h
enc/iso_8859_10.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_10.$(OBJEXT): assert.h
@@ -1343,7 +1329,6 @@ enc/iso_8859_11.$(OBJEXT): internal/has/feature.h
enc/iso_8859_11.$(OBJEXT): internal/has/warning.h
enc/iso_8859_11.$(OBJEXT): internal/stdalign.h
enc/iso_8859_11.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_11.$(OBJEXT): internal/token_paste.h
enc/iso_8859_11.$(OBJEXT): internal/warning_push.h
enc/iso_8859_11.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_11.$(OBJEXT): assert.h
@@ -1400,7 +1385,6 @@ enc/iso_8859_13.$(OBJEXT): internal/has/feature.h
enc/iso_8859_13.$(OBJEXT): internal/has/warning.h
enc/iso_8859_13.$(OBJEXT): internal/stdalign.h
enc/iso_8859_13.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_13.$(OBJEXT): internal/token_paste.h
enc/iso_8859_13.$(OBJEXT): internal/warning_push.h
enc/iso_8859_13.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_13.$(OBJEXT): assert.h
@@ -1458,7 +1442,6 @@ enc/iso_8859_14.$(OBJEXT): internal/has/feature.h
enc/iso_8859_14.$(OBJEXT): internal/has/warning.h
enc/iso_8859_14.$(OBJEXT): internal/stdalign.h
enc/iso_8859_14.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_14.$(OBJEXT): internal/token_paste.h
enc/iso_8859_14.$(OBJEXT): internal/warning_push.h
enc/iso_8859_14.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_14.$(OBJEXT): assert.h
@@ -1516,7 +1499,6 @@ enc/iso_8859_15.$(OBJEXT): internal/has/feature.h
enc/iso_8859_15.$(OBJEXT): internal/has/warning.h
enc/iso_8859_15.$(OBJEXT): internal/stdalign.h
enc/iso_8859_15.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_15.$(OBJEXT): internal/token_paste.h
enc/iso_8859_15.$(OBJEXT): internal/warning_push.h
enc/iso_8859_15.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_15.$(OBJEXT): assert.h
@@ -1574,7 +1556,6 @@ enc/iso_8859_16.$(OBJEXT): internal/has/feature.h
enc/iso_8859_16.$(OBJEXT): internal/has/warning.h
enc/iso_8859_16.$(OBJEXT): internal/stdalign.h
enc/iso_8859_16.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_16.$(OBJEXT): internal/token_paste.h
enc/iso_8859_16.$(OBJEXT): internal/warning_push.h
enc/iso_8859_16.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_16.$(OBJEXT): assert.h
@@ -1632,7 +1613,6 @@ enc/iso_8859_2.$(OBJEXT): internal/has/feature.h
enc/iso_8859_2.$(OBJEXT): internal/has/warning.h
enc/iso_8859_2.$(OBJEXT): internal/stdalign.h
enc/iso_8859_2.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_2.$(OBJEXT): internal/token_paste.h
enc/iso_8859_2.$(OBJEXT): internal/warning_push.h
enc/iso_8859_2.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_2.$(OBJEXT): assert.h
@@ -1690,7 +1670,6 @@ enc/iso_8859_3.$(OBJEXT): internal/has/feature.h
enc/iso_8859_3.$(OBJEXT): internal/has/warning.h
enc/iso_8859_3.$(OBJEXT): internal/stdalign.h
enc/iso_8859_3.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_3.$(OBJEXT): internal/token_paste.h
enc/iso_8859_3.$(OBJEXT): internal/warning_push.h
enc/iso_8859_3.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_3.$(OBJEXT): assert.h
@@ -1748,7 +1727,6 @@ enc/iso_8859_4.$(OBJEXT): internal/has/feature.h
enc/iso_8859_4.$(OBJEXT): internal/has/warning.h
enc/iso_8859_4.$(OBJEXT): internal/stdalign.h
enc/iso_8859_4.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_4.$(OBJEXT): internal/token_paste.h
enc/iso_8859_4.$(OBJEXT): internal/warning_push.h
enc/iso_8859_4.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_4.$(OBJEXT): assert.h
@@ -1806,7 +1784,6 @@ enc/iso_8859_5.$(OBJEXT): internal/has/feature.h
enc/iso_8859_5.$(OBJEXT): internal/has/warning.h
enc/iso_8859_5.$(OBJEXT): internal/stdalign.h
enc/iso_8859_5.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_5.$(OBJEXT): internal/token_paste.h
enc/iso_8859_5.$(OBJEXT): internal/warning_push.h
enc/iso_8859_5.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_5.$(OBJEXT): assert.h
@@ -1863,7 +1840,6 @@ enc/iso_8859_6.$(OBJEXT): internal/has/feature.h
enc/iso_8859_6.$(OBJEXT): internal/has/warning.h
enc/iso_8859_6.$(OBJEXT): internal/stdalign.h
enc/iso_8859_6.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_6.$(OBJEXT): internal/token_paste.h
enc/iso_8859_6.$(OBJEXT): internal/warning_push.h
enc/iso_8859_6.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_6.$(OBJEXT): assert.h
@@ -1920,7 +1896,6 @@ enc/iso_8859_7.$(OBJEXT): internal/has/feature.h
enc/iso_8859_7.$(OBJEXT): internal/has/warning.h
enc/iso_8859_7.$(OBJEXT): internal/stdalign.h
enc/iso_8859_7.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_7.$(OBJEXT): internal/token_paste.h
enc/iso_8859_7.$(OBJEXT): internal/warning_push.h
enc/iso_8859_7.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_7.$(OBJEXT): assert.h
@@ -1977,7 +1952,6 @@ enc/iso_8859_8.$(OBJEXT): internal/has/feature.h
enc/iso_8859_8.$(OBJEXT): internal/has/warning.h
enc/iso_8859_8.$(OBJEXT): internal/stdalign.h
enc/iso_8859_8.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_8.$(OBJEXT): internal/token_paste.h
enc/iso_8859_8.$(OBJEXT): internal/warning_push.h
enc/iso_8859_8.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_8.$(OBJEXT): assert.h
@@ -2034,7 +2008,6 @@ enc/iso_8859_9.$(OBJEXT): internal/has/feature.h
enc/iso_8859_9.$(OBJEXT): internal/has/warning.h
enc/iso_8859_9.$(OBJEXT): internal/stdalign.h
enc/iso_8859_9.$(OBJEXT): internal/stdbool.h
-enc/iso_8859_9.$(OBJEXT): internal/token_paste.h
enc/iso_8859_9.$(OBJEXT): internal/warning_push.h
enc/iso_8859_9.$(OBJEXT): internal/xmalloc.h
enc/iso_8859_9.$(OBJEXT): assert.h
@@ -2092,7 +2065,6 @@ enc/koi8_r.$(OBJEXT): internal/has/feature.h
enc/koi8_r.$(OBJEXT): internal/has/warning.h
enc/koi8_r.$(OBJEXT): internal/stdalign.h
enc/koi8_r.$(OBJEXT): internal/stdbool.h
-enc/koi8_r.$(OBJEXT): internal/token_paste.h
enc/koi8_r.$(OBJEXT): internal/warning_push.h
enc/koi8_r.$(OBJEXT): internal/xmalloc.h
enc/koi8_r.$(OBJEXT): assert.h
@@ -2149,7 +2121,6 @@ enc/koi8_u.$(OBJEXT): internal/has/feature.h
enc/koi8_u.$(OBJEXT): internal/has/warning.h
enc/koi8_u.$(OBJEXT): internal/stdalign.h
enc/koi8_u.$(OBJEXT): internal/stdbool.h
-enc/koi8_u.$(OBJEXT): internal/token_paste.h
enc/koi8_u.$(OBJEXT): internal/warning_push.h
enc/koi8_u.$(OBJEXT): internal/xmalloc.h
enc/koi8_u.$(OBJEXT): assert.h
@@ -2206,7 +2177,6 @@ enc/shift_jis.$(OBJEXT): internal/has/feature.h
enc/shift_jis.$(OBJEXT): internal/has/warning.h
enc/shift_jis.$(OBJEXT): internal/stdalign.h
enc/shift_jis.$(OBJEXT): internal/stdbool.h
-enc/shift_jis.$(OBJEXT): internal/token_paste.h
enc/shift_jis.$(OBJEXT): internal/warning_push.h
enc/shift_jis.$(OBJEXT): internal/xmalloc.h
enc/shift_jis.$(OBJEXT): assert.h
@@ -2361,7 +2331,6 @@ enc/trans/big5.$(OBJEXT): internal/static_assert.h
enc/trans/big5.$(OBJEXT): internal/stdalign.h
enc/trans/big5.$(OBJEXT): internal/stdbool.h
enc/trans/big5.$(OBJEXT): internal/symbol.h
-enc/trans/big5.$(OBJEXT): internal/token_paste.h
enc/trans/big5.$(OBJEXT): internal/value.h
enc/trans/big5.$(OBJEXT): internal/value_type.h
enc/trans/big5.$(OBJEXT): internal/variable.h
@@ -2521,7 +2490,6 @@ enc/trans/cesu_8.$(OBJEXT): internal/static_assert.h
enc/trans/cesu_8.$(OBJEXT): internal/stdalign.h
enc/trans/cesu_8.$(OBJEXT): internal/stdbool.h
enc/trans/cesu_8.$(OBJEXT): internal/symbol.h
-enc/trans/cesu_8.$(OBJEXT): internal/token_paste.h
enc/trans/cesu_8.$(OBJEXT): internal/value.h
enc/trans/cesu_8.$(OBJEXT): internal/value_type.h
enc/trans/cesu_8.$(OBJEXT): internal/variable.h
@@ -2681,7 +2649,6 @@ enc/trans/chinese.$(OBJEXT): internal/static_assert.h
enc/trans/chinese.$(OBJEXT): internal/stdalign.h
enc/trans/chinese.$(OBJEXT): internal/stdbool.h
enc/trans/chinese.$(OBJEXT): internal/symbol.h
-enc/trans/chinese.$(OBJEXT): internal/token_paste.h
enc/trans/chinese.$(OBJEXT): internal/value.h
enc/trans/chinese.$(OBJEXT): internal/value_type.h
enc/trans/chinese.$(OBJEXT): internal/variable.h
@@ -2841,7 +2808,6 @@ enc/trans/ebcdic.$(OBJEXT): internal/static_assert.h
enc/trans/ebcdic.$(OBJEXT): internal/stdalign.h
enc/trans/ebcdic.$(OBJEXT): internal/stdbool.h
enc/trans/ebcdic.$(OBJEXT): internal/symbol.h
-enc/trans/ebcdic.$(OBJEXT): internal/token_paste.h
enc/trans/ebcdic.$(OBJEXT): internal/value.h
enc/trans/ebcdic.$(OBJEXT): internal/value_type.h
enc/trans/ebcdic.$(OBJEXT): internal/variable.h
@@ -3001,7 +2967,6 @@ enc/trans/emoji.$(OBJEXT): internal/static_assert.h
enc/trans/emoji.$(OBJEXT): internal/stdalign.h
enc/trans/emoji.$(OBJEXT): internal/stdbool.h
enc/trans/emoji.$(OBJEXT): internal/symbol.h
-enc/trans/emoji.$(OBJEXT): internal/token_paste.h
enc/trans/emoji.$(OBJEXT): internal/value.h
enc/trans/emoji.$(OBJEXT): internal/value_type.h
enc/trans/emoji.$(OBJEXT): internal/variable.h
@@ -3161,7 +3126,6 @@ enc/trans/emoji_iso2022_kddi.$(OBJEXT): internal/static_assert.h
enc/trans/emoji_iso2022_kddi.$(OBJEXT): internal/stdalign.h
enc/trans/emoji_iso2022_kddi.$(OBJEXT): internal/stdbool.h
enc/trans/emoji_iso2022_kddi.$(OBJEXT): internal/symbol.h
-enc/trans/emoji_iso2022_kddi.$(OBJEXT): internal/token_paste.h
enc/trans/emoji_iso2022_kddi.$(OBJEXT): internal/value.h
enc/trans/emoji_iso2022_kddi.$(OBJEXT): internal/value_type.h
enc/trans/emoji_iso2022_kddi.$(OBJEXT): internal/variable.h
@@ -3321,7 +3285,6 @@ enc/trans/emoji_sjis_docomo.$(OBJEXT): internal/static_assert.h
enc/trans/emoji_sjis_docomo.$(OBJEXT): internal/stdalign.h
enc/trans/emoji_sjis_docomo.$(OBJEXT): internal/stdbool.h
enc/trans/emoji_sjis_docomo.$(OBJEXT): internal/symbol.h
-enc/trans/emoji_sjis_docomo.$(OBJEXT): internal/token_paste.h
enc/trans/emoji_sjis_docomo.$(OBJEXT): internal/value.h
enc/trans/emoji_sjis_docomo.$(OBJEXT): internal/value_type.h
enc/trans/emoji_sjis_docomo.$(OBJEXT): internal/variable.h
@@ -3481,7 +3444,6 @@ enc/trans/emoji_sjis_kddi.$(OBJEXT): internal/static_assert.h
enc/trans/emoji_sjis_kddi.$(OBJEXT): internal/stdalign.h
enc/trans/emoji_sjis_kddi.$(OBJEXT): internal/stdbool.h
enc/trans/emoji_sjis_kddi.$(OBJEXT): internal/symbol.h
-enc/trans/emoji_sjis_kddi.$(OBJEXT): internal/token_paste.h
enc/trans/emoji_sjis_kddi.$(OBJEXT): internal/value.h
enc/trans/emoji_sjis_kddi.$(OBJEXT): internal/value_type.h
enc/trans/emoji_sjis_kddi.$(OBJEXT): internal/variable.h
@@ -3641,7 +3603,6 @@ enc/trans/emoji_sjis_softbank.$(OBJEXT): internal/static_assert.h
enc/trans/emoji_sjis_softbank.$(OBJEXT): internal/stdalign.h
enc/trans/emoji_sjis_softbank.$(OBJEXT): internal/stdbool.h
enc/trans/emoji_sjis_softbank.$(OBJEXT): internal/symbol.h
-enc/trans/emoji_sjis_softbank.$(OBJEXT): internal/token_paste.h
enc/trans/emoji_sjis_softbank.$(OBJEXT): internal/value.h
enc/trans/emoji_sjis_softbank.$(OBJEXT): internal/value_type.h
enc/trans/emoji_sjis_softbank.$(OBJEXT): internal/variable.h
@@ -3801,7 +3762,6 @@ enc/trans/escape.$(OBJEXT): internal/static_assert.h
enc/trans/escape.$(OBJEXT): internal/stdalign.h
enc/trans/escape.$(OBJEXT): internal/stdbool.h
enc/trans/escape.$(OBJEXT): internal/symbol.h
-enc/trans/escape.$(OBJEXT): internal/token_paste.h
enc/trans/escape.$(OBJEXT): internal/value.h
enc/trans/escape.$(OBJEXT): internal/value_type.h
enc/trans/escape.$(OBJEXT): internal/variable.h
@@ -3961,7 +3921,6 @@ enc/trans/gb18030.$(OBJEXT): internal/static_assert.h
enc/trans/gb18030.$(OBJEXT): internal/stdalign.h
enc/trans/gb18030.$(OBJEXT): internal/stdbool.h
enc/trans/gb18030.$(OBJEXT): internal/symbol.h
-enc/trans/gb18030.$(OBJEXT): internal/token_paste.h
enc/trans/gb18030.$(OBJEXT): internal/value.h
enc/trans/gb18030.$(OBJEXT): internal/value_type.h
enc/trans/gb18030.$(OBJEXT): internal/variable.h
@@ -4121,7 +4080,6 @@ enc/trans/gbk.$(OBJEXT): internal/static_assert.h
enc/trans/gbk.$(OBJEXT): internal/stdalign.h
enc/trans/gbk.$(OBJEXT): internal/stdbool.h
enc/trans/gbk.$(OBJEXT): internal/symbol.h
-enc/trans/gbk.$(OBJEXT): internal/token_paste.h
enc/trans/gbk.$(OBJEXT): internal/value.h
enc/trans/gbk.$(OBJEXT): internal/value_type.h
enc/trans/gbk.$(OBJEXT): internal/variable.h
@@ -4281,7 +4239,6 @@ enc/trans/iso2022.$(OBJEXT): internal/static_assert.h
enc/trans/iso2022.$(OBJEXT): internal/stdalign.h
enc/trans/iso2022.$(OBJEXT): internal/stdbool.h
enc/trans/iso2022.$(OBJEXT): internal/symbol.h
-enc/trans/iso2022.$(OBJEXT): internal/token_paste.h
enc/trans/iso2022.$(OBJEXT): internal/value.h
enc/trans/iso2022.$(OBJEXT): internal/value_type.h
enc/trans/iso2022.$(OBJEXT): internal/variable.h
@@ -4441,7 +4398,6 @@ enc/trans/japanese.$(OBJEXT): internal/static_assert.h
enc/trans/japanese.$(OBJEXT): internal/stdalign.h
enc/trans/japanese.$(OBJEXT): internal/stdbool.h
enc/trans/japanese.$(OBJEXT): internal/symbol.h
-enc/trans/japanese.$(OBJEXT): internal/token_paste.h
enc/trans/japanese.$(OBJEXT): internal/value.h
enc/trans/japanese.$(OBJEXT): internal/value_type.h
enc/trans/japanese.$(OBJEXT): internal/variable.h
@@ -4601,7 +4557,6 @@ enc/trans/japanese_euc.$(OBJEXT): internal/static_assert.h
enc/trans/japanese_euc.$(OBJEXT): internal/stdalign.h
enc/trans/japanese_euc.$(OBJEXT): internal/stdbool.h
enc/trans/japanese_euc.$(OBJEXT): internal/symbol.h
-enc/trans/japanese_euc.$(OBJEXT): internal/token_paste.h
enc/trans/japanese_euc.$(OBJEXT): internal/value.h
enc/trans/japanese_euc.$(OBJEXT): internal/value_type.h
enc/trans/japanese_euc.$(OBJEXT): internal/variable.h
@@ -4761,7 +4716,6 @@ enc/trans/japanese_sjis.$(OBJEXT): internal/static_assert.h
enc/trans/japanese_sjis.$(OBJEXT): internal/stdalign.h
enc/trans/japanese_sjis.$(OBJEXT): internal/stdbool.h
enc/trans/japanese_sjis.$(OBJEXT): internal/symbol.h
-enc/trans/japanese_sjis.$(OBJEXT): internal/token_paste.h
enc/trans/japanese_sjis.$(OBJEXT): internal/value.h
enc/trans/japanese_sjis.$(OBJEXT): internal/value_type.h
enc/trans/japanese_sjis.$(OBJEXT): internal/variable.h
@@ -4921,7 +4875,6 @@ enc/trans/korean.$(OBJEXT): internal/static_assert.h
enc/trans/korean.$(OBJEXT): internal/stdalign.h
enc/trans/korean.$(OBJEXT): internal/stdbool.h
enc/trans/korean.$(OBJEXT): internal/symbol.h
-enc/trans/korean.$(OBJEXT): internal/token_paste.h
enc/trans/korean.$(OBJEXT): internal/value.h
enc/trans/korean.$(OBJEXT): internal/value_type.h
enc/trans/korean.$(OBJEXT): internal/variable.h
@@ -5081,7 +5034,6 @@ enc/trans/newline.$(OBJEXT): internal/static_assert.h
enc/trans/newline.$(OBJEXT): internal/stdalign.h
enc/trans/newline.$(OBJEXT): internal/stdbool.h
enc/trans/newline.$(OBJEXT): internal/symbol.h
-enc/trans/newline.$(OBJEXT): internal/token_paste.h
enc/trans/newline.$(OBJEXT): internal/value.h
enc/trans/newline.$(OBJEXT): internal/value_type.h
enc/trans/newline.$(OBJEXT): internal/variable.h
@@ -5240,7 +5192,6 @@ enc/trans/single_byte.$(OBJEXT): internal/static_assert.h
enc/trans/single_byte.$(OBJEXT): internal/stdalign.h
enc/trans/single_byte.$(OBJEXT): internal/stdbool.h
enc/trans/single_byte.$(OBJEXT): internal/symbol.h
-enc/trans/single_byte.$(OBJEXT): internal/token_paste.h
enc/trans/single_byte.$(OBJEXT): internal/value.h
enc/trans/single_byte.$(OBJEXT): internal/value_type.h
enc/trans/single_byte.$(OBJEXT): internal/variable.h
@@ -5402,7 +5353,6 @@ enc/trans/utf8_mac.$(OBJEXT): internal/static_assert.h
enc/trans/utf8_mac.$(OBJEXT): internal/stdalign.h
enc/trans/utf8_mac.$(OBJEXT): internal/stdbool.h
enc/trans/utf8_mac.$(OBJEXT): internal/symbol.h
-enc/trans/utf8_mac.$(OBJEXT): internal/token_paste.h
enc/trans/utf8_mac.$(OBJEXT): internal/value.h
enc/trans/utf8_mac.$(OBJEXT): internal/value_type.h
enc/trans/utf8_mac.$(OBJEXT): internal/variable.h
@@ -5562,7 +5512,6 @@ enc/trans/utf_16_32.$(OBJEXT): internal/static_assert.h
enc/trans/utf_16_32.$(OBJEXT): internal/stdalign.h
enc/trans/utf_16_32.$(OBJEXT): internal/stdbool.h
enc/trans/utf_16_32.$(OBJEXT): internal/symbol.h
-enc/trans/utf_16_32.$(OBJEXT): internal/token_paste.h
enc/trans/utf_16_32.$(OBJEXT): internal/value.h
enc/trans/utf_16_32.$(OBJEXT): internal/value_type.h
enc/trans/utf_16_32.$(OBJEXT): internal/variable.h
@@ -5725,7 +5674,6 @@ enc/unicode.$(OBJEXT): internal/static_assert.h
enc/unicode.$(OBJEXT): internal/stdalign.h
enc/unicode.$(OBJEXT): internal/stdbool.h
enc/unicode.$(OBJEXT): internal/symbol.h
-enc/unicode.$(OBJEXT): internal/token_paste.h
enc/unicode.$(OBJEXT): internal/value.h
enc/unicode.$(OBJEXT): internal/value_type.h
enc/unicode.$(OBJEXT): internal/variable.h
@@ -5886,7 +5834,6 @@ enc/us_ascii.$(OBJEXT): internal/static_assert.h
enc/us_ascii.$(OBJEXT): internal/stdalign.h
enc/us_ascii.$(OBJEXT): internal/stdbool.h
enc/us_ascii.$(OBJEXT): internal/symbol.h
-enc/us_ascii.$(OBJEXT): internal/token_paste.h
enc/us_ascii.$(OBJEXT): internal/value.h
enc/us_ascii.$(OBJEXT): internal/value_type.h
enc/us_ascii.$(OBJEXT): internal/variable.h
@@ -5953,7 +5900,6 @@ enc/utf_16be.$(OBJEXT): internal/has/feature.h
enc/utf_16be.$(OBJEXT): internal/has/warning.h
enc/utf_16be.$(OBJEXT): internal/stdalign.h
enc/utf_16be.$(OBJEXT): internal/stdbool.h
-enc/utf_16be.$(OBJEXT): internal/token_paste.h
enc/utf_16be.$(OBJEXT): internal/warning_push.h
enc/utf_16be.$(OBJEXT): internal/xmalloc.h
enc/utf_16be.$(OBJEXT): assert.h
@@ -6011,7 +5957,6 @@ enc/utf_16le.$(OBJEXT): internal/has/feature.h
enc/utf_16le.$(OBJEXT): internal/has/warning.h
enc/utf_16le.$(OBJEXT): internal/stdalign.h
enc/utf_16le.$(OBJEXT): internal/stdbool.h
-enc/utf_16le.$(OBJEXT): internal/token_paste.h
enc/utf_16le.$(OBJEXT): internal/warning_push.h
enc/utf_16le.$(OBJEXT): internal/xmalloc.h
enc/utf_16le.$(OBJEXT): assert.h
@@ -6069,7 +6014,6 @@ enc/utf_32be.$(OBJEXT): internal/has/feature.h
enc/utf_32be.$(OBJEXT): internal/has/warning.h
enc/utf_32be.$(OBJEXT): internal/stdalign.h
enc/utf_32be.$(OBJEXT): internal/stdbool.h
-enc/utf_32be.$(OBJEXT): internal/token_paste.h
enc/utf_32be.$(OBJEXT): internal/warning_push.h
enc/utf_32be.$(OBJEXT): internal/xmalloc.h
enc/utf_32be.$(OBJEXT): assert.h
@@ -6127,7 +6071,6 @@ enc/utf_32le.$(OBJEXT): internal/has/feature.h
enc/utf_32le.$(OBJEXT): internal/has/warning.h
enc/utf_32le.$(OBJEXT): internal/stdalign.h
enc/utf_32le.$(OBJEXT): internal/stdbool.h
-enc/utf_32le.$(OBJEXT): internal/token_paste.h
enc/utf_32le.$(OBJEXT): internal/warning_push.h
enc/utf_32le.$(OBJEXT): internal/xmalloc.h
enc/utf_32le.$(OBJEXT): assert.h
@@ -6281,7 +6224,6 @@ enc/utf_8.$(OBJEXT): internal/static_assert.h
enc/utf_8.$(OBJEXT): internal/stdalign.h
enc/utf_8.$(OBJEXT): internal/stdbool.h
enc/utf_8.$(OBJEXT): internal/symbol.h
-enc/utf_8.$(OBJEXT): internal/token_paste.h
enc/utf_8.$(OBJEXT): internal/value.h
enc/utf_8.$(OBJEXT): internal/value_type.h
enc/utf_8.$(OBJEXT): internal/variable.h
@@ -6348,7 +6290,6 @@ enc/windows_1250.$(OBJEXT): internal/has/feature.h
enc/windows_1250.$(OBJEXT): internal/has/warning.h
enc/windows_1250.$(OBJEXT): internal/stdalign.h
enc/windows_1250.$(OBJEXT): internal/stdbool.h
-enc/windows_1250.$(OBJEXT): internal/token_paste.h
enc/windows_1250.$(OBJEXT): internal/warning_push.h
enc/windows_1250.$(OBJEXT): internal/xmalloc.h
enc/windows_1250.$(OBJEXT): assert.h
@@ -6406,7 +6347,6 @@ enc/windows_1251.$(OBJEXT): internal/has/feature.h
enc/windows_1251.$(OBJEXT): internal/has/warning.h
enc/windows_1251.$(OBJEXT): internal/stdalign.h
enc/windows_1251.$(OBJEXT): internal/stdbool.h
-enc/windows_1251.$(OBJEXT): internal/token_paste.h
enc/windows_1251.$(OBJEXT): internal/warning_push.h
enc/windows_1251.$(OBJEXT): internal/xmalloc.h
enc/windows_1251.$(OBJEXT): assert.h
@@ -6463,7 +6403,6 @@ enc/windows_1252.$(OBJEXT): internal/has/feature.h
enc/windows_1252.$(OBJEXT): internal/has/warning.h
enc/windows_1252.$(OBJEXT): internal/stdalign.h
enc/windows_1252.$(OBJEXT): internal/stdbool.h
-enc/windows_1252.$(OBJEXT): internal/token_paste.h
enc/windows_1252.$(OBJEXT): internal/warning_push.h
enc/windows_1252.$(OBJEXT): internal/xmalloc.h
enc/windows_1252.$(OBJEXT): assert.h
@@ -6521,7 +6460,6 @@ enc/windows_1253.$(OBJEXT): internal/has/feature.h
enc/windows_1253.$(OBJEXT): internal/has/warning.h
enc/windows_1253.$(OBJEXT): internal/stdalign.h
enc/windows_1253.$(OBJEXT): internal/stdbool.h
-enc/windows_1253.$(OBJEXT): internal/token_paste.h
enc/windows_1253.$(OBJEXT): internal/warning_push.h
enc/windows_1253.$(OBJEXT): internal/xmalloc.h
enc/windows_1253.$(OBJEXT): assert.h
@@ -6578,7 +6516,6 @@ enc/windows_1254.$(OBJEXT): internal/has/feature.h
enc/windows_1254.$(OBJEXT): internal/has/warning.h
enc/windows_1254.$(OBJEXT): internal/stdalign.h
enc/windows_1254.$(OBJEXT): internal/stdbool.h
-enc/windows_1254.$(OBJEXT): internal/token_paste.h
enc/windows_1254.$(OBJEXT): internal/warning_push.h
enc/windows_1254.$(OBJEXT): internal/xmalloc.h
enc/windows_1254.$(OBJEXT): assert.h
@@ -6636,7 +6573,6 @@ enc/windows_1257.$(OBJEXT): internal/has/feature.h
enc/windows_1257.$(OBJEXT): internal/has/warning.h
enc/windows_1257.$(OBJEXT): internal/stdalign.h
enc/windows_1257.$(OBJEXT): internal/stdbool.h
-enc/windows_1257.$(OBJEXT): internal/token_paste.h
enc/windows_1257.$(OBJEXT): internal/warning_push.h
enc/windows_1257.$(OBJEXT): internal/xmalloc.h
enc/windows_1257.$(OBJEXT): assert.h
@@ -6694,7 +6630,6 @@ enc/windows_31j.$(OBJEXT): internal/has/feature.h
enc/windows_31j.$(OBJEXT): internal/has/warning.h
enc/windows_31j.$(OBJEXT): internal/stdalign.h
enc/windows_31j.$(OBJEXT): internal/stdbool.h
-enc/windows_31j.$(OBJEXT): internal/token_paste.h
enc/windows_31j.$(OBJEXT): internal/warning_push.h
enc/windows_31j.$(OBJEXT): internal/xmalloc.h
enc/windows_31j.$(OBJEXT): assert.h
diff --git a/enum.c b/enum.c
index b3a8f9e..0538f43 100644
--- a/enum.c
+++ b/enum.c
@@ -132,21 +132,28 @@ enum_grep0(VALUE obj, VALUE pat, VALUE test)
}
/*
- * call-seq:
- * enum.grep(pattern) -> array
- * enum.grep(pattern) { |obj| block } -> array
+ * call-seq:
+ * grep(pattern) -> array
+ * grep(pattern) {|element| ... } -> array
+ *
+ * Returns an array of objects based elements of +self+ that match the given pattern.
*
- * Returns an array of every element in <i>enum</i> for which
- * <code>Pattern === element</code>. If the optional <em>block</em> is
- * supplied, each matching element is passed to it, and the block's
- * result is stored in the output array.
+ * With no block given, returns an array containing each element
+ * for which <tt>pattern === element</tt> is +true+:
*
- * (1..100).grep 38..44 #=> [38, 39, 40, 41, 42, 43, 44]
- * c = IO.constants
- * c.grep(/SEEK/) #=> [:SEEK_SET, :SEEK_CUR, :SEEK_END]
- * res = c.grep(/SEEK/) { |v| IO.const_get(v) }
- * res #=> [0, 1, 2]
+ * a = ['foo', 'bar', 'car', 'moo']
+ * a.grep(/ar/) # => ["bar", "car"]
+ * (1..10).grep(3..8) # => [3, 4, 5, 6, 7, 8]
+ * ['a', 'b', 0, 1].grep(Integer) # => [0, 1]
*
+ * With a block given,
+ * calls the block with each matching element and returns an array containing each
+ * object returned by the block:
+ *
+ * a = ['foo', 'bar', 'car', 'moo']
+ * a.grep(/ar/) {|element| element.upcase } # => ["BAR", "CAR"]
+ *
+ * Related: #grep_v.
*/
static VALUE
@@ -156,18 +163,29 @@ enum_grep(VALUE obj, VALUE pat)
}
/*
- * call-seq:
- * enum.grep_v(pattern) -> array
- * enum.grep_v(pattern) { |obj| block } -> array
+ * call-seq:
+ * grep_v(pattern) -> array
+ * grep_v(pattern) {|element| ... } -> array
+ *
+ * Returns an array of objects based on elements of +self+
+ * that <em>don't</em> match the given pattern.
+ *
+ * With no block given, returns an array containing each element
+ * for which <tt>pattern === element</tt> is +false+:
*
- * Inverted version of Enumerable#grep.
- * Returns an array of every element in <i>enum</i> for which
- * not <code>Pattern === element</code>.
+ * a = ['foo', 'bar', 'car', 'moo']
+ * a.grep_v(/ar/) # => ["foo", "moo"]
+ * (1..10).grep_v(3..8) # => [1, 2, 9, 10]
+ * ['a', 'b', 0, 1].grep_v(Integer) # => ["a", "b"]
*
- * (1..10).grep_v 2..5 #=> [1, 6, 7, 8, 9, 10]
- * res =(1..10).grep_v(2..5) { |v| v * 2 }
- * res #=> [2, 12, 14, 16, 18, 20]
+ * With a block given,
+ * calls the block with each non-matching element and returns an array containing each
+ * object returned by the block:
*
+ * a = ['foo', 'bar', 'car', 'moo']
+ * a.grep_v(/ar/) {|element| element.upcase } # => ["FOO", "MOO"]
+ *
+ * Related: #grep.
*/
static VALUE
@@ -238,20 +256,28 @@ count_all_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
}
/*
- * call-seq:
- * enum.count -> int
- * enum.count(item) -> int
- * enum.count { |obj| block } -> int
+ * call-seq:
+ * count -> integer
+ * count(object) -> integer
+ * count {|element| ... } -> integer
*
- * Returns the number of items in +enum+ through enumeration.
- * If an argument is given, the number of items in +enum+ that
- * are equal to +item+ are counted. If a block is given, it
- * counts the number of elements yielding a true value.
+ * Returns the count of elements, based on an argument or block criterion, if given.
*
- * ary = [1, 2, 4, 2]
- * ary.count #=> 4
- * ary.count(2) #=> 2
- * ary.count{ |x| x%2==0 } #=> 3
+ * With no argument and no block given, returns the number of elements:
+ *
+ * [0, 1, 2].count # => 3
+ * {foo: 0, bar: 1, baz: 2}.count # => 3
+ *
+ * With argument +object+ given,
+ * returns the number of elements that are <tt>==</tt> to +object+:
+ *
+ * [0, 1, 2, 1].count(1) # => 2
+ *
+ * With a block given, calls the block with each element
+ * and returns the number of elements for which the block returns a truthy value:
+ *
+ * [0, 1, 2, 3].count {|element| element < 2} # => 2
+ * {foo: 0, bar: 1, baz: 2}.count {|key, value| value < 2} # => 2
*
*/
@@ -298,31 +324,26 @@ find_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
}
/*
- * call-seq:
- * enum.detect(ifnone = nil) { |obj| block } -> obj or nil
- * enum.find(ifnone = nil) { |obj| block } -> obj or nil
- * enum.detect(ifnone = nil) -> an_enumerator
- * enum.find(ifnone = nil) -> an_enumerator
+ * call-seq:
+ * find(if_none_proc = nil) {|element| ... } -> object or nil
+ * find(if_none_proc = nil) -> enumerator
*
- * Passes each entry in <i>enum</i> to <em>block</em>. Returns the
- * first for which <em>block</em> is not false. If no
- * object matches, calls <i>ifnone</i> and returns its result when it
- * is specified, or returns <code>nil</code> otherwise.
+ * Returns the first element for which the block returns a truthy value.
*
- * If no block is given, an enumerator is returned instead.
+ * With a block given, calls the block with successive elements of the collection;
+ * returns the first element for which the block returns a truthy value:
+ *
+ * (0..9).find {|element| element > 2} # => 3
*
- * (1..100).detect #=> #<Enumerator: 1..100:detect>
- * (1..100).find #=> #<Enumerator: 1..100:find>
+ * If no such element is found, calls +if_none_proc+ and returns its return value.
*
- * (1..10).detect { |i| i % 5 == 0 && i % 7 == 0 } #=> nil
- * (1..10).find { |i| i % 5 == 0 && i % 7 == 0 } #=> nil
- * (1..10).detect(-> {0}) { |i| i % 5 == 0 && i % 7 == 0 } #=> 0
- * (1..10).find(-> {0}) { |i| i % 5 == 0 && i % 7 == 0 } #=> 0
- * (1..100).detect { |i| i % 5 == 0 && i % 7 == 0 } #=> 35
- * (1..100).find { |i| i % 5 == 0 && i % 7 == 0 } #=> 35
+ * (0..9).find(proc {false}) {|element| element > 12} # => false
+ * {foo: 0, bar: 1, baz: 2}.find {|key, value| key.start_with?('b') } # => [:bar, 1]
+ * {foo: 0, bar: 1, baz: 2}.find(proc {[]}) {|key, value| key.start_with?('c') } # => []
+ *
+ * With no block given, returns an \Enumerator.
*
*/
-
static VALUE
enum_find(int argc, VALUE *argv, VALUE obj)
{
@@ -371,21 +392,26 @@ find_index_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
}
/*
- * call-seq:
- * enum.find_index(value) -> int or nil
- * enum.find_index { |obj| block } -> int or nil
- * enum.find_index -> an_enumerator
+ * call-seq:
+ * find_index(object) -> integer or nil
+ * find_index {|element| ... } -> integer or nil
+ * find_index -> enumerator
+ *
+ * Returns the index of the first element that meets a specified criterion,
+ * or +nil+ if no such element is found.
+ *
+ * With argument +object+ given,
+ * returns the index of the first element that is <tt>==</tt> +object+:
*
- * Compares each entry in <i>enum</i> with <em>value</em> or passes
- * to <em>block</em>. Returns the index for the first for which the
- * evaluated value is non-false. If no object matches, returns
- * <code>nil</code>
+ * ['a', 'b', 'c', 'b'].find_index('b') # => 1
*
- * If neither block nor argument is given, an enumerator is returned instead.
+ * With a block given, calls the block with successive elements;
+ * returns the first element for which the block returns a truthy value:
*
- * (1..10).find_index { |i| i % 5 == 0 && i % 7 == 0 } #=> nil
- * (1..100).find_index { |i| i % 5 == 0 && i % 7 == 0 } #=> 34
- * (1..100).find_index(50) #=> 49
+ * ['a', 'b', 'c', 'b'].find_index {|element| element.start_with?('b') } # => 1
+ * {foo: 0, bar: 1, baz: 2}.find_index {|key, value| value > 1 } # => 2
+ *
+ * With no argument and no block given, returns an \Enumerator.
*
*/
@@ -449,32 +475,23 @@ enum_size_over_p(VALUE obj, long n)
}
/*
- * call-seq:
- * enum.find_all { |obj| block } -> array
- * enum.select { |obj| block } -> array
- * enum.filter { |obj| block } -> array
- * enum.find_all -> an_enumerator
- * enum.select -> an_enumerator
- *