diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-03-01 09:15:36 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-01 12:15:36 -0500 |
commit | 5e607cfa4ca580f0f4f96cd454a3d01e5d9cee9d (patch) | |
tree | e9a8211b6b6a688031ff9ce2ace5cac7f404979c /yjit/src/codegen.rs | |
parent | 0d415a322f5dd7158efcbc6c3226266e312620c7 (diff) | |
download | ruby-5e607cfa4ca580f0f4f96cd454a3d01e5d9cee9d.tar.gz |
YJIT: Use a boxed slice for outgoing branches and cme dependencies (#7409)
YJIT: Use a boxed slice for outgoing branches
and cme dependencies
Diffstat (limited to 'yjit/src/codegen.rs')
-rw-r--r-- | yjit/src/codegen.rs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index 51eb4a244d..d659e87374 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -66,6 +66,12 @@ pub struct JITState { // Whether we need to record the code address at // the end of this bytecode instruction for global invalidation record_boundary_patch_point: bool, + + // The block's outgoing branches + outgoing: Vec<BranchRef>, + + // The block's CME dependencies + cme_dependencies: Vec<CmePtr>, } impl JITState { @@ -79,6 +85,8 @@ impl JITState { side_exit_for_pc: None, ec: None, record_boundary_patch_point: false, + outgoing: Vec::new(), + cme_dependencies: Vec::new(), } } @@ -166,6 +174,16 @@ impl JITState { *ep.offset(VM_ENV_DATA_INDEX_SPECVAL as isize) } } + + // Push an outgoing branch ref + pub fn push_outgoing(&mut self, branch: BranchRef) { + self.outgoing.push(branch); + } + + // Push a CME dependency + pub fn push_cme_dependency(&mut self, cme: CmePtr) { + self.cme_dependencies.push(cme); + } } use crate::codegen::JCCKinds::*; @@ -833,6 +851,12 @@ pub fn gen_single_block( // Add the GC offsets to the block block.set_gc_obj_offsets(gc_offsets); + // Set CME dependencies to the block + block.set_cme_dependencies(jit.cme_dependencies); + + // Set outgoing branches to the block + block.set_outgoing(jit.outgoing); + // Mark the end position of the block block.set_end_addr(cb.get_write_ptr()); @@ -1806,7 +1830,7 @@ fn gen_checkkeyword( // When depth_limit is exceeded, generate a jump to a side exit. fn jit_chain_guard( jcc: JCCKinds, - jit: &JITState, + jit: &mut JITState, ctx: &Context, asm: &mut Assembler, ocb: &mut OutlinedCb, |