diff --git a/common.mk b/common.mk index bc1e39528fb3b1..fe4fbce0381edf 100644 --- a/common.mk +++ b/common.mk @@ -195,6 +195,7 @@ INSTRUBY_ARGS = $(SCRIPT_ARGS) \ INSTALL_PROG_MODE = 0755 INSTALL_DATA_MODE = 0644 +BOOTSTRAPRUBY_COMMAND = $(BOOTSTRAPRUBY) $(BOOTSTRAPRUBY_OPT) TESTSDIR = $(srcdir)/test TOOL_TESTSDIR = $(tooldir)/test TEST_EXCLUDES = --excludes-dir=$(TESTSDIR)/excludes $(ADDITIONAL_EXCLUDES) --name=!/memory_leak/ @@ -909,7 +910,7 @@ ENC_HEADERS = $(srcdir)/enc/jis/props.h $(ENC_MK): $(srcdir)/enc/make_encmake.rb $(srcdir)/enc/Makefile.in $(srcdir)/enc/depend \ $(srcdir)/enc/encinit.c.erb $(ENC_HEADERS) $(srcdir)/lib/mkmf.rb $(RBCONFIG) $(HAVE_BASERUBY)-fake $(ECHO) generating $@ - $(Q) $(BOOTSTRAPRUBY) -r./$(arch)-fake $(srcdir)/enc/make_encmake.rb \ + $(Q) $(BOOTSTRAPRUBY_COMMAND) $(srcdir)/enc/make_encmake.rb \ --builtin-encs="$(BUILTIN_ENCOBJS)" --builtin-transes="$(BUILTIN_TRANSOBJS)" --module$(ENCSTATIC) $(ENCS) $@ .PRECIOUS: $(MKFILES) @@ -1332,7 +1333,7 @@ lldb-ruby: $(PROGRAM) PHONY DISTPKGS = gzip,zip,all PKGSDIR = tmp dist: - $(BASERUBY) $(tooldir)/make-snapshot \ + $(BASERUBY) $(V0:1=-v) $(tooldir)/make-snapshot \ -srcdir=$(srcdir) -packages=$(DISTPKGS) \ -unicode-version=$(UNICODE_VERSION) \ $(DISTOPTS) $(PKGSDIR) $(RELNAME) diff --git a/configure.ac b/configure.ac index 52890805a1bcf9..7519e8379d3ae6 100644 --- a/configure.ac +++ b/configure.ac @@ -77,6 +77,7 @@ AS_IF([test "$HAVE_BASERUBY" != no -a "`RUBYOPT=- $BASERUBY --disable=gems -e 'p HAVE_BASERUBY=no ]) AS_IF([test "$HAVE_BASERUBY" = no], [ + AS_IF([test "$cross_compiling" = yes], [AC_MSG_ERROR([executable host ruby is required for cross-compiling])]) BASERUBY="echo executable host ruby is required. use --with-baseruby option.; false" ]) AC_SUBST(BASERUBY) @@ -3348,8 +3349,6 @@ for var in bindir includedir libdir rubylibprefix; do done BTESTRUBY='$(MINIRUBY)' -BOOTSTRAPRUBY='$(BASERUBY)' -BOOTSTRAPRUBY_COMMAND='$(BOOTSTRAPRUBY)' AS_IF([test x"$cross_compiling" = xyes], [ test x"$MINIRUBY" = x && MINIRUBY="${RUBY-$BASERUBY} -I`$CHDIR .; pwd` "-r'$(arch)-fake' XRUBY_LIBDIR=`${RUBY-$BASERUBY} -rrbconfig -e ['puts RbConfig::CONFIG["libdir"]']` @@ -3362,7 +3361,6 @@ AS_IF([test x"$cross_compiling" = xyes], [ RUNRUBY_COMMAND='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`' RUNRUBY='$(RUNRUBY_COMMAND)' XRUBY='$(MINIRUBY)' - BOOTSTRAPRUBY_COMMAND='$(BOOTSTRAPRUBY) -r./$(arch)-fake' TEST_RUNNABLE=no CROSS_COMPILING=yes AC_DEFINE(CROSS_COMPILING, 1) @@ -3373,9 +3371,6 @@ AS_IF([test x"$cross_compiling" = xyes], [ RUNRUBY_COMMAND='$(MINIRUBY) $(tooldir)/runruby.rb --extout=$(EXTOUT) $(RUNRUBYOPT)' RUNRUBY='$(RUNRUBY_COMMAND) --' XRUBY='$(RUNRUBY)' - AS_CASE(["$HAVE_BASERUBY"], - [yes], [BOOTSTRAPRUBY_COMMAND='$(BOOTSTRAPRUBY) -r./$(arch)-fake'], - [BOOTSTRAPRUBY='$(MINIRUBY)']) TEST_RUNNABLE=yes CROSS_COMPILING=no ]) @@ -3387,8 +3382,6 @@ AC_SUBST(PREP) AC_SUBST(RUNRUBY_COMMAND) AC_SUBST(RUNRUBY) AC_SUBST(XRUBY) -AC_SUBST(BOOTSTRAPRUBY) -AC_SUBST(BOOTSTRAPRUBY_COMMAND) AC_SUBST(EXTOUT, [${EXTOUT=.ext}]) FIRSTMAKEFILE="" diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb index b50667c31500f6..3cb4bf3c7e89da 100644 --- a/ext/psych/lib/psych/scalar_scanner.rb +++ b/ext/psych/lib/psych/scalar_scanner.rb @@ -63,7 +63,7 @@ def tokenize string elsif string.match?(/^\d{4}-(?:1[012]|0\d|\d)-(?:[12]\d|3[01]|0\d|\d)$/) require 'date' begin - class_loader.date.strptime(string, '%Y-%m-%d') + class_loader.date.strptime(string, '%F', Date::GREGORIAN) rescue ArgumentError string end diff --git a/ext/psych/lib/psych/versions.rb b/ext/psych/lib/psych/versions.rb index 0fdead154c19b0..f39d30ce5a1daa 100644 --- a/ext/psych/lib/psych/versions.rb +++ b/ext/psych/lib/psych/versions.rb @@ -5,6 +5,6 @@ module Psych VERSION = '5.0.0.dev' if RUBY_ENGINE == 'jruby' - DEFAULT_SNAKEYAML_VERSION = '1.28'.freeze + DEFAULT_SNAKEYAML_VERSION = '1.31'.freeze end end diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb index cce5daf3bbdbfe..8614251ca9e6c3 100644 --- a/ext/psych/lib/psych/visitors/to_ruby.rb +++ b/ext/psych/lib/psych/visitors/to_ruby.rb @@ -80,7 +80,9 @@ def deserialize o when "!ruby/object:DateTime" class_loader.date_time require 'date' unless defined? DateTime - @ss.parse_time(o.value).to_datetime + t = @ss.parse_time(o.value) + DateTime.civil(*t.to_a[0, 6].reverse, Rational(t.utc_offset, 86400)) + + (t.subsec/86400) when '!ruby/encoding' ::Encoding.find o.value when "!ruby/object:Complex" diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb index 316a3a949641f4..31858798e447cd 100644 --- a/ext/psych/lib/psych/visitors/yaml_tree.rb +++ b/ext/psych/lib/psych/visitors/yaml_tree.rb @@ -192,12 +192,13 @@ def visit_Regexp o register o, @emitter.scalar(o.inspect, nil, '!ruby/regexp', false, false, Nodes::Scalar::ANY) end + def visit_Date o + register o, visit_Integer(o.gregorian) + end + def visit_DateTime o - formatted = if o.offset.zero? - o.strftime("%Y-%m-%d %H:%M:%S.%9N Z".freeze) - else - o.strftime("%Y-%m-%d %H:%M:%S.%9N %:z".freeze) - end + t = o.italy + formatted = format_time t, t.offset.zero? tag = '!ruby/object:DateTime' register o, @emitter.scalar(formatted, nil, tag, false, false, Nodes::Scalar::ANY) end @@ -235,7 +236,6 @@ def visit_Integer o end alias :visit_TrueClass :visit_Integer alias :visit_FalseClass :visit_Integer - alias :visit_Date :visit_Integer def visit_Float o if o.nan? @@ -482,8 +482,8 @@ def dump_exception o, msg @emitter.end_mapping end - def format_time time - if time.utc? + def format_time time, utc = time.utc? + if utc time.strftime("%Y-%m-%d %H:%M:%S.%9N Z") else time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z") diff --git a/lib/rubygems/query_utils.rb b/lib/rubygems/query_utils.rb index a502717f94c96a..c72955f83b4e85 100644 --- a/lib/rubygems/query_utils.rb +++ b/lib/rubygems/query_utils.rb @@ -151,7 +151,7 @@ def show_remote_gems(name) fetcher.detect(specs_type) { true } else fetcher.detect(specs_type) do |name_tuple| - name === name_tuple.name + name === name_tuple.name && options[:version].satisfied_by?(name_tuple.version) end end @@ -159,7 +159,7 @@ def show_remote_gems(name) end def specs_type - if options[:all] + if options[:all] || options[:version].specific? if options[:prerelease] :complete else diff --git a/mjit.c b/mjit.c index d3e18c112cc65d..1997eaa939ab85 100644 --- a/mjit.c +++ b/mjit.c @@ -1237,6 +1237,7 @@ static void mjit_wait(struct rb_iseq_constant_body *body); static void check_unit_queue(void) { + if (mjit_opts.custom) return; if (worker_stopped) return; if (current_cc_pid != 0) return; // still compiling @@ -1431,7 +1432,7 @@ mjit_hook_custom_compile(const rb_iseq_t *iseq) static void mjit_add_iseq_to_process(const rb_iseq_t *iseq, const struct rb_mjit_compile_info *compile_info, bool recompile_p) { - if (!mjit_enabled || pch_status == PCH_FAILED || !rb_ractor_main_p()) // TODO: Support non-main Ractors + if (!mjit_enabled || pch_status != PCH_SUCCESS || !rb_ractor_main_p()) // TODO: Support non-main Ractors return; if (mjit_opts.custom) { mjit_hook_custom_compile(iseq); @@ -1957,9 +1958,10 @@ mjit_resume(void) // Lazily prepare PCH when --mjit=pause is given if (pch_status == PCH_NOT_READY) { - if (rb_respond_to(rb_mMJITCompiler, rb_intern("compile"))) { + if (rb_respond_to(rb_mMJIT, rb_intern("compile"))) { // [experimental] defining RubyVM::MJIT.compile allows you to replace JIT mjit_opts.custom = true; + pch_status = PCH_SUCCESS; } else { // Lazy MJIT boot @@ -2040,7 +2042,7 @@ mjit_finish(bool close_handle_p) mjit_dump_total_calls(); #endif - if (!mjit_opts.save_temps && getpid() == pch_owner_pid && pch_status != PCH_NOT_READY) + if (!mjit_opts.save_temps && getpid() == pch_owner_pid && pch_status == PCH_SUCCESS && !mjit_opts.custom) remove_file(pch_file); xfree(header_file); header_file = NULL; diff --git a/mjit_compiler.rb b/mjit_compiler.rb index 6785e2ffabba1e..9e032fc747703e 100644 --- a/mjit_compiler.rb +++ b/mjit_compiler.rb @@ -90,10 +90,16 @@ def mjit_capture_is_entries(body, is_entries) } end + # Convert encoded VM pointers to insn BINs. def rb_vm_insn_decode(encoded) Primitive.cexpr! 'INT2NUM(rb_vm_insn_decode(NUM2PTR(encoded)))' end + # Convert insn BINs to encoded VM pointers. This one is not used by the compiler, but useful for debugging. + def rb_vm_insn_encode(bin) + Primitive.cexpr! 'PTR2NUM((VALUE)rb_vm_get_insns_address_table()[NUM2INT(bin)])' + end + def insn_may_depend_on_sp_or_pc(insn, opes) _opes_addr = opes.to_i Primitive.cexpr! 'RBOOL(insn_may_depend_on_sp_or_pc(NUM2INT(insn), (VALUE *)NUM2PTR(_opes_addr)))' @@ -104,13 +110,10 @@ def to_ruby(value) Primitive.cexpr! '(VALUE)NUM2PTR(value)' end - def debug(status) - _cc_entries_addr = status.compiled_iseq.jit_unit.cc_entries.instance_variable_get(:@addr) - Primitive.cstmt! %{ - const struct rb_callcache **cc_entries = (const struct rb_callcache **)NUM2PTR(_cc_entries_addr); - fprintf(stderr, "debug: %p\n", cc_entries[0]); - return Qnil; - } + # Convert RubyVM::InstructionSequence to C.rb_iseq_t. Not used by the compiler, but useful for debugging. + def rb_iseqw_to_iseq(iseqw) + iseq_addr = Primitive.cexpr! 'PTR2NUM((VALUE)rb_iseqw_to_iseq(iseqw))' + rb_iseq_t.new(iseq_addr) end # TODO: remove this after migration diff --git a/template/Makefile.in b/template/Makefile.in index cc00ddf5858271..01ad030ce437d3 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -165,8 +165,11 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ XRUBY_LIBDIR = @XRUBY_LIBDIR@ XRUBY_RUBYLIBDIR = @XRUBY_RUBYLIBDIR@ XRUBY_RUBYHDRDIR = @XRUBY_RUBYHDRDIR@ -BOOTSTRAPRUBY = @BOOTSTRAPRUBY@ -BOOTSTRAPRUBY_COMMAND = @BOOTSTRAPRUBY_COMMAND@ + +yes_baseruby = $(HAVE_BASERUBY:no=) +no_baseruby = $(HAVE_BASERUBY:yes=) +BOOTSTRAPRUBY = $(yes_baseruby:yes=$(BASERUBY)) $(no_baseruby:no=$(MINIRUBY)) +BOOTSTRAPRUBY_OPT = $(yes_baseruby:yes=-r./$(arch)-fake) COROUTINE_H = @X_COROUTINE_H@ COROUTINE_OBJ = $(COROUTINE_H:.h=.$(OBJEXT)) diff --git a/test/excludes/Psych/TestDateTime.rb b/test/excludes/Psych/TestDateTime.rb deleted file mode 100644 index 63d99be809279a..00000000000000 --- a/test/excludes/Psych/TestDateTime.rb +++ /dev/null @@ -1,4 +0,0 @@ -exclude(:test_new_datetime, < +#endif + #ifndef USE_NATIVE_THREAD_PRIORITY #define USE_NATIVE_THREAD_PRIORITY 0 #define RUBY_THREAD_PRIORITY_MAX 3 diff --git a/tool/make-snapshot b/tool/make-snapshot index b88bcdc2973cd0..02b5d182f5a213 100755 --- a/tool/make-snapshot +++ b/tool/make-snapshot @@ -22,6 +22,7 @@ $keep_temp ||= nil $patch_file ||= nil $packages ||= nil $digests ||= nil +$no7z ||= nil $tooldir = File.expand_path("..", __FILE__) $unicode_version = nil if ($unicode_version ||= nil) == "" $colorize = Colorize.new @@ -146,7 +147,7 @@ unless destdir = ARGV.shift end revisions = ARGV.empty? ? [nil] : ARGV -if $exported +if defined?($exported) abort "#{File.basename $0}: -exported option is deprecated; use -srcdir instead" end @@ -416,7 +417,7 @@ def package(vcs, rev, destdir, tmp = nil) f.puts "Object.__send__(:remove_const, :RUBY_VERSION)" f.puts "RUBY_VERSION='#{version}'" end - warn "cross.rb:", File.read("cross.rb").gsub(/^/, "> "), "" + puts "cross.rb:", File.read("cross.rb").gsub(/^/, "> "), "" if $VERBOSE unless File.exist?("configure") print "creating configure..." unless system([ENV["AUTOCONF"]]*2) diff --git a/version.h b/version.h index 40999ed5ac7674..513a862e648b85 100644 --- a/version.h +++ b/version.h @@ -15,7 +15,7 @@ #define RUBY_RELEASE_YEAR 2022 #define RUBY_RELEASE_MONTH 9 -#define RUBY_RELEASE_DAY 6 +#define RUBY_RELEASE_DAY 7 #include "ruby/version.h" #include "ruby/internal/abi.h" diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 2910901d7e9ea2..e4b9a3cac88875 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -24,6 +24,14 @@ REVISION_FORCE = PHONY !ifndef CROSS_COMPILING CROSS_COMPILING = no +!else if "$(CROSS_COMPILING)" == "yes" +! if "$(HAVE_BASERUBY)" != "yes" +! error executable host ruby is required for cross-compiling +! endif +!else +! if "$(CROSS_COMPILING)" != "no" +! error Bad CROSS_COMPILING +! endif !endif !ifndef win_srcdir win_srcdir = $(srcdir)/win32 @@ -355,13 +363,15 @@ RUNRUBY = .\$(PROGRAM) -I$(srcdir)/lib -I"$(EXTOUT)/$(arch)" -I. !endif MINIRUBY = $(MINIRUBY) $(MINIRUBYOPT) RUNRUBY = $(RUNRUBY) "$(tooldir)/runruby.rb" --extout="$(EXTOUT)" $(RUNRUBYOPT) -- $(RUN_OPTS) +yes_baseruby = $(HAVE_BASERUBY:no=) +no_baseruby = $(HAVE_BASERUBY:yes=) !if "$(CROSS_COMPILING)" == "yes" XRUBY = $(MINIRUBY) BOOTSTRAPRUBY = $(BASERUBY) -BOOTSTRAPRUBY_COMMAND = $(BOOTSTRAPRUBY) -r./$(arch)-fake +BOOTSTRAPRUBY_OPT = -r./$(arch)-fake !else BOOTSTRAPRUBY = $(MINIRUBY) -BOOTSTRAPRUBY_COMMAND = $(BOOTSTRAPRUBY) +BOOTSTRAPRUBY_OPT = XRUBY = $(RUNRUBY) !endif BTESTRUBY = $(MINIRUBY) -r./$(arch)-fake