Skip to content

Commit

Permalink
YJIT: Derive Debug for Branch
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Feb 28, 2023
1 parent 2f92456 commit 6b9dda5
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions yjit/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ pub enum BranchShape {
Default, // Neither target is next
}

#[derive(Clone, Copy, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum BranchGenFn {
Branchif(BranchShape),
Branchnil(BranchShape),
Expand Down Expand Up @@ -558,6 +558,7 @@ struct BranchStub {

/// Store info about an outgoing branch in a code segment
/// Note: care must be taken to minimize the size of branch objects
#[derive(Debug)]
struct Branch {
// Block this is attached to
block: BlockRef,
Expand All @@ -573,19 +574,6 @@ struct Branch {
gen_fn: BranchGenFn,
}

impl std::fmt::Debug for Branch {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// TODO: expand this if needed. #[derive(Debug)] on Branch gave a
// strange error related to BranchGenFn
formatter
.debug_struct("Branch")
.field("start", &self.start_addr)
.field("end", &self.end_addr)
.field("targets", &self.targets)
.finish()
}
}

impl Branch {
// Compute the size of the branch code
fn code_size(&self) -> usize {
Expand Down

0 comments on commit 6b9dda5

Please sign in to comment.