diff options
Diffstat (limited to 'defs')
| -rw-r--r-- | defs/gmake.mk | 155 | ||||
| -rw-r--r-- | defs/id.def | 11 | ||||
| -rw-r--r-- | defs/jit.mk | 107 | ||||
| -rw-r--r-- | defs/known_errors.def | 206 | ||||
| -rw-r--r-- | defs/opt_insn_unif.def | 8 |
5 files changed, 332 insertions, 155 deletions
diff --git a/defs/gmake.mk b/defs/gmake.mk index 40a4750c73..0320f9b7d5 100644 --- a/defs/gmake.mk +++ b/defs/gmake.mk @@ -2,6 +2,7 @@ reconfig config.status: export MAKE:=$(MAKE) export BASERUBY:=$(BASERUBY) +export GIT override gnumake_recursive := $(if $(findstring n,$(firstword $(MFLAGS))),,+) override mflags := $(filter-out -j%,$(MFLAGS)) MSPECOPT += $(if $(filter -j%,$(MFLAGS)),-j) @@ -37,7 +38,7 @@ TEST_TARGETS := $(patsubst test,test-short,$(TEST_TARGETS)) TEST_DEPENDS := $(filter-out test $(TEST_TARGETS),$(TEST_DEPENDS)) TEST_TARGETS := $(patsubst test-short,btest-ruby test-knownbug test-basic,$(TEST_TARGETS)) TEST_TARGETS := $(patsubst test-basic,test-basic test-leaked-globals,$(TEST_TARGETS)) -TEST_TARGETS := $(patsubst test-bundled-gems,test-bundled-gems-run,$(TEST_TARGETS)) +TEST_TARGETS := $(patsubst test-bundled-gems,test-bundled-gems-spec test-bundled-gems-run,$(TEST_TARGETS)) TEST_TARGETS := $(patsubst test-bundled-gems-run,test-bundled-gems-run $(PREPARE_BUNDLED_GEMS),$(TEST_TARGETS)) TEST_TARGETS := $(patsubst test-bundled-gems-prepare,test-bundled-gems-prepare $(PRECHECK_BUNDLED_GEMS) test-bundled-gems-fetch,$(TEST_TARGETS)) TEST_TARGETS := $(patsubst test-bundler-parallel,test-bundler-parallel $(PREPARE_BUNDLER),$(TEST_TARGETS)) @@ -97,6 +98,7 @@ ORDERED_TEST_TARGETS := $(filter $(TEST_TARGETS), \ test-bundler-prepare test-bundler test-bundler-parallel \ test-bundled-gems-precheck test-bundled-gems-fetch \ test-bundled-gems-prepare test-bundled-gems-run \ + test-bundled-gems-spec \ ) # grep ^yes-test-.*-precheck: template/Makefile.in defs/gmake.mk common.mk @@ -160,6 +162,10 @@ endif config.status: $(wildcard config.cache) +ifneq (ruby,$(PROGRAM)) +ruby: $(PROGRAM); +endif + STUBPROGRAM = rubystub$(EXEEXT) IGNOREDPATTERNS = %~ .% %.orig %.rej \#%\# SCRIPTBINDIR := $(if $(EXEEXT),,exec/) @@ -193,7 +199,7 @@ $(SCRIPTBINDIR): $(Q) mkdir $@ .PHONY: commit -COMMIT_PREPARE := $(filter-out commit do-commit,$(MAKECMDGOALS)) up +COMMIT_PREPARE := $(subst :,\:,$(filter-out commit do-commit,$(MAKECMDGOALS))) up commit: pre-commit $(DOT_WAIT) do-commit $(DOT_WAIT) post_commit pre-commit: $(COMMIT_PREPARE) @@ -203,7 +209,7 @@ post-commit: $(if $(DOT_WAIT),,do-commit) +$(Q) \ { \ $(in-srcdir) \ - exec sed -f tool/prereq.status defs/gmake.mk template/Makefile.in common.mk; \ + exec sed -f tool/prereq.status defs/gmake.mk template/Makefile.in common.mk depend; \ } | \ $(MAKE) $(mflags) Q=$(Q) ECHO=$(ECHO) \ top_srcdir="$(top_srcdir)" srcdir="$(srcdir)" srcs_vpath="" CHDIR="$(CHDIR)" \ @@ -215,8 +221,8 @@ post-commit: $(if $(DOT_WAIT),,do-commit) GITHUB_RUBY_URL = https://github.com/ruby/ruby PR = -COMMIT_GPG_SIGN = $(shell $(GIT) -C "$(srcdir)" config commit.gpgsign) -REMOTE_GITHUB_URL = $(shell $(GIT) -C "$(srcdir)" config remote.github.url) +COMMIT_GPG_SIGN = $(shell $(GIT_IN_SRC) config commit.gpgsign) +REMOTE_GITHUB_URL = $(shell $(GIT_IN_SRC) config remote.github.url) COMMITS_NOTES = commits .PHONY: fetch-github @@ -231,19 +237,19 @@ define fetch-github $(eval REMOTE_GITHUB_URL := $(REMOTE_GITHUB_URL)) $(if $(REMOTE_GITHUB_URL),, echo adding $(GITHUB_RUBY_URL) as remote github - $(GIT) -C "$(srcdir)" remote add github $(GITHUB_RUBY_URL) - $(GIT) -C "$(srcdir)" config --add remote.github.fetch +refs/notes/$(COMMITS_NOTES):refs/notes/$(COMMITS_NOTES) + $(GIT_IN_SRC) remote add github $(GITHUB_RUBY_URL) + $(GIT_IN_SRC) config --add remote.github.fetch +refs/notes/$(COMMITS_NOTES):refs/notes/$(COMMITS_NOTES) $(eval REMOTE_GITHUB_URL := $(GITHUB_RUBY_URL)) ) - $(if $(shell $(GIT) -C "$(srcdir)" rev-parse "github/pull/$(1)/head" -- 2> /dev/null), - $(GIT) -C "$(srcdir)" branch -f "gh-$(1)" "github/pull/$(1)/head", - $(GIT) -C "$(srcdir)" fetch -f github "pull/$(1)/head:gh-$(1)" + $(if $(shell $(GIT_IN_SRC) rev-parse "github/pull/$(1)/head" -- 2> /dev/null), + $(GIT_IN_SRC) branch -f "gh-$(1)" "github/pull/$(1)/head", + $(GIT_IN_SRC) fetch -f github "pull/$(1)/head:gh-$(1)" ) endef .PHONY: checkout-github checkout-github: fetch-github - $(GIT) -C "$(srcdir)" checkout "gh-$(PR)" + $(GIT_IN_SRC) checkout "gh-$(PR)" .PHONY: update-github update-github: fetch-github @@ -256,25 +262,25 @@ update-github: fetch-github $(eval PR_BRANCH := $(word 2,$(PULL_REQUEST_FORK_BRANCH))) $(eval GITHUB_UPDATE_WORKTREE := $(shell mktemp -d "$(srcdir)/gh-$(PR)-XXXXXX")) - $(GIT) -C "$(srcdir)" worktree add $(notdir $(GITHUB_UPDATE_WORKTREE)) "gh-$(PR)" + $(GIT_IN_SRC) worktree add $(notdir $(GITHUB_UPDATE_WORKTREE)) "gh-$(PR)" $(GIT) -C "$(GITHUB_UPDATE_WORKTREE)" merge master --no-edit @$(BASERUBY) -e 'print "Are you sure to push this to PR=$(PR)? [Y/n]: "; exit(gets.chomp != "n")' - $(GIT) -C "$(srcdir)" remote add fork-$(PR) git@github.com:$(FORK_REPO).git + $(GIT_IN_SRC) remote add fork-$(PR) git@github.com:$(FORK_REPO).git $(GIT) -C "$(GITHUB_UPDATE_WORKTREE)" push fork-$(PR) gh-$(PR):$(PR_BRANCH) - $(GIT) -C "$(srcdir)" remote rm fork-$(PR) - $(GIT) -C "$(srcdir)" worktree remove $(notdir $(GITHUB_UPDATE_WORKTREE)) - $(GIT) -C "$(srcdir)" branch -D gh-$(PR) + $(GIT_IN_SRC) remote rm fork-$(PR) + $(GIT_IN_SRC) worktree remove $(notdir $(GITHUB_UPDATE_WORKTREE)) + $(GIT_IN_SRC) branch -D gh-$(PR) .PHONY: pull-github pull-github: fetch-github $(call pull-github,$(PR)) define pull-github - $(eval GITHUB_MERGE_BASE := $(shell $(GIT) -C "$(srcdir)" log -1 --format=format:%H)) - $(eval GITHUB_MERGE_BRANCH := $(shell $(GIT) -C "$(srcdir)" symbolic-ref --short HEAD)) + $(eval GITHUB_MERGE_BASE := $(shell $(GIT_IN_SRC) rev-parse HEAD) + $(eval GITHUB_MERGE_BRANCH := $(shell $(GIT_IN_SRC) symbolic-ref --short HEAD)) $(eval GITHUB_MERGE_WORKTREE := $(shell mktemp -d "$(srcdir)/gh-$(1)-XXXXXX")) - $(GIT) -C "$(srcdir)" worktree prune - $(GIT) -C "$(srcdir)" worktree add $(notdir $(GITHUB_MERGE_WORKTREE)) "gh-$(1)" + $(GIT_IN_SRC) worktree prune + $(GIT_IN_SRC) worktree add $(notdir $(GITHUB_MERGE_WORKTREE)) "gh-$(1)" $(GIT) -C "$(GITHUB_MERGE_WORKTREE)" rebase $(GITHUB_MERGE_BRANCH) $(eval COMMIT_GPG_SIGN := $(COMMIT_GPG_SIGN)) $(if $(filter true,$(COMMIT_GPG_SIGN)), \ @@ -289,7 +295,7 @@ fetch-github-%: .PHONY: checkout-github-% checkout-github-%: fetch-github-% - $(GIT) -C "$(srcdir)" checkout "gh-$*" + $(GIT_IN_SRC) checkout "gh-$*" .PHONY: pr-% pull-github-% pr-% pull-github-%: fetch-github-% @@ -308,7 +314,7 @@ HELP_EXTRA_TASKS = \ # 4. "gem x.y.z URL" -> "gem-x.y.z" bundled-gems := $(shell sed \ -e 's/[ ][ ]*/ /g' \ - -e 's/^ //;/\#/d;s/ *$$//;/^$$/d' \ + -e 's/^ //;s/\#.*//;s/ *$$//;/^$$/d' \ $(if $(filter yes,$(HAVE_GIT)), \ -e 's/^\(.*\) \(.*\) \(.*\) \(.*\)/\1|\2|\4|\3/' \ ) \ @@ -364,7 +370,7 @@ $(srcdir)/.bundle/.timestamp: define build-gem $(srcdir)/gems/src/$(1)/.git: | $(srcdir)/gems/src $(ECHO) Cloning $(4) - $(Q) $(GIT) clone $(4) $$(@D) + $(Q) $(GIT) clone --depth=1 --no-tags $(4) $$(@D) $(bundled-gem-revision): \ $(if $(if $(wildcard $$(@)),$(filter $(3),$(shell cat $$(@)))),,PHONY) \ @@ -405,6 +411,7 @@ $(srcdir)/.bundle/gems: ifneq ($(DOT_WAIT),) up:: $(DOT_WAIT) after-update +after-update:: MINIRUBY = $(BASERUBY) endif ifneq ($(filter update-bundled_gems refresh-gems,$(MAKECMDGOALS)),) @@ -428,7 +435,7 @@ ifneq ($(DOT_WAIT),) endif ifeq ($(HAVE_GIT),yes) -REVISION_LATEST := $(shell $(CHDIR) $(srcdir) && $(GIT) log -1 --format=%H 2>/dev/null) +REVISION_LATEST := $(shell $(GIT_IN_SRC) rev-parse HEAD 2>/dev/null) else REVISION_LATEST := update endif @@ -441,12 +448,16 @@ $(REVISION_H): PHONY endif include $(top_srcdir)/yjit/yjit.mk +include $(top_srcdir)/zjit/zjit.mk +include $(top_srcdir)/defs/jit.mk # Query on the generated rdoc # # $ make rdoc:Integer#+ -rdoc\:%: PHONY - $(Q)$(RUNRUBY) $(srcdir)/libexec/ri --no-standard-docs --doc-dir=$(RDOCOUT) $(patsubst rdoc:%,%,$@) +rdoc\:%: PHONY programs $(RDOCOUT) update-default-gemspecs + $(Q)$(RUNRUBY) $(RUNOPT0) -I$(tooldir)/lib -rbundled_gem \ + -e "load BundledGem.command('rdoc', 'ri')" -- \ + --no-standard-docs --doc-dir=$(RDOCOUT) $(patsubst rdoc:%,%,$@) test_%.rb test/%: programs PHONY $(Q)$(exec) $(RUNRUBY) "$(TESTSDIR)/runner.rb" --ruby="$(RUNRUBY)" $(TEST_EXCLUDES) $(TESTOPTS) -- $(patsubst test/%,%,$@) @@ -488,7 +499,7 @@ endif update-deps: $(eval update_deps := $(shell date +update-deps-%Y%m%d)) $(eval deps_dir := $(shell mktemp -d)/$(update_deps)) - $(eval GIT_DIR := $(shell $(GIT) -C $(srcdir) rev-parse --absolute-git-dir)) + $(eval GIT_DIR := $(shell $(GIT_IN_SRC) rev-parse --absolute-git-dir)) $(GIT) --git-dir=$(GIT_DIR) worktree add $(deps_dir) cp $(tooldir)/config.guess $(tooldir)/config.sub $(deps_dir)/tool [ -f config.status ] && cp config.status $(deps_dir) @@ -502,10 +513,14 @@ update-deps: $(GIT) --git-dir=$(GIT_DIR) merge --no-edit --ff-only $(update_deps) $(GIT) --git-dir=$(GIT_DIR) branch --delete $(update_deps) +fix-depends check-depends: all hello + $(BASERUBY) -C $(srcdir) tool/update-deps $(if $(filter fix-%,$@),--fix) + # order-only-prerequisites doesn't work for $(RUBYSPEC_CAPIEXT) # because the same named directory exists in the source tree. -$(RUBYSPEC_CAPIEXT)/%.$(DLEXT): $(srcdir)/$(RUBYSPEC_CAPIEXT)/%.c $(srcdir)/$(RUBYSPEC_CAPIEXT)/rubyspec.h $(RUBY_H_INCLUDES) $(LIBRUBY) - $(ECHO) building $@ +$(RUBYSPEC_CAPIEXT)/%.$(DLEXT): $(srcdir)/$(RUBYSPEC_CAPIEXT)/%.c $(RUBYSPEC_CAPIEXT_DEPS) \ + | build-ext yes-rubyspec-capiext + $(no_silence:no=$(ECHO) building $@) $(Q) $(MAKEDIRS) $(@D) $(Q) $(DLDSHARED) -L. $(XDLDFLAGS) $(XLDFLAGS) $(LDFLAGS) $(INCFLAGS) $(CPPFLAGS) $(OUTFLAG)$@ $< $(LIBRUBYARG) ifneq ($(POSTLINK),) @@ -513,42 +528,86 @@ ifneq ($(POSTLINK),) endif $(Q) $(RMALL) $@.* -rubyspec-capiext: $(patsubst %.c,$(RUBYSPEC_CAPIEXT)/%.$(DLEXT),$(notdir $(wildcard $(srcdir)/$(RUBYSPEC_CAPIEXT)/*.c))) - @ $(NULLCMD) - -ifeq ($(ENABLE_SHARED),yes) -exts: rubyspec-capiext -endif +RUBYSPEC_CAPIEXT_EXTS := $(patsubst %.c,$(RUBYSPEC_CAPIEXT)/%.$(DLEXT),$(notdir $(wildcard $(srcdir)/$(RUBYSPEC_CAPIEXT)/*.c))) +rubyspec-capiext: $(RUBYSPEC_CAPIEXT_EXTS) -spec/%/ spec/%_spec.rb: programs exts PHONY +spec/%/ spec/%_spec.rb: programs exts $(RUBYSPEC_CAPIEXT_BUILD) PHONY +$(RUNRUBY) -r./$(arch)-fake $(srcdir)/spec/mspec/bin/mspec-run -B $(srcdir)/spec/default.mspec $(SPECOPTS) $(patsubst %,$(srcdir)/%,$@) ruby.pc: $(filter-out ruby.pc,$(ruby_pc)) +# `make matz`: bump up the MINOR; +# Copying NEWS.md to doc/NEWS/, and empty the details in NEWS.md. +# +# `make matz NEW=x.y`: bump up to x.y.0; +# Just update the version in the title of NEWS.md. + matz: up - $(eval OLD := $(MAJOR).$(MINOR).0) - $(eval MINOR := $(shell expr $(MINOR) + 1)) - $(eval NEW := $(MAJOR).$(MINOR).0) - $(eval message := Development of $(NEW) started.) - $(eval files := include/ruby/version.h include/ruby/internal/abi.h) - $(GIT) -C $(srcdir) mv -f NEWS.md doc/NEWS/NEWS-$(OLD).md - $(GIT) -C $(srcdir) commit -m "[DOC] Flush NEWS.md" +matz-commit: OLD := $(MAJOR).$(MINOR).0 +ifdef NEW +matz-commit: MAJOR := $(word 1,$(subst ., ,$(NEW))) +matz-commit: MINOR := $(word 2,$(subst ., ,$(NEW))) +matz-commit: $(DOT_WAIT) bump_news +bump_news$(DOT_WAIT): up +bump_headers$(DOT_WAIT): bump_news +else +matz-commit: MINOR := $(shell expr $(MINOR) + 1) +matz-commit: $(DOT_WAIT) reset_news +flush_news$(DOT_WAIT): up +bump_headers$(DOT_WAIT): reset_news +endif + +matz: $(DOT_WAIT) matz-commit +matz-commit: bump_headers +matz-commit: override NEW := $(MAJOR).$(MINOR).0 +matz-commit: files := include/ruby/version.h include/ruby/internal/abi.h +matz-commit: message := Development of $(NEW) started. + +flush_news: + $(GIT_IN_SRC) mv -f NEWS.md doc/NEWS/NEWS-$(OLD).md + $(GIT_IN_SRC) commit -m "[DOC] Flush NEWS.md" + +.PHONY: flush_news reset_news bump_news bump_headers + +bump_headers: sed -i~ \ + -e "s/^\(#define RUBY_API_VERSION_MAJOR\) .*/\1 $(MAJOR)/" \ -e "s/^\(#define RUBY_API_VERSION_MINOR\) .*/\1 $(MINOR)/" \ -e "s/^\(#define RUBY_ABI_VERSION\) .*/\1 0/" \ $(files:%=$(srcdir)/%) - $(GIT) -C $(srcdir) add $(files) + +reset_news: flush_news $(BASERUBY) -C $(srcdir) -p -00 \ - -e 'BEGIN {old, new = ARGV.shift(2); STDOUT.reopen("NEWS.md")}' \ + -e 'BEGIN {old, new = ARGV.shift(2); STDOUT.reopen(ARGV.shift)}' \ -e 'case $$.' \ -e 'when 1; $$_.sub!(/Ruby \K[0-9.]+/, new)' \ -e 'when 2; $$_.sub!(/\*\*\K[0-9.]+(?=\*\*)/, old)' \ -e 'end' \ -e 'next if /^[\[ *]/ =~ $$_' \ -e '$$_.sub!(/\n{2,}\z/, "\n\n")' \ - $(OLD) $(NEW) doc/NEWS/NEWS-$(OLD).md - $(GIT) -C $(srcdir) add NEWS.md - $(GIT) -C $(srcdir) commit -m "$(message)" + $(OLD) $(NEW) NEWS.md doc/NEWS/NEWS-$(OLD).md + +bump_news: + $(BASERUBY) -C $(srcdir) -p -i \ + -e 'BEGIN {new = ARGV.shift; print gets("").sub(/Ruby \K[0-9.]+/, new)}' \ + $(NEW) NEWS.md + +matz: matz-commit matz-push + +matz-commit: + $(GIT_IN_SRC) add NEWS.md $(files) + $(GIT_IN_SRC) commit -m "$(message)" + +GIT_REMOTE_ORIGIN = origin + +matz-push: matz-commit + $(eval origin_url := $(shell $(GIT_IN_SRC) remote get-url $(GIT_REMOTE_ORIGIN))) + $(if $(origin_url),,@false) + $(eval last_commit := $(shell $(GIT_IN_SRC) log -n1 --format=%H --author=matz HEAD~..HEAD)) + $(if $(last_commit),,$(ECHO) No matz commits 1>&2; false) + $(if $(filter 12-25 12-26,$(shell date +%m-%d)),,$(ECHO) Not the release date 1>&2; false) + $(ECHO) $$'\e[31m'Pushing to $$'\e[7m'$(GIT_REMOTE_ORIGIN)$$'\e[27m'" ($(origin_url))"$$'\e[m' + $(GIT_IN_SRC) push $(GIT_REMOTE_ORIGIN) tags: $(MAKE) GIT="$(GIT)" -C "$(srcdir)" -f defs/tags.mk diff --git a/defs/id.def b/defs/id.def index 2ddde7be70..344b072e76 100644 --- a/defs/id.def +++ b/defs/id.def @@ -8,6 +8,7 @@ firstline, predefined = __LINE__+1, %[\ inspect intern object_id + __id__ const_added const_missing method_missing MethodMissing @@ -27,6 +28,7 @@ firstline, predefined = __LINE__+1, %[\ send __send__ __recursive_key__ + clone initialize initialize_copy initialize_clone @@ -59,6 +61,11 @@ firstline, predefined = __LINE__+1, %[\ name nil path + pack + buffer + include? + aborted + exited _ UScore @@ -72,6 +79,8 @@ firstline, predefined = __LINE__+1, %[\ _7 NUMPARAM_7 _8 NUMPARAM_8 _9 NUMPARAM_9 + <it> ItImplicit + it It "/*NULL*/" NULL empty? @@ -97,6 +106,8 @@ firstline, predefined = __LINE__+1, %[\ $_ LASTLINE $~ BACKREF $! ERROR_INFO + + Ruby ] # VM ID OP Parser Token diff --git a/defs/jit.mk b/defs/jit.mk new file mode 100644 index 0000000000..2c1e819684 --- /dev/null +++ b/defs/jit.mk @@ -0,0 +1,107 @@ +# Make recipes that deal with the rust code of YJIT and ZJIT. +# +# $(gnumake_recursive) adds the '+' prefix to pass down GNU make's +# jobserver resources to cargo/rustc as rust-lang.org recommends. +# Without it, certain make version trigger a warning. It does not +# add the prefix when `make --dry-run` so dry runs are indeed dry. + +ifneq ($(JIT_CARGO_SUPPORT),no) + +# Show Cargo progress when doing `make V=1` +CARGO_VERBOSE_0 = -q +CARGO_VERBOSE_1 = +CARGO_VERBOSE = $(CARGO_VERBOSE_$(V)) + +# Because of Cargo cache, if the actual binary is not changed from the +# previous build, the mtime is preserved as the cached file. +# This means the target is not updated actually, and it will need to +# rebuild at the next build. +RUST_LIB_TOUCH = touch $@ + +# NOTE: MACOSX_DEPLOYMENT_TARGET to match `rustc --print deployment-target` to avoid the warning below. +# ld: warning: object file (target/debug/libjit.a(<libcapstone object>)) was built for +# newer macOS version (15.2) than being linked (15.0) +# This limits us to an older set of macOS API in the rust code, but we don't use any. +$(RUST_LIB): $(srcdir)/ruby.rs target/.rustc-version + $(Q)if [ '$(ZJIT_SUPPORT)' != no -a '$(YJIT_SUPPORT)' != no ]; then \ + echo 'building YJIT and ZJIT ($(JIT_CARGO_SUPPORT:yes=release) mode)'; \ + elif [ '$(ZJIT_SUPPORT)' != no ]; then \ + echo 'building ZJIT ($(JIT_CARGO_SUPPORT) mode)'; \ + elif [ '$(YJIT_SUPPORT)' != no ]; then \ + echo 'building YJIT ($(JIT_CARGO_SUPPORT) mode)'; \ + fi + $(gnumake_recursive)$(Q)CARGO_TARGET_DIR='$(CARGO_TARGET_DIR)' \ + CARGO_TERM_PROGRESS_WHEN='never' \ + MACOSX_DEPLOYMENT_TARGET=11.0 \ + $(CARGO) $(CARGO_VERBOSE) build --manifest-path '$(top_srcdir)/Cargo.toml' $(CARGO_BUILD_ARGS) + $(RUST_LIB_TOUCH) +else ifneq ($(strip $(RLIB_DIR)),) # combo build + +$(RUST_LIB): $(srcdir)/ruby.rs target/.rustc-version + $(ECHO) 'building $(@F)' + $(gnumake_recursive)$(Q) $(RUSTC) --edition=2024 \ + $(RUSTC_FLAGS) \ + '-L$(@D)' \ + --extern=yjit \ + --extern=zjit \ + --crate-type=staticlib \ + --cfg 'feature="yjit"' \ + --cfg 'feature="zjit"' \ + '--out-dir=$(@D)' \ + '$(top_srcdir)/ruby.rs' + +# Absolute path to avoid VPATH ambiguity +JIT_RLIB = $(TOP_BUILD_DIR)/$(RLIB_DIR)/libjit.rlib +$(YJIT_RLIB): $(JIT_RLIB) +$(ZJIT_RLIB): $(JIT_RLIB) +$(JIT_RLIB): target/.rustc-version + $(ECHO) 'building $(@F)' + $(gnumake_recursive)$(Q) $(RUSTC) --crate-name=jit \ + --edition=2024 \ + $(JIT_RUST_FLAGS) \ + $(RUSTC_FLAGS) \ + '--out-dir=$(@D)' \ + '$(top_srcdir)/jit/src/lib.rs' +endif # ifneq ($(JIT_CARGO_SUPPORT),no) + +RUST_LIB_SYMBOLS = $(RUST_LIB:.a=).symbols +$(RUST_LIBOBJ): $(RUST_LIB) + $(ECHO) 'partial linking $(RUST_LIB) into $@' +ifneq ($(findstring darwin,$(target_os)),) + $(Q) $(CC) -nodefaultlibs -r -o $@ -exported_symbols_list $(RUST_LIB_SYMBOLS) $(RUST_LIB) +else + $(Q) $(LD) -r -o $@ --whole-archive $(RUST_LIB) + -$(Q) $(OBJCOPY) --wildcard --keep-global-symbol='$(SYMBOL_PREFIX)rb_*' $(@) +endif + +rust-libobj: $(RUST_LIBOBJ) +rust-lib: $(RUST_LIB) + +rustc-version-check: target/.rustc-version + +target/.rustc-version: PHONY + $(eval prev_version := $(if $(wildcard $@),$(shell cat $@))) + $(eval curr_version := $(shell $(RUSTC) -V | cut -d' ' -f2)) + $(eval clean := $(filter-out $(prev_version),$(curr_version))) + $(if $(clean),$(ECHO) Cleaning $(@D) for rustc $(curr_version)) + $(if $(clean),$(Q)$(RMALL) $(@D)) + $(if $(clean),$(Q)$(MAKEDIRS) $(@D)) + $(if $(clean),$(Q)echo $(curr_version) > $@) + +# For Darwin only: a list of symbols that we want the glommed Rust static lib to export. +# Unfortunately, using wildcard like '_rb_*' with -exported-symbol does not work, at least +# not on version 820.1. Assume llvm-nm, so XCode 8.0 (from 2016) or newer. +# +# The -exported_symbols_list pulls out the right archive members. Symbols not listed +# in the list are made private extern, which are in turn made local as we're using `ld -r`. +# Note, section about -keep_private_externs in ld's man page hints at this behavior on which +# we rely. +ifneq ($(findstring darwin,$(target_os)),) +$(RUST_LIB_SYMBOLS): $(RUST_LIB) + $(Q) $(tooldir)/darwin-ar $(NM) --defined-only --extern-only $(RUST_LIB) | \ + sed -n -e 's/.* //' -e '/^$(SYMBOL_PREFIX)rb_/p' \ + -e '/^$(SYMBOL_PREFIX)rust_eh_personality/p' \ + > $@ + +$(RUST_LIBOBJ): $(RUST_LIB_SYMBOLS) +endif diff --git a/defs/known_errors.def b/defs/known_errors.def index 14b3cff265..23e9e53507 100644 --- a/defs/known_errors.def +++ b/defs/known_errors.def @@ -1,157 +1,157 @@ E2BIG Argument list too long EACCES Permission denied -EADDRINUSE Address in use +EADDRINUSE Address already in use EADDRNOTAVAIL Address not available -EADV +EADV Advertise error EAFNOSUPPORT Address family not supported -EAGAIN Resource unavailable, try again (may be the same value as [EWOULDBLOCK]) +EAGAIN Resource temporarily unavailable, try again (may be the same value as EWOULDBLOCK) EALREADY Connection already in progress -EAUTH -EBADARCH -EBADE -EBADEXEC +EAUTH Authentication error +EBADARCH Bad CPU type in executable +EBADE Bad exchange +EBADEXEC Bad executable EBADF Bad file descriptor -EBADFD -EBADMACHO +EBADFD File descriptor in bad state +EBADMACHO Malformed Macho file EBADMSG Bad message -EBADR -EBADRPC -EBADRQC -EBADSLT -EBFONT +EBADR Invalid request descriptor +EBADRPC RPC struct is bad +EBADRQC Invalid request code +EBADSLT Invalid slot +EBFONT Bad font file format EBUSY Device or resource busy ECANCELED Operation canceled -ECAPMODE +ECAPMODE Not permitted in capability mode ECHILD No child processes -ECHRNG -ECOMM +ECHRNG Channel number out of range +ECOMM Communication error on send ECONNABORTED Connection aborted ECONNREFUSED Connection refused ECONNRESET Connection reset -EDEADLK Resource deadlock would occur -EDEADLOCK +EDEADLK Resource deadlock avoided +EDEADLOCK File locking deadlock error EDESTADDRREQ Destination address required -EDEVERR +EDEVERR Device error; e.g., printer paper out EDOM Mathematics argument out of domain of function -EDOOFUS -EDOTDOT -EDQUOT Reserved +EDOOFUS Improper function use +EDOTDOT RFS specific error +EDQUOT Disk quota exceeded EEXIST File exists EFAULT Bad address EFBIG File too large -EFTYPE -EHOSTDOWN +EFTYPE Invalid file type or format +EHOSTDOWN Host is down EHOSTUNREACH Host is unreachable -EHWPOISON +EHWPOISON Memory page has hardware error EIDRM Identifier removed -EILSEQ Illegal byte sequence +EILSEQ Invalid or incomplete multibyte or wide character EINPROGRESS Operation in progress -EINTR Interrupted function +EINTR Interrupted function call EINVAL Invalid argument -EIO I/O error -EIPSEC +EIO Input/output error +EIPSEC IPsec processing failure EISCONN Socket is connected EISDIR Is a directory -EISNAM -EKEYEXPIRED -EKEYREJECTED -EKEYREVOKED -EL2HLT -EL2NSYNC -EL3HLT -EL3RST -ELIBACC -ELIBBAD -ELIBEXEC -ELIBMAX -ELIBSCN -ELNRNG +EISNAM Is a named file type +EKEYEXPIRED Key has expired +EKEYREJECTED Key was rejected by service +EKEYREVOKED Key has been revoked +EL2HLT Level 2 halted +EL2NSYNC Level 2 not synchronized +EL3HLT Level 3 halted +EL3RST Level 3 reset +ELIBACC Cannot access a needed shared library +ELIBBAD Accessing a corrupted shared library +ELIBEXEC Cannot exec a shared library directly +ELIBMAX Attempting to link in too many shared libraries +ELIBSCN .lib section in a.out corrupted +ELNRNG Link number out of range ELOOP Too many levels of symbolic links -EMEDIUMTYPE -EMFILE File descriptor value too large +EMEDIUMTYPE Wrong medium type +EMFILE Too many open files EMLINK Too many links -EMSGSIZE Message too large -EMULTIHOP Reserved +EMSGSIZE Message too long +EMULTIHOP Multihop attempted ENAMETOOLONG Filename too long -ENAVAIL -ENEEDAUTH +ENAVAIL No XENIX semaphores available +ENEEDAUTH Need authenticator ENETDOWN Network is down ENETRESET Connection aborted by network ENETUNREACH Network unreachable -ENFILE Too many files open in system -ENOANO -ENOATTR +ENFILE Too many open files in system +ENOANO No anode +ENOATTR Attribute not found ENOBUFS No buffer space available -ENOCSI -ENODATA [OB XSR] [Option Start] No message is available on the STREAM head read queue [Option End] +ENOCSI No CSI structure available +ENODATA No data available ENODEV No such device ENOENT No such file or directory -ENOEXEC Executable file format error -ENOKEY +ENOEXEC Exec format error +ENOKEY Required key not available ENOLCK No locks available -ENOLINK Reserved -ENOMEDIUM -ENOMEM Not enough space +ENOLINK Link has been severed +ENOMEDIUM No medium found +ENOMEM Not enough space/cannot allocate memory ENOMSG No message of the desired type -ENONET -ENOPKG -ENOPOLICY +ENONET Machine is not on the network +ENOPKG Package not installed +ENOPOLICY No such policy ENOPROTOOPT Protocol not available ENOSPC No space left on device -ENOSR [OB XSR] [Option Start] No STREAM resources [Option End] -ENOSTR [OB XSR] [Option Start] Not a STREAM [Option End] -ENOSYS Functionality not supported -ENOTBLK -ENOTCAPABLE +ENOSR No STREAM resources +ENOSTR Not a STREAM +ENOSYS Functionality not implemented +ENOTBLK Block device required +ENOTCAPABLE Capabilities insufficient ENOTCONN The socket is not connected -ENOTDIR Not a directory or a symbolic link to a directory +ENOTDIR Not a directory ENOTEMPTY Directory not empty -ENOTNAM +ENOTNAM Not a XENIX named type file ENOTRECOVERABLE State not recoverable ENOTSOCK Not a socket -ENOTSUP Not supported (may be the same value as [EOPNOTSUPP]) +ENOTSUP Operation not supported ENOTTY Inappropriate I/O control operation -ENOTUNIQ +ENOTUNIQ Name not unique on network ENXIO No such device or address -EOPNOTSUPP Operation not supported on socket (may be the same value as [ENOTSUP]) +EOPNOTSUPP Operation not supported on socket EOVERFLOW Value too large to be stored in data type -EOWNERDEAD Previous owner died +EOWNERDEAD Owner died EPERM Operation not permitted -EPFNOSUPPORT +EPFNOSUPPORT Protocol family not supported EPIPE Broken pipe -EPROCLIM -EPROCUNAVAIL -EPROGMISMATCH -EPROGUNAVAIL +EPROCLIM Too many processes +EPROCUNAVAIL Bad procedure for program +EPROGMISMATCH Program version wrong +EPROGUNAVAIL RPC program isn't available EPROTO Protocol error EPROTONOSUPPORT Protocol not supported EPROTOTYPE Protocol wrong type for socket -EPWROFF -EQFULL +EPWROFF Device power is off +EQFULL Interface output queue is full ERANGE Result too large -EREMCHG -EREMOTE -EREMOTEIO -ERESTART -ERFKILL +EREMCHG Remote address changed +EREMOTE Object is remote +EREMOTEIO Remote I/O error +ERESTART Interrupted system call should be restarted +ERFKILL Operation not possible due to RF-kill EROFS Read-only file system -ERPCMISMATCH -ESHLIBVERS -ESHUTDOWN -ESOCKTNOSUPPORT -ESPIPE Invalid seek +ERPCMISMATCH RPC version wrong +ESHLIBVERS Shared library version mismatch +ESHUTDOWN Cannot send after transport endpoint shutdown +ESOCKTNOSUPPORT Socket type not supported +ESPIPE Illegal seek ESRCH No such process -ESRMNT -ESTALE Reserved -ESTRPIPE -ETIME [OB XSR] [Option Start] Stream ioctl() timeout [Option End] +ESRMNT Server mount error +ESTALE Stale file handle +ESTRPIPE Streams pipe error +ETIME Timer expired ETIMEDOUT Connection timed out -ETOOMANYREFS +ETOOMANYREFS Too many references: cannot splice ETXTBSY Text file busy -EUCLEAN -EUNATCH -EUSERS -EWOULDBLOCK Operation would block (may be the same value as [EAGAIN]) -EXDEV Cross-device link -EXFULL -ELAST Largest errno +EUCLEAN Structure needs cleaning +EUNATCH Protocol driver not attached +EUSERS Too many users +EWOULDBLOCK Operation would block +EXDEV Invalid cross-device link +EXFULL Exchange full +ELAST Largest errno value diff --git a/defs/opt_insn_unif.def b/defs/opt_insn_unif.def index 31ae2eb6a1..5ce67538f1 100644 --- a/defs/opt_insn_unif.def +++ b/defs/opt_insn_unif.def @@ -6,12 +6,12 @@ __END__ putobject putobject -putobject putstring +putobject dupstring putobject setlocal -putstring putstring -putstring putobject -putstring setlocal +dupstring dupstring +dupstring putobject +dupstring setlocal # putnil end |
