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 a229491 commit de78026
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
1 change: 0 additions & 1 deletion monoruby/src/compiler/jitgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,6 @@ impl Codegen {
let entry = ctx.resolve_label(&mut self.jit, entry);
self.gen_asm(ir, store, &mut ctx, Some((entry, exit)));
}
assert!(ctx.continue_label.is_none());

self.jit.finalize();

Expand Down
6 changes: 0 additions & 6 deletions monoruby/src/compiler/jitgen/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ pub struct JitContext {
///
pub(super) continue_bridges: HashMap<BasicBlockId, (AsmIr, Option<BasicBlockId>)>,
///
/// Information for continuation bridge.
///
pub(super) continue_label: Option<JitLabel>,
///
/// Information for `JitLabel`s`.
///
labels: Vec<Option<DestLabel>>,
Expand Down Expand Up @@ -168,7 +164,6 @@ impl JitContext {
self_ty,
bridges: vec![],
continue_bridges: HashMap::default(),
continue_label: None,
labels,
class_version,
ir: vec![],
Expand Down Expand Up @@ -201,7 +196,6 @@ impl JitContext {
self_ty: None,
bridges: vec![],
continue_bridges: HashMap::default(),
continue_label: None,
labels: vec![],
class_version: 0,
ir: vec![],
Expand Down
9 changes: 3 additions & 6 deletions monoruby/src/compiler/jitgen/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,11 @@ impl JitContext {
} else {
#[cfg(feature = "jit-debug")]
eprintln!("\n===gen_merge bb: {:?}", bbid);
self.incoming_context_method(func, bbid)
self.incoming_context_method(ir, func, bbid)
};

#[cfg(feature = "jit-debug")]
eprintln!("===merge_end");
if let Some(entry) = std::mem::take(&mut self.continue_label) {
ir.push(AsmInst::Label(entry));
}
res
}

Expand Down Expand Up @@ -134,17 +131,17 @@ impl JitContext {

fn incoming_context_method(
&mut self,
ir: &mut AsmIr,
func: &ISeqInfo,
bbid: BasicBlockId,
) -> Option<BBContext> {
let mut entries = self.branch_map.remove(&bbid)?;

if entries.len() == 1 {
let entry = entries.remove(0);
assert!(self.continue_label.is_none());
match entry.mode {
BranchMode::Side { dest } | BranchMode::Branch { dest } => {
self.continue_label = Some(dest);
ir.push(AsmInst::Label(dest));
}
BranchMode::Continue => {}
}
Expand Down

0 comments on commit de78026

Please sign in to comment.