diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2022-11-16 15:48:46 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-16 15:48:46 -0800 |
commit | 3259aceb3514892450664828b39a78cc95a412fa (patch) | |
tree | b7f3c9f8a639deb14c9e3ac2bedae152feb3d94d /yjit | |
parent | 1b8236acc212a6751da7248eb3f22b0262ca0623 (diff) |
YJIT: Pack BlockId and CodePtr (#6748)
Notes
Notes:
Merged-By: k0kubun <takashikkbn@gmail.com>
Diffstat (limited to 'yjit')
-rw-r--r-- | yjit/src/codegen.rs | 3 | ||||
-rw-r--r-- | yjit/src/core.rs | 7 | ||||
-rw-r--r-- | yjit/src/disasm.rs | 3 | ||||
-rw-r--r-- | yjit/src/virtualmem.rs | 2 |
4 files changed, 10 insertions, 5 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index 9551ece3c9..0c51f589db 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -721,7 +721,8 @@ pub fn gen_single_block( #[cfg(feature = "disasm")] if get_option_ref!(dump_disasm).is_some() { - asm.comment(&format!("Block: {} (ISEQ offset: {})", iseq_get_location(blockid.iseq), blockid.idx)); + let blockid_idx = blockid.idx; + asm.comment(&format!("Block: {} (ISEQ offset: {})", iseq_get_location(blockid.iseq), blockid_idx)); } // For each instruction to compile diff --git a/yjit/src/core.rs b/yjit/src/core.rs index f2bde4a010..ad74067ea0 100644 --- a/yjit/src/core.rs +++ b/yjit/src/core.rs @@ -304,6 +304,7 @@ pub struct Context { /// Tuple of (iseq, idx) used to identify basic blocks /// There are a lot of blockid objects so we try to keep the size small. #[derive(Copy, Clone, PartialEq, Eq, Debug)] +#[repr(packed)] pub struct BlockId { /// Instruction sequence pub iseq: IseqPtr, @@ -1526,7 +1527,8 @@ fn gen_block_series_body( let iseq_location = iseq_get_location(blockid.iseq); if iseq_location.contains(substr) { let last_block = last_blockref.borrow(); - println!("Compiling {} block(s) for {}, ISEQ offsets [{}, {})", batch.len(), iseq_location, blockid.idx, last_block.end_idx); + let blockid_idx = blockid.idx; + println!("Compiling {} block(s) for {}, ISEQ offsets [{}, {})", batch.len(), iseq_location, blockid_idx, last_block.end_idx); print!("{}", disasm_iseq_insn_range(blockid.iseq, blockid.idx, last_block.end_idx)); } } @@ -2148,7 +2150,8 @@ pub fn invalidate_block_version(blockref: &BlockRef) { if let Some(substr) = get_option_ref!(dump_iseq_disasm).as_ref() { let iseq_location = iseq_get_location(block.blockid.iseq); if iseq_location.contains(substr) { - println!("Invalidating block from {}, ISEQ offsets [{}, {})", iseq_location, block.blockid.idx, block.end_idx); + let blockid_idx = block.blockid.idx; + println!("Invalidating block from {}, ISEQ offsets [{}, {})", iseq_location, blockid_idx, block.end_idx); } } } diff --git a/yjit/src/disasm.rs b/yjit/src/disasm.rs index e958f3bfce..bab0133c4d 100644 --- a/yjit/src/disasm.rs +++ b/yjit/src/disasm.rs @@ -90,11 +90,12 @@ pub fn disasm_iseq_insn_range(iseq: IseqPtr, start_idx: u32, end_idx: u32) -> St let code_size = block.code_size(); // Write some info about the current block + let blockid_idx = blockid.idx; let block_ident = format!( "BLOCK {}/{}, ISEQ RANGE [{},{}), {} bytes ", block_idx + 1, block_list.len(), - blockid.idx, + blockid_idx, end_idx, code_size ); diff --git a/yjit/src/virtualmem.rs b/yjit/src/virtualmem.rs index 1d80983c9e..668e3d6a7b 100644 --- a/yjit/src/virtualmem.rs +++ b/yjit/src/virtualmem.rs @@ -59,7 +59,7 @@ pub trait Allocator { /// We may later change this to wrap an u32. /// Note: there is no NULL constant for CodePtr. You should use Option<CodePtr> instead. #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Debug)] -#[repr(C)] +#[repr(C, packed)] pub struct CodePtr(*const u8); /// Errors that can happen when writing to [VirtualMemory] |