Browse Source
Merge pull request #1780 from fitzgen/serde-stack-maps
cranelift: Implement serialize/deserialize for stack maps
pull/1786/head
Nick Fitzgerald
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
1 deletions
-
cranelift/codegen/src/binemit/stackmap.rs
-
cranelift/codegen/src/bitset.rs
|
|
@ -15,7 +15,8 @@ const NUM_BITS: usize = core::mem::size_of::<Num>() * 8; |
|
|
|
/// The first value in the bitmap is of the lowest addressed slot on the stack.
|
|
|
|
/// As all stacks in Isa's supported by Cranelift grow down, this means that
|
|
|
|
/// first value is of the top of the stack and values proceed down the stack.
|
|
|
|
#[derive(Clone, Debug)] |
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)] |
|
|
|
#[cfg_attr(feature = "enable-serde", derive(serde::Deserialize, serde::Serialize))] |
|
|
|
pub struct Stackmap { |
|
|
|
bitmap: Vec<BitSet<Num>>, |
|
|
|
mapped_words: u32, |
|
|
|
|
|
@ -5,12 +5,14 @@ |
|
|
|
//!
|
|
|
|
//! If you would like to add support for larger bitsets in the future, you need to change the trait
|
|
|
|
//! bound Into<u32> and the u32 in the implementation of `max_bits()`.
|
|
|
|
|
|
|
|
use core::convert::{From, Into}; |
|
|
|
use core::mem::size_of; |
|
|
|
use core::ops::{Add, BitOr, Shl, Sub}; |
|
|
|
|
|
|
|
/// A small bitset built on a single primitive integer type
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)] |
|
|
|
#[cfg_attr(feature = "enable-serde", derive(serde::Serialize, serde::Deserialize))] |
|
|
|
pub struct BitSet<T>(pub T); |
|
|
|
|
|
|
|
impl<T> BitSet<T> |
|
|
|