Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 20549e4

Browse files
authored
Merge branch 'master' into system_working_atomic
2 parents 9cd8d75 + 1825ae4 commit 20549e4

39 files changed

+778
-363
lines changed

.github/auto_request_review.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ files:
1010
'zjit/src/cruby_bindings.inc.rs': []
1111
'doc/zjit*': [team:jit]
1212
'test/ruby/test_zjit*': [team:jit]
13+
'defs/jit.mk': [team:jit]
1314
options:
1415
ignore_draft: true
1516
# This currently doesn't work as intended. We want to skip reviews when only

.github/workflows/codeql-analysis.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ jobs:
5050
5151
env:
5252
enable_install_doc: no
53-
CODEQL_ACTION_CLEANUP_TRAP_CACHES: true
5453

5554
strategy:
5655
fail-fast: false
@@ -121,3 +120,9 @@ jobs:
121120
with:
122121
sarif_file: sarif-results/${{ matrix.language }}.sarif
123122
continue-on-error: true
123+
124+
- name: Purge the oldest TRAP cache
125+
if: ${{ github.repository == 'ruby/ruby' && matrix.language == 'cpp'}}
126+
run: gh cache list --key codeql --order asc --limit 1 --json key --jq '.[].key' | xargs -I{} gh cache delete {}
127+
env:
128+
GH_TOKEN: ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}

.github/workflows/compilers.yml

+2
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ jobs:
299299
- { uses: './.github/actions/compilers', name: 'VM_DEBUG_BP_CHECK', with: { cppflags: '-DVM_DEBUG_BP_CHECK' } }
300300
- { uses: './.github/actions/compilers', name: 'VM_DEBUG_VERIFY_METHOD_CACHE', with: { cppflags: '-DVM_DEBUG_VERIFY_METHOD_CACHE' } }
301301
- { uses: './.github/actions/compilers', name: 'enable-yjit', with: { append_configure: '--enable-yjit' } }
302+
- { uses: './.github/actions/compilers', name: 'enable-{y,z}jit', with: { append_configure: '--enable-yjit --enable-zjit' } }
303+
- { uses: './.github/actions/compilers', name: 'enable-{y,z}jit=dev', with: { append_configure: '--enable-yjit=dev --enable-zjit' } }
302304
- { uses: './.github/actions/compilers', name: 'YJIT_FORCE_ENABLE', with: { cppflags: '-DYJIT_FORCE_ENABLE' } }
303305
- { uses: './.github/actions/compilers', name: 'UNIVERSAL_PARSER', with: { cppflags: '-DUNIVERSAL_PARSER' } }
304306

.github/workflows/zjit-macos.yml

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ jobs:
3535
- test_task: 'zjit-test'
3636
configure: '--enable-zjit=dev'
3737

38+
- test_task: 'ruby' # build test for combo build
39+
configure: '--enable-yjit --enable-zjit'
40+
41+
- test_task: 'ruby' # build test for combo build
42+
configure: '--enable-yjit --enable-zjit=dev'
43+
3844
- test_task: 'test-all'
3945
configure: '--enable-zjit=dev'
4046
tests: '../src/test/ruby/test_zjit.rb'

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ lcov*.info
246246
/yjit-bench
247247
/yjit_exit_locations.dump
248248

249+
# Rust
250+
/target
251+
249252
# /wasm/
250253
/wasm/tests/*.wasm
251254

Cargo.lock

+89
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Using Cargo's workspace feature to build all the Rust code in
2+
# into a single package.
3+
# TODO(alan) notes about rust version requirements. Undecided yet.
4+
5+
[workspace]
6+
members = ["zjit", "yjit"]
7+
8+
[package]
9+
name = "jit"
10+
version = "0.0.0"
11+
edition = "2024"
12+
rust-version = "1.85.0"
13+
publish = false # Don't publish to crates.io
14+
15+
[dependencies]
16+
yjit = { path = "yjit", optional = true }
17+
zjit = { path = "zjit", optional = true }
18+
19+
[lib]
20+
crate-type = ["staticlib"]
21+
path = "jit.rs"
22+
23+
[features]
24+
disasm = []
25+
runtime_checks = []
26+
yjit = [ "dep:yjit" ]
27+
zjit = [ "dep:zjit" ]
28+
29+
[profile.dev]
30+
opt-level = 0
31+
debug = true
32+
debug-assertions = true
33+
overflow-checks = true
34+
35+
[profile.dev_nodebug]
36+
inherits = "dev"
37+
38+
[profile.stats]
39+
inherits = "release"
40+
41+
[profile.release]
42+
# NOTE: --enable-yjit and zjit builds use `rustc` without going through Cargo. You
43+
# might want to update the `rustc` invocation if you change this profile.
44+
opt-level = 3
45+
# The extra robustness that comes from checking for arithmetic overflow is
46+
# worth the performance cost for the compiler.
47+
overflow-checks = true
48+
# Generate debug info
49+
debug = true
50+
# Use ThinLTO. Much smaller output for a small amount of build time increase.
51+
lto = "thin"

class.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,9 @@ rb_class_update_superclasses(VALUE klass)
827827
superclasses = class_superclasses_including_self(super);
828828
RCLASS_WRITE_SUPERCLASSES(super, super_depth, superclasses, true, true);
829829
}
830-
RCLASS_WRITE_SUPERCLASSES(klass, super_depth + 1, superclasses, false, false);
830+
831+
size_t depth = super_depth == RCLASS_MAX_SUPERCLASS_DEPTH ? super_depth : super_depth + 1;
832+
RCLASS_WRITE_SUPERCLASSES(klass, depth, superclasses, false, false);
831833
}
832834

833835
void

common.mk

+6-7
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,9 @@ COMMONOBJS = array.$(OBJEXT) \
187187
weakmap.$(OBJEXT) \
188188
$(PRISM_FILES) \
189189
$(YJIT_OBJ) \
190-
$(YJIT_LIBOBJ) \
191190
$(ZJIT_OBJ) \
192-
$(ZJIT_LIBOBJ) \
193191
$(JIT_OBJ) \
192+
$(RUST_LIBOBJ) \
194193
$(COROUTINE_OBJ) \
195194
$(DTRACE_OBJ) \
196195
$(BUILTIN_ENCOBJS) \
@@ -346,7 +345,7 @@ YJIT_RUSTC_ARGS = --crate-name=yjit \
346345
-C opt-level=3 \
347346
-C overflow-checks=on \
348347
'--out-dir=$(CARGO_TARGET_DIR)/release/' \
349-
$(top_srcdir)/yjit/src/lib.rs
348+
'$(top_srcdir)/yjit/src/lib.rs'
350349

351350
ZJIT_RUSTC_ARGS = --crate-name=zjit \
352351
--crate-type=staticlib \
@@ -355,8 +354,8 @@ ZJIT_RUSTC_ARGS = --crate-name=zjit \
355354
-C lto=thin \
356355
-C opt-level=3 \
357356
-C overflow-checks=on \
358-
'--out-dir=$(ZJIT_CARGO_TARGET_DIR)/release/' \
359-
$(top_srcdir)/zjit/src/lib.rs
357+
'--out-dir=$(CARGO_TARGET_DIR)/release/' \
358+
'$(top_srcdir)/zjit/src/lib.rs'
360359

361360
all: $(SHOWFLAGS) main
362361

@@ -736,8 +735,8 @@ clean-local:: clean-runnable
736735
$(Q)$(RM) probes.h probes.$(OBJEXT) probes.stamp ruby-glommed.$(OBJEXT) ruby.imp ChangeLog $(STATIC_RUBY)$(EXEEXT)
737736
$(Q)$(RM) GNUmakefile.old Makefile.old $(arch)-fake.rb bisect.sh $(ENC_TRANS_D) builtin_binary.inc
738737
$(Q)$(RM) $(PRISM_BUILD_DIR)/.time $(PRISM_BUILD_DIR)/*/.time yjit_exit_locations.dump
739-
-$(Q)$(RMALL) yjit/target
740-
-$(Q) $(RMDIR) enc/jis enc/trans enc $(COROUTINE_H:/Context.h=) coroutine yjit \
738+
-$(Q)$(RMALL) target
739+
-$(Q) $(RMDIR) enc/jis enc/trans enc $(COROUTINE_H:/Context.h=) coroutine target \
741740
$(PRISM_BUILD_DIR)/*/ $(PRISM_BUILD_DIR) tmp \
742741
2> $(NULL) || $(NULLCMD)
743742

0 commit comments

Comments
 (0)