Codegen: Align representation of stackmap with SpiderMonkey

This commit aligns the representation of stackmaps to be the same
as Spidermonkey's by:
 * Reversing the order of the bitmap from low addresses to high addresses
 * Including incoming stack arguments
 * Excluding outgoing stack arguments

Additionally, some accessor functions were added to allow Spidermonkey
to access the internals of the bitmap.
This commit is contained in:
Ryan Hunt
2020-01-06 15:48:12 -06:00
parent bbc0a328c7
commit 946251e655
7 changed files with 85 additions and 36 deletions

View File

@@ -162,6 +162,23 @@ impl fmt::Display for StackSlotData {
}
}
/// Stack frame layout information.
///
/// This is computed by the `layout_stack()` method.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
pub struct StackLayoutInfo {
/// The total size of the stack frame.
///
/// This is the distance from the stack pointer in the current function to the stack pointer in
/// the calling function, so it includes a pushed return address as well as space for outgoing
/// call arguments.
pub frame_size: StackSize,
/// The total size of the stack frame for inbound arguments pushed by the caller.
pub inbound_args_size: StackSize,
}
/// Stack frame manager.
///
/// Keep track of all the stack slots used by a function.
@@ -177,14 +194,8 @@ pub struct StackSlots {
/// All the emergency slots.
emergency: Vec<StackSlot>,
/// The total size of the stack frame.
///
/// This is the distance from the stack pointer in the current function to the stack pointer in
/// the calling function, so it includes a pushed return address as well as space for outgoing
/// call arguments.
///
/// This is computed by the `layout()` method.
pub frame_size: Option<StackSize>,
/// Layout information computed from `layout_stack`.
pub layout_info: Option<StackLayoutInfo>,
}
/// Stack slot manager functions that behave mostly like an entity map.
@@ -195,7 +206,7 @@ impl StackSlots {
slots: PrimaryMap::new(),
outgoing: Vec::new(),
emergency: Vec::new(),
frame_size: None,
layout_info: None,
}
}
@@ -204,7 +215,7 @@ impl StackSlots {
self.slots.clear();
self.outgoing.clear();
self.emergency.clear();
self.frame_size = None;
self.layout_info = None;
}
/// Allocate a new stack slot.