Skip to content

Commit 4ec235e

Browse files
authored
ZJIT: Replace non-ASCII chars in comments with ASCII equivalents (ruby#16975)
1 parent a8bcae0 commit 4ec235e

7 files changed

Lines changed: 44 additions & 44 deletions

File tree

zjit/src/backend/arm64/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ impl Assembler {
685685
// Convert MemBase::Stack to MemBase::Reg(NATIVE_BASE_PTR) with the
686686
// correct stack displacement. The stack slot value lives directly at
687687
// [NATIVE_BASE_PTR + stack_disp], so we just adjust the base and
688-
// combine displacements no indirection needed. Large
688+
// combine displacements -- no indirection needed. Large
689689
// displacements are handled by split_stack_membase().
690690
let Mem { base, disp: stack_disp, .. } = stack_state.stack_membase_to_mem(stack_membase);
691691
Opnd::Mem(Mem { base, disp: stack_disp + opnd_disp, num_bits: opnd_num_bits })

zjit/src/backend/lir.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,7 +2458,7 @@ impl Assembler
24582458

24592459
if survivors.is_empty() {
24602460
if call_result_live {
2461-
// No survivors to restore move result directly to output.
2461+
// No survivors to restore -- move result directly to output.
24622462
let out = Self::rewritten_opnd(out, assignments);
24632463
new_insns.push(Insn::Mov { dest: out, src: C_RET_OPND });
24642464
new_ids.push(None);
@@ -3257,7 +3257,7 @@ impl fmt::Display for Assembler {
32573257
}
32583258

32593259
// Use sorted_blocks() instead of block_order() because block_order()
3260-
// calls rpo() edges() which requires all blocks end with terminators.
3260+
// calls rpo() -> edges() which requires all blocks end with terminators.
32613261
// After arm64_scratch_split, blocks may not have terminators.
32623262
for bb in self.sorted_blocks() {
32633263
let params = &bb.parameters;
@@ -4323,7 +4323,7 @@ mod tests {
43234323
asm.number_instructions(16);
43244324
let intervals = asm.build_intervals(live_in);
43254325

4326-
// 3 registers only r10 needs to spill
4326+
// 3 registers -- only r10 needs to spill
43274327
let preferred_registers = asm.preferred_register_assignments(&intervals);
43284328
let (assignments, num_stack_slots) = asm.linear_scan(intervals, 3, &preferred_registers);
43294329

@@ -4351,7 +4351,7 @@ mod tests {
43514351
asm.number_instructions(16);
43524352
let intervals = asm.build_intervals(live_in);
43534353

4354-
// Only 1 register available forces spills
4354+
// Only 1 register available -- forces spills
43554355
let preferred_registers = asm.preferred_register_assignments(&intervals);
43564356
let (assignments, num_stack_slots) = asm.linear_scan(intervals, 1, &preferred_registers);
43574357

@@ -4431,9 +4431,9 @@ mod tests {
44314431
use crate::backend::current::ALLOC_REGS;
44324432
let regs = &ALLOC_REGS[..5];
44334433

4434-
// Edge b1b2 (single succ): args=[UImm(1), v1], params=[v2, v3]
4435-
// v1Reg(1), v2Reg(1), v3Reg(2)
4436-
// Reg copy: Reg(1)Reg(2) Mov(regs[2], regs[1])
4434+
// Edge b1->b2 (single succ): args=[UImm(1), v1], params=[v2, v3]
4435+
// v1->Reg(1), v2->Reg(1), v3->Reg(2)
4436+
// Reg copy: Reg(1)->Reg(2) -> Mov(regs[2], regs[1])
44374437
// Imm move: Mov(regs[1], UImm(1))
44384438
// Inserted in b1 before Jmp: [Label, Mov, Mov, Jmp]
44394439
let b1_insns = &asm.basic_blocks[b1.0].insns;
@@ -4443,10 +4443,10 @@ mod tests {
44434443
assert!(matches!(&b1_insns[2], Insn::Mov { dest, src }
44444444
if *dest == Opnd::Reg(regs[1]) && *src == Opnd::UImm(1)));
44454445

4446-
// Edge b3b2 (single succ): args=[v4, v5], params=[v2, v3]
4447-
// v4Reg(3), v5Reg(2), v2Reg(1), v3Reg(2)
4448-
// Reg copy: Reg(3)Reg(1) Mov(regs[1], regs[3])
4449-
// Reg(2)Reg(2) is self-move, filtered
4446+
// Edge b3->b2 (single succ): args=[v4, v5], params=[v2, v3]
4447+
// v4->Reg(3), v5->Reg(2), v2->Reg(1), v3->Reg(2)
4448+
// Reg copy: Reg(3)->Reg(1) -> Mov(regs[1], regs[3])
4449+
// Reg(2)->Reg(2) is self-move, filtered
44504450
// Inserted in b3 before Jmp: [Label, Mul, Sub, Mov, Jmp]
44514451
let b3_insns = &asm.basic_blocks[b3.0].insns;
44524452
assert_eq!(b3_insns.len(), 5);
@@ -4455,7 +4455,7 @@ mod tests {
44554455

44564456
// Verify original instructions in b3 are rewritten to physical registers.
44574457
// b3: Mul { left: r12, right: r13, out: r14 }, Sub { left: r13, right: UImm(1), out: r15 }
4458-
// r12Reg(1), r13Reg(2), r14Reg(3), r15Reg(2)
4458+
// r12->Reg(1), r13->Reg(2), r14->Reg(3), r15->Reg(2)
44594459
assert!(matches!(&b3_insns[1], Insn::Mul { left, right, out }
44604460
if *left == Opnd::Reg(regs[1]) && *right == Opnd::Reg(regs[2]) && *out == Opnd::Reg(regs[3])));
44614461
assert!(matches!(&b3_insns[2], Insn::Sub { left, right, out }
@@ -4473,16 +4473,16 @@ mod tests {
44734473
let (assignments, _) = asm.linear_scan(intervals.clone(), 5, &preferred_registers);
44744474

44754475
// Entry block b1 has parameters [v0, v1].
4476-
// With 5 registers: v0 Reg(0) = regs[0], arrival = param_opnd(0) = regs[0] self-move, filtered
4477-
// v1 Reg(1) = regs[1], arrival = param_opnd(1) = regs[1] self-move, filtered
4476+
// With 5 registers: v0 -> Reg(0) = regs[0], arrival = param_opnd(0) = regs[0] -> self-move, filtered
4477+
// v1 -> Reg(1) = regs[1], arrival = param_opnd(1) = regs[1] -> self-move, filtered
44784478
// Before resolve_ssa, b1 has: [Label, Jmp] = 2 insns
44794479
assert_eq!(asm.basic_blocks[b1.0].insns.len(), 2);
44804480

44814481
asm.resolve_ssa(&intervals, &assignments);
44824482

44834483
// After resolve_ssa, b1 should still have the same number of insns
44844484
// (plus any edge moves, but no entry param moves since they're all self-moves).
4485-
// Edge b1b2 inserts 2 moves before Jmp: [Label, Mov, Mov, Jmp] = 4 insns
4485+
// Edge b1->b2 inserts 2 moves before Jmp: [Label, Mov, Mov, Jmp] = 4 insns
44864486
// No additional entry param moves.
44874487
let b1_insns = &asm.basic_blocks[b1.0].insns;
44884488
assert_eq!(b1_insns.len(), 4);
@@ -4508,8 +4508,8 @@ mod tests {
45084508
let b3 = asm.new_block(hir::BlockId(2), false, 2);
45094509

45104510
// b1: v0 = Add(123, 0), v1 = Add(v0, 456), Cmp(v1, 0), Jl(b2, [v0]), Jmp(b3, [v1])
4511-
// v0 is live across b1b2 edge AND v1 is live across b1b3 edge
4512-
// This forces v0 and v1 to have overlapping live ranges different registers
4511+
// v0 is live across b1->b2 edge AND v1 is live across b1->b3 edge
4512+
// This forces v0 and v1 to have overlapping live ranges -> different registers
45134513
asm.set_current_block(b1);
45144514
let label_b1 = asm.new_label("bb0");
45154515
asm.write_label(label_b1);
@@ -4562,8 +4562,8 @@ mod tests {
45624562

45634563
asm.resolve_ssa(&intervals, &assignments);
45644564

4565-
// A new interstitial block should have been created for the critical edge b1b3
4566-
// b1b3 is critical because b1 has 2 successors and b3 has 2 predecessors
4565+
// A new interstitial block should have been created for the critical edge b1->b3
4566+
// b1->b3 is critical because b1 has 2 successors and b3 has 2 predecessors
45674567
assert_eq!(asm.basic_blocks.len(), 4);
45684568
let split_block_id = BlockId(3);
45694569

@@ -4587,11 +4587,11 @@ mod tests {
45874587
panic!("Expected Jmp(b3) at end of split block");
45884588
}
45894589

4590-
// The split block should have a Mov for v1v4
4590+
// The split block should have a Mov for v1->v4
45914591
let has_mov = split_insns.iter().any(|insn| matches!(insn, Insn::Mov { .. }));
4592-
assert!(has_mov, "Expected Mov in split block for v1v4");
4592+
assert!(has_mov, "Expected Mov in split block for v1->v4");
45934593

4594-
// b2b3 is not a critical edge (b2 has single succ), so moves go before Jmp in b2
4594+
// b2->b3 is not a critical edge (b2 has single succ), so moves go before Jmp in b2
45954595
let v3_alloc = assignments[v3.vreg_idx().0].unwrap();
45964596
let b2_insns = &asm.basic_blocks[b2.0].insns;
45974597
if v3_alloc != v4_alloc {

zjit/src/backend/x86_64/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const SCRATCH1_OPND: Opnd = Opnd::Reg(R10_REG);
112112
pub const SCRATCH_REG: Reg = R11_REG;
113113

114114
impl Assembler {
115-
// This keeps frame growth below the ±4096-byte displacement range we rely
115+
// This keeps frame growth below the +/-4096-byte displacement range we rely
116116
// on for common stack-slot accesses on x86_64.
117117
const MAX_FRAME_STACK_SLOTS: usize = 2048;
118118

@@ -142,7 +142,7 @@ impl Assembler {
142142
}
143143

144144
// These are the callee-saved registers in the x86-64 SysV ABI
145-
// RBX, RSP, RBP, and R12R15
145+
// RBX, RSP, RBP, and R12-R15
146146

147147
/// Split IR instructions for the x86 platform
148148
fn x86_split(mut self) -> Assembler
@@ -357,7 +357,7 @@ impl Assembler {
357357
// Convert MemBase::Stack to MemBase::Reg(NATIVE_BASE_PTR) with the
358358
// correct stack displacement. The stack slot value lives directly at
359359
// [NATIVE_BASE_PTR + stack_disp], so we just adjust the base and
360-
// combine displacements no indirection needed.
360+
// combine displacements -- no indirection needed.
361361
let Mem { base, disp: stack_disp, .. } = stack_state.stack_membase_to_mem(stack_membase);
362362
Opnd::Mem(Mem { base, disp: stack_disp + opnd_disp, num_bits: opnd_num_bits })
363363
}

zjit/src/codegen.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ fn gen_iseq(cb: &mut CodeBlock, iseq: IseqPtr, function: Option<&Function>) -> R
314314
}
315315

316316
// Compile the ISEQ. When function is None, this is a lazy compile
317-
// from a stub hit wrap in a trace event covering the full compile.
317+
// from a stub hit -- wrap in a trace event covering the full compile.
318318
let mut version = IseqVersion::new(iseq);
319319
let code_ptrs = if function.is_none() {
320320
trace_compile_phase(&iseq_get_location(iseq, 0), || gen_iseq_body(cb, iseq, version, function))
@@ -387,15 +387,15 @@ fn gen_function(cb: &mut CodeBlock, iseq: IseqPtr, version: IseqVersionRef, func
387387

388388
// Create all LIR basic blocks corresponding to HIR basic blocks
389389
for (rpo_idx, &block_id) in reverse_post_order.iter().enumerate() {
390-
// Skip the entries superblock it's an internal CFG artifact
390+
// Skip the entries superblock -- it's an internal CFG artifact
391391
if block_id == function.entries_block { continue; }
392392
let lir_block_id = asm.new_block(block_id, function.is_entry_block(block_id), rpo_idx);
393393
hir_to_lir[block_id.0] = Some(lir_block_id);
394394
}
395395

396396
// Compile each basic block
397397
for &block_id in reverse_post_order.iter() {
398-
// Skip the entries superblock it's an internal CFG artifact
398+
// Skip the entries superblock -- it's an internal CFG artifact
399399
if block_id == function.entries_block { continue; }
400400
// Set the current block to the LIR block that corresponds to this
401401
// HIR block.
@@ -2069,22 +2069,22 @@ fn gen_is_a(jit: &mut JITState, asm: &mut Assembler, obj: Opnd, class: Opnd) ->
20692069

20702070
let val = asm.load_mem(obj);
20712071

2072-
// Immediate definitely not String/Array/Hash
2072+
// Immediate -> definitely not String/Array/Hash
20732073
asm.test(val, Opnd::UImm(RUBY_IMMEDIATE_MASK as u64));
20742074
asm.jnz(jit, result_edge(Qfalse.into()));
20752075

2076-
// Qfalse definitely not String/Array/Hash
2076+
// Qfalse -> definitely not String/Array/Hash
20772077
asm.cmp(val, Qfalse.into());
20782078
asm.je(jit, result_edge(Qfalse.into()));
20792079

2080-
// Heap object check builtin type
2080+
// Heap object -> check builtin type
20812081
let flags = asm.load(Opnd::mem(VALUE_BITS, val, RUBY_OFFSET_RBASIC_FLAGS));
20822082
let obj_builtin_type = asm.and(flags, Opnd::UImm(RUBY_T_MASK as u64));
20832083
asm.cmp(obj_builtin_type, Opnd::UImm(builtin_type as u64));
20842084
let result = asm.csel_e(Qtrue.into(), Qfalse.into());
20852085
asm.jmp(result_edge(result));
20862086

2087-
// Result block receives the value via block parameter (phi node)
2087+
// Result block -- receives the value via block parameter (phi node)
20882088
asm.set_current_block(result_block);
20892089
let label = jit.get_label(asm, result_block, hir_block_id);
20902090
asm.write_label(label);
@@ -2458,21 +2458,21 @@ fn gen_has_type(jit: &mut JITState, asm: &mut Assembler, val: lir::Opnd, ty: Typ
24582458
// TODO: Max thinks codegen should not care about the shapes of the operands except to create them. (Shopify/ruby#685)
24592459
let val = asm.load_mem(val);
24602460

2461-
// Immediate definitely not the class
2461+
// Immediate -> definitely not the class
24622462
asm.test(val, (RUBY_IMMEDIATE_MASK as u64).into());
24632463
asm.jnz(jit, result_edge(Opnd::Imm(0)));
24642464

2465-
// Qfalse definitely not the class
2465+
// Qfalse -> definitely not the class
24662466
asm.cmp(val, Qfalse.into());
24672467
asm.je(jit, result_edge(Opnd::Imm(0)));
24682468

2469-
// Heap object check klass field
2469+
// Heap object -> check klass field
24702470
let klass = asm.load(Opnd::mem(64, val, RUBY_OFFSET_RBASIC_KLASS));
24712471
asm.cmp(klass, Opnd::Value(expected_class));
24722472
let result = asm.csel_e(Opnd::UImm(1), Opnd::Imm(0));
24732473
asm.jmp(result_edge(result));
24742474

2475-
// Result block receives the value via block parameter (phi node)
2475+
// Result block -- receives the value via block parameter (phi node)
24762476
asm.set_current_block(result_block);
24772477
let label = jit.get_label(asm, result_block, hir_block_id);
24782478
asm.write_label(label);

zjit/src/hir.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6233,7 +6233,7 @@ impl<'a> std::fmt::Display for FunctionPrinter<'a> {
62336233
writeln!(f, "fn {iseq_name}:")?;
62346234
for block_id in fun.rpo() {
62356235
if !self.display_snapshot_and_tp_patchpoints && block_id == fun.entries_block {
6236-
// Unless we're doing --zjit-dump-hir=all, skip the entries superblock it's an
6236+
// Unless we're doing --zjit-dump-hir=all, skip the entries superblock -- it's an
62376237
// internal CFG artifact
62386238
continue;
62396239
}
@@ -7041,7 +7041,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
70417041
// gen_is_block_given) to check for a block handler. Precompute the lexical
70427042
// distance from this iseq up to local_iseq so codegen does not have to
70437043
// walk the parent chain. Any DEFINED_YIELD reaching this branch has a
7044-
// method local_iseq by construction the above branch has already
7044+
// method local_iseq by construction -- the above branch has already
70457045
// diverted the non-method case to Qnil.
70467046
let lep_level = if op_type == DEFINED_YIELD as usize {
70477047
get_lvar_level(iseq)
@@ -8606,7 +8606,7 @@ impl Dominators {
86068606
let rpo = f.rpo();
86078607
let num_blocks = f.blocks.len();
86088608

8609-
// Map BlockId RPO index for O(1) lookup in intersect.
8609+
// Map BlockId -> RPO index for O(1) lookup in intersect.
86108610
let mut rpo_order = vec![usize::MAX; num_blocks];
86118611
for (idx, &block) in rpo.iter().enumerate() {
86128612
rpo_order[block.0] = idx;

zjit/src/hir/opt_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15683,7 +15683,7 @@ mod hir_opt_tests {
1568315683

1568415684
#[test]
1568515685
fn test_recompile_no_profile_send() {
15686-
// Test the SideExit recompile flow: a no-profile send becomes a SideExit,
15686+
// Test the SideExit -> recompile flow: a no-profile send becomes a SideExit,
1568715687
// the exit profiles the send, triggers recompilation, and the new version
1568815688
// optimizes it to SendDirect.
1568915689
eval("

zjit/src/virtualmem.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ impl VirtualMem {
113113

114114
// Memory protection syscalls need page-aligned addresses, so check it here. Assuming
115115
// `virt_block` is page-aligned, `second_half` should be page-aligned as long as the
116-
// page size in bytes is a power of two 2¹⁹ or smaller. This is because the user
117-
// requested size is half of mem_option × 2²⁰ as it's in MiB.
116+
// page size in bytes is a power of two 2^19 or smaller. This is because the user
117+
// requested size is half of mem_option * 2^20 as it's in MiB.
118118
//
119119
// Basically, we don't support x86-64 2MiB and 1GiB pages. ARMv8 can do up to 64KiB
120-
// (2¹⁶ bytes) pages, which should be fine. 4KiB pages seem to be the most popular though.
120+
// (2^16 bytes) pages, which should be fine. 4KiB pages seem to be the most popular though.
121121
let page_size = unsafe { rb_jit_get_page_size() };
122122
assert_eq!(
123123
virt_block as usize % page_size as usize, 0,

0 commit comments

Comments
 (0)