Skip to content

Commit b675d34

Browse files
committed
WIP
1 parent 7b17e30 commit b675d34

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

src/jit/assembler/block_asm.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -247,35 +247,27 @@ impl<'a> BlockAsm<'a> {
247247
}
248248

249249
pub fn load_u8(&mut self, op0: impl Into<BlockReg>, op1: impl Into<BlockReg>, op2: impl Into<BlockOperandShift>) {
250-
self.transfer_read(op0, op1, op2, false, MemoryAmount::Byte)
250+
self.transfer(BlockTransferOp::Read, op0, op1, op2, false, MemoryAmount::Byte)
251251
}
252252

253253
pub fn store_u8(&mut self, op0: impl Into<BlockReg>, op1: impl Into<BlockReg>, op2: impl Into<BlockOperandShift>) {
254-
self.transfer_write(op0, op1, op2, false, MemoryAmount::Byte)
254+
self.transfer(BlockTransferOp::Write, op0, op1, op2, false, MemoryAmount::Byte)
255255
}
256256

257257
pub fn load_u16(&mut self, op0: impl Into<BlockReg>, op1: impl Into<BlockReg>, op2: impl Into<BlockOperandShift>) {
258-
self.transfer_read(op0, op1, op2, false, MemoryAmount::Half)
258+
self.transfer(BlockTransferOp::Read, op0, op1, op2, false, MemoryAmount::Half)
259259
}
260260

261261
pub fn store_u16(&mut self, op0: impl Into<BlockReg>, op1: impl Into<BlockReg>, op2: impl Into<BlockOperandShift>) {
262-
self.transfer_write(op0, op1, op2, false, MemoryAmount::Half)
262+
self.transfer(BlockTransferOp::Write, op0, op1, op2, false, MemoryAmount::Half)
263263
}
264264

265265
pub fn load_u32(&mut self, op0: impl Into<BlockReg>, op1: impl Into<BlockReg>, op2: impl Into<BlockOperandShift>) {
266-
self.transfer_read(op0, op1, op2, false, MemoryAmount::Word)
266+
self.transfer(BlockTransferOp::Read, op0, op1, op2, false, MemoryAmount::Word)
267267
}
268268

269269
pub fn store_u32(&mut self, op0: impl Into<BlockReg>, op1: impl Into<BlockReg>, op2: impl Into<BlockOperandShift>) {
270-
self.transfer_write(op0, op1, op2, false, MemoryAmount::Word)
271-
}
272-
273-
pub fn transfer_read(&mut self, op0: impl Into<BlockReg>, op1: impl Into<BlockReg>, op2: impl Into<BlockOperandShift>, signed: bool, amount: MemoryAmount) {
274-
self.transfer(BlockTransferOp::Read, op0, op1, op2, signed, amount)
275-
}
276-
277-
pub fn transfer_write(&mut self, op0: impl Into<BlockReg>, op1: impl Into<BlockReg>, op2: impl Into<BlockOperandShift>, signed: bool, amount: MemoryAmount) {
278-
self.transfer(BlockTransferOp::Write, op0, op1, op2, signed, amount)
270+
self.transfer(BlockTransferOp::Write, op0, op1, op2, false, MemoryAmount::Word)
279271
}
280272

281273
fn transfer(&mut self, op: BlockTransferOp, op0: impl Into<BlockReg>, op1: impl Into<BlockReg>, op2: impl Into<BlockOperandShift>, signed: bool, amount: MemoryAmount) {

src/jit/emitter/emit_branch.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ impl<'a, const CPU: CpuType> JitAsm<'a, CPU> {
180180
block_asm.epilogue_previous_block();
181181

182182
block_asm.label(no_return_label);
183+
184+
if DEBUG_LOG {
185+
block_asm.call2(Self::debug_branch_lr_failed as *const (), asm.jit_buf.current_pc, aligned_target_pc_reg);
186+
}
187+
183188
block_asm.mov(return_stack_ptr_reg, 0);
184189
block_asm.store_u8(return_stack_ptr_reg, runtime_data_addr_reg, JitRuntimeData::get_return_stack_ptr_offset() as u32);
185190
asm.emit_call_jit_addr(block_asm, aligned_target_pc_reg);
@@ -351,4 +356,8 @@ impl<'a, const CPU: CpuType> JitAsm<'a, CPU> {
351356
extern "C" fn debug_branch_lr(current_pc: u32, target_pc: u32) {
352357
println!("{CPU:?} branch lr from {current_pc:x} to {target_pc:x}")
353358
}
359+
360+
extern "C" fn debug_branch_lr_failed(current_pc: u32, target_pc: u32) {
361+
println!("{CPU:?} failed to branch lr from {current_pc:x} to {target_pc:x}")
362+
}
354363
}

0 commit comments

Comments
 (0)