Skip to content

Commit 19cbf84

Browse files
authored
ZJIT: Enable IncrCounter for arm64 (#14086)
1 parent 3ad6bba commit 19cbf84

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

test/ruby/test_zjit.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,14 @@ def test_require_rubygems_with_auto_compact
10951095
}, call_threshold: 2
10961096
end
10971097

1098+
def test_stats
1099+
assert_runs 'true', %q{
1100+
def test = 1
1101+
test
1102+
RubyVM::ZJIT.stats[:zjit_insns_count] > 0
1103+
}, stats: true
1104+
end
1105+
10981106
def test_zjit_option_uses_array_each_in_ruby
10991107
omit 'ZJIT wrongly compiles Array#each, so it is disabled for now'
11001108
assert_runs '"<internal:array>"', %q{
@@ -1414,12 +1422,13 @@ def assert_runs(expected, test_script, insns: [], assert_compiles: false, **opts
14141422
end
14151423

14161424
# Run a Ruby process with ZJIT options and a pipe for writing test results
1417-
def eval_with_jit(script, call_threshold: 1, num_profiles: 1, timeout: 1000, pipe_fd:, debug: true)
1425+
def eval_with_jit(script, call_threshold: 1, num_profiles: 1, stats: false, debug: true, timeout: 1000, pipe_fd:)
14181426
args = [
14191427
"--disable-gems",
14201428
"--zjit-call-threshold=#{call_threshold}",
14211429
"--zjit-num-profiles=#{num_profiles}",
14221430
]
1431+
args << "--zjit-stats" if stats
14231432
args << "--zjit-debug" if debug
14241433
args << "-e" << script_shell_encode(script)
14251434
pipe_r, pipe_w = IO.pipe

zjit/src/backend/arm64/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,8 +1305,7 @@ impl Assembler
13051305
}
13061306
last_patch_pos = Some(cb.get_write_pos());
13071307
},
1308-
Insn::IncrCounter { mem: _, value: _ } => {
1309-
/*
1308+
Insn::IncrCounter { mem, value } => {
13101309
let label = cb.new_label("incr_counter_loop".to_string());
13111310
cb.write_label(label);
13121311

@@ -1322,8 +1321,6 @@ impl Assembler
13221321

13231322
cmp(cb, Self::SCRATCH1, A64Opnd::new_uimm(0));
13241323
emit_conditional_jump::<{Condition::NE}>(cb, Target::Label(label));
1325-
*/
1326-
unimplemented!("labels are not supported yet");
13271324
},
13281325
Insn::Breakpoint => {
13291326
brk(cb, A64Opnd::None);

0 commit comments

Comments
 (0)