Skip to content

Commit

Permalink
Refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
sisshiki1969 committed Jan 30, 2025
1 parent ba91477 commit 09452fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions monoruby/src/compiler/jitgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ impl Codegen {
self.gen_asm(ir, store, &mut ctx, None);
// generate machine code for bridges
if let Some(bbid) = bbid
&& let Some((ir, exit)) = ctx.continue_bridges.remove(&bbid)
&& let Some((ir, exit)) = ctx.inline_bridges.remove(&bbid)
{
self.gen_asm(ir, store, &mut ctx, None);
if let Some(exit) = exit {
Expand All @@ -716,7 +716,7 @@ impl Codegen {
}

// generate machine code for bridges
for (ir, entry, exit) in std::mem::take(&mut ctx.bridges) {
for (ir, entry, exit) in std::mem::take(&mut ctx.outline_bridges) {
let entry = ctx.resolve_label(&mut self.jit, entry);
self.gen_asm(ir, store, &mut ctx, Some((entry, exit)));
}
Expand Down
12 changes: 6 additions & 6 deletions monoruby/src/compiler/jitgen/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ pub struct JitContext {
///
/// Information for bridges.
///
pub(super) bridges: Vec<(AsmIr, JitLabel, BasicBlockId)>,
pub(super) outline_bridges: Vec<(AsmIr, JitLabel, BasicBlockId)>,
///
/// Information for continue bridges.
///
pub(super) continue_bridges: HashMap<BasicBlockId, (AsmIr, Option<BasicBlockId>)>,
pub(super) inline_bridges: HashMap<BasicBlockId, (AsmIr, Option<BasicBlockId>)>,
///
/// Information for `JitLabel`s`.
///
Expand Down Expand Up @@ -162,8 +162,8 @@ impl JitContext {
local_num,
self_class,
self_ty,
bridges: vec![],
continue_bridges: HashMap::default(),
outline_bridges: vec![],
inline_bridges: HashMap::default(),
labels,
class_version,
ir: vec![],
Expand Down Expand Up @@ -194,8 +194,8 @@ impl JitContext {
local_num,
self_class: NIL_CLASS,
self_ty: None,
bridges: vec![],
continue_bridges: HashMap::default(),
outline_bridges: vec![],
inline_bridges: HashMap::default(),
labels: vec![],
class_version: 0,
ir: vec![],
Expand Down
10 changes: 5 additions & 5 deletions monoruby/src/compiler/jitgen/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ impl JitContext {
}
bbctx.gen_bridge_for_target(&mut ir, &target_ctx, pc);
match cont {
BranchMode::Side { dest } => self.bridges.push((ir, dest, bbid)),
BranchMode::Side { dest } => self.outline_bridges.push((ir, dest, bbid)),
BranchMode::Branch { .. } => {
self.continue_bridges.insert(src_bb, (ir, Some(bbid)));
self.inline_bridges.insert(src_bb, (ir, Some(bbid)));
}
BranchMode::Continue => unreachable!(),
}
Expand Down Expand Up @@ -187,12 +187,12 @@ impl JitContext {
}
bbctx.gen_bridge_for_target(&mut ir, &target_ctx, pc);
match mode {
BranchMode::Side { dest } => self.bridges.push((ir, dest, bbid)),
BranchMode::Side { dest } => self.outline_bridges.push((ir, dest, bbid)),
BranchMode::Branch { .. } => {
self.continue_bridges.insert(src_bb, (ir, Some(bbid)));
self.inline_bridges.insert(src_bb, (ir, Some(bbid)));
}
BranchMode::Continue => {
self.continue_bridges.insert(src_bb, (ir, None));
self.inline_bridges.insert(src_bb, (ir, None));
}
}
//}
Expand Down

0 comments on commit 09452fb

Please sign in to comment.