Rename "Stackmap" to "StackMap"
And "stackmap" to "stack_map". This commit is purely mechanical.
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
//! relocations to a `RelocSink` trait object. Relocations are less frequent than the
|
||||
//! `CodeSink::put*` methods, so the performance impact of the virtual callbacks is less severe.
|
||||
use super::{Addend, CodeInfo, CodeOffset, CodeSink, Reloc};
|
||||
use crate::binemit::stackmap::Stackmap;
|
||||
use crate::binemit::stack_map::StackMap;
|
||||
use crate::ir::entities::Value;
|
||||
use crate::ir::{ConstantOffset, ExternalName, Function, JumpTable, Opcode, SourceLoc, TrapCode};
|
||||
use crate::isa::TargetIsa;
|
||||
@@ -38,7 +38,7 @@ pub struct MemoryCodeSink<'a> {
|
||||
offset: isize,
|
||||
relocs: &'a mut dyn RelocSink,
|
||||
traps: &'a mut dyn TrapSink,
|
||||
stackmaps: &'a mut dyn StackmapSink,
|
||||
stack_maps: &'a mut dyn StackMapSink,
|
||||
/// Information about the generated code and read-only data.
|
||||
pub info: CodeInfo,
|
||||
}
|
||||
@@ -54,7 +54,7 @@ impl<'a> MemoryCodeSink<'a> {
|
||||
data: *mut u8,
|
||||
relocs: &'a mut dyn RelocSink,
|
||||
traps: &'a mut dyn TrapSink,
|
||||
stackmaps: &'a mut dyn StackmapSink,
|
||||
stack_maps: &'a mut dyn StackMapSink,
|
||||
) -> Self {
|
||||
Self {
|
||||
data,
|
||||
@@ -67,7 +67,7 @@ impl<'a> MemoryCodeSink<'a> {
|
||||
},
|
||||
relocs,
|
||||
traps,
|
||||
stackmaps,
|
||||
stack_maps,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,10 +182,10 @@ impl<'a> CodeSink for MemoryCodeSink<'a> {
|
||||
self.info.total_size = self.offset();
|
||||
}
|
||||
|
||||
fn add_stackmap(&mut self, val_list: &[Value], func: &Function, isa: &dyn TargetIsa) {
|
||||
fn add_stack_map(&mut self, val_list: &[Value], func: &Function, isa: &dyn TargetIsa) {
|
||||
let ofs = self.offset();
|
||||
let stackmap = Stackmap::from_values(&val_list, func, isa);
|
||||
self.stackmaps.add_stackmap(ofs, stackmap);
|
||||
let stack_map = StackMap::from_values(&val_list, func, isa);
|
||||
self.stack_maps.add_stack_map(ofs, stack_map);
|
||||
}
|
||||
|
||||
fn add_call_site(&mut self, opcode: Opcode, loc: SourceLoc) {
|
||||
@@ -227,15 +227,15 @@ impl TrapSink for NullTrapSink {
|
||||
fn trap(&mut self, _offset: CodeOffset, _srcloc: SourceLoc, _code: TrapCode) {}
|
||||
}
|
||||
|
||||
/// A trait for emitting stackmaps.
|
||||
pub trait StackmapSink {
|
||||
/// A trait for emitting stack maps.
|
||||
pub trait StackMapSink {
|
||||
/// Output a bitmap of the stack representing the live reference variables at this code offset.
|
||||
fn add_stackmap(&mut self, _: CodeOffset, _: Stackmap);
|
||||
fn add_stack_map(&mut self, _: CodeOffset, _: StackMap);
|
||||
}
|
||||
|
||||
/// Placeholder StackmapSink that does nothing.
|
||||
pub struct NullStackmapSink {}
|
||||
/// Placeholder StackMapSink that does nothing.
|
||||
pub struct NullStackMapSink {}
|
||||
|
||||
impl StackmapSink for NullStackmapSink {
|
||||
fn add_stackmap(&mut self, _: CodeOffset, _: Stackmap) {}
|
||||
impl StackMapSink for NullStackMapSink {
|
||||
fn add_stack_map(&mut self, _: CodeOffset, _: StackMap) {}
|
||||
}
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
mod memorysink;
|
||||
mod relaxation;
|
||||
mod shrink;
|
||||
mod stackmap;
|
||||
mod stack_map;
|
||||
|
||||
pub use self::memorysink::{
|
||||
MemoryCodeSink, NullRelocSink, NullStackmapSink, NullTrapSink, RelocSink, StackmapSink,
|
||||
MemoryCodeSink, NullRelocSink, NullStackMapSink, NullTrapSink, RelocSink, StackMapSink,
|
||||
TrapSink,
|
||||
};
|
||||
pub use self::relaxation::relax_branches;
|
||||
pub use self::shrink::shrink_instructions;
|
||||
pub use self::stackmap::Stackmap;
|
||||
pub use self::stack_map::StackMap;
|
||||
use crate::ir::entities::Value;
|
||||
use crate::ir::{
|
||||
ConstantOffset, ExternalName, Function, Inst, JumpTable, Opcode, SourceLoc, TrapCode,
|
||||
@@ -164,8 +164,8 @@ pub trait CodeSink {
|
||||
/// Read-only data output is complete, we're done.
|
||||
fn end_codegen(&mut self);
|
||||
|
||||
/// Add a stackmap at the current code offset.
|
||||
fn add_stackmap(&mut self, _: &[Value], _: &Function, _: &dyn TargetIsa);
|
||||
/// Add a stack map at the current code offset.
|
||||
fn add_stack_map(&mut self, _: &[Value], _: &Function, _: &dyn TargetIsa);
|
||||
|
||||
/// Add a call site for a call with the given opcode, returning at the current offset.
|
||||
fn add_call_site(&mut self, _: Opcode, _: SourceLoc) {
|
||||
|
||||
@@ -59,7 +59,7 @@ const NUM_BITS: usize = core::mem::size_of::<Num>() * 8;
|
||||
/// | ... |
|
||||
/// ```
|
||||
///
|
||||
/// An individual `Stackmap` is associated with just one instruction pointer
|
||||
/// An individual `StackMap` is associated with just one instruction pointer
|
||||
/// within the function, contains the size of the stack frame, and represents
|
||||
/// the stack frame as a bitmap. There is one bit per word in the stack frame,
|
||||
/// and if the bit is set, then the word contains a live GC reference.
|
||||
@@ -70,13 +70,14 @@ const NUM_BITS: usize = core::mem::size_of::<Num>() * 8;
|
||||
/// callee's stack map.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "enable-serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct Stackmap {
|
||||
pub struct StackMap {
|
||||
bitmap: Vec<BitSet<Num>>,
|
||||
mapped_words: u32,
|
||||
}
|
||||
|
||||
impl Stackmap {
|
||||
/// Create a stackmap based on where references are located on a function's stack.
|
||||
impl StackMap {
|
||||
/// Create a `StackMap` based on where references are located on a
|
||||
/// function's stack.
|
||||
pub fn from_values(
|
||||
args: &[ir::entities::Value],
|
||||
func: &ir::Function,
|
||||
@@ -101,7 +102,7 @@ impl Stackmap {
|
||||
let stack = &func.stack_slots;
|
||||
let info = func.stack_slots.layout_info.unwrap();
|
||||
|
||||
// Refer to the doc comment for `Stackmap` above to understand the
|
||||
// Refer to the doc comment for `StackMap` above to understand the
|
||||
// bitmap representation used here.
|
||||
let map_size = (info.frame_size + info.inbound_args_size) as usize;
|
||||
let word_size = isa.pointer_bytes() as usize;
|
||||
@@ -171,9 +172,9 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn stackmaps() {
|
||||
fn stack_maps() {
|
||||
let vec: Vec<bool> = Vec::new();
|
||||
assert!(Stackmap::from_slice(&vec).bitmap.is_empty());
|
||||
assert!(StackMap::from_slice(&vec).bitmap.is_empty());
|
||||
|
||||
let mut vec: [bool; NUM_BITS] = Default::default();
|
||||
let set_true_idx = [5, 7, 24, 31];
|
||||
@@ -185,12 +186,12 @@ mod tests {
|
||||
let mut vec = vec.to_vec();
|
||||
assert_eq!(
|
||||
vec![BitSet::<Num>(2164261024)],
|
||||
Stackmap::from_slice(&vec).bitmap
|
||||
StackMap::from_slice(&vec).bitmap
|
||||
);
|
||||
|
||||
vec.push(false);
|
||||
vec.push(true);
|
||||
let res = Stackmap::from_slice(&vec);
|
||||
let res = StackMap::from_slice(&vec);
|
||||
assert_eq!(
|
||||
vec![BitSet::<Num>(2164261024), BitSet::<Num>(2)],
|
||||
res.bitmap
|
||||
Reference in New Issue
Block a user