diff --git a/crates/cranelift/src/compiler.rs b/crates/cranelift/src/compiler.rs
index 33ce1c17ac3f..1b9e0fb167af 100644
--- a/crates/cranelift/src/compiler.rs
+++ b/crates/cranelift/src/compiler.rs
@@ -224,7 +224,7 @@ impl wasmtime_environ::Compiler for Compiler {
// The way that stack overflow is handled here is by adding a prologue
// check to all functions for how much native stack is remaining. The
// `VMContext` pointer is the first argument to all functions, and the
- // first field of this structure is `*const VMRuntimeLimits` and the
+ // first field of this structure is `*const VMStoreContext` and the
// first field of that is the stack limit. Note that the stack limit in
// this case means "if the stack pointer goes below this, trap". Each
// function which consumes stack space or isn't a leaf function starts
@@ -255,7 +255,7 @@ impl wasmtime_environ::Compiler for Compiler {
});
let stack_limit = context.func.create_global_value(ir::GlobalValueData::Load {
base: interrupts_ptr,
- offset: i32::from(func_env.offsets.ptr.vmruntime_limits_stack_limit()).into(),
+ offset: i32::from(func_env.offsets.ptr.vmstore_context_stack_limit()).into(),
global_type: isa.pointer_type(),
flags: MemFlags::trusted(),
});
@@ -393,13 +393,13 @@ impl wasmtime_environ::Compiler for Compiler {
wasmtime_environ::VMCONTEXT_MAGIC,
);
let ptr = isa.pointer_bytes();
- let limits = builder.ins().load(
+ let vm_store_context = builder.ins().load(
pointer_type,
MemFlags::trusted(),
caller_vmctx,
- i32::from(ptr.vmcontext_runtime_limits()),
+ i32::from(ptr.vmcontext_store_context()),
);
- save_last_wasm_exit_fp_and_pc(&mut builder, pointer_type, &ptr, limits);
+ save_last_wasm_exit_fp_and_pc(&mut builder, pointer_type, &ptr, vm_store_context);
// Spill all wasm arguments to the stack in `ValRaw` slots.
let (args_base, args_len) =
@@ -592,13 +592,13 @@ impl wasmtime_environ::Compiler for Compiler {
// additionally perform the "routine of the exit trampoline" of saving
// fp/pc/etc.
debug_assert_vmctx_kind(isa, &mut builder, vmctx, wasmtime_environ::VMCONTEXT_MAGIC);
- let limits = builder.ins().load(
+ let vm_store_context = builder.ins().load(
pointer_type,
MemFlags::trusted(),
vmctx,
- ptr_size.vmcontext_runtime_limits(),
+ ptr_size.vmcontext_store_context(),
);
- save_last_wasm_exit_fp_and_pc(&mut builder, pointer_type, &ptr_size, limits);
+ save_last_wasm_exit_fp_and_pc(&mut builder, pointer_type, &ptr_size, vm_store_context);
// Now it's time to delegate to the actual builtin. Forward all our own
// arguments to the libcall itself.
@@ -1157,15 +1157,15 @@ fn save_last_wasm_entry_fp(
builder: &mut FunctionBuilder,
pointer_type: ir::Type,
ptr_size: &impl PtrSize,
- vm_runtime_limits_offset: u32,
+ vm_store_context_offset: u32,
vmctx: Value,
) {
- // First we need to get the `VMRuntimeLimits`.
- let limits = builder.ins().load(
+ // First we need to get the `VMStoreContext`.
+ let vm_store_context = builder.ins().load(
pointer_type,
MemFlags::trusted(),
vmctx,
- i32::try_from(vm_runtime_limits_offset).unwrap(),
+ i32::try_from(vm_store_context_offset).unwrap(),
);
// Then store our current stack pointer into the appropriate slot.
@@ -1173,8 +1173,8 @@ fn save_last_wasm_entry_fp(
builder.ins().store(
MemFlags::trusted(),
fp,
- limits,
- ptr_size.vmruntime_limits_last_wasm_entry_fp(),
+ vm_store_context,
+ ptr_size.vmstore_context_last_wasm_entry_fp(),
);
}
@@ -1201,7 +1201,7 @@ fn save_last_wasm_exit_fp_and_pc(
MemFlags::trusted(),
wasm_fp,
limits,
- ptr.vmruntime_limits_last_wasm_exit_fp(),
+ ptr.vmstore_context_last_wasm_exit_fp(),
);
// Finally save the Wasm return address to the limits.
let wasm_pc = builder.ins().get_return_address(pointer_type);
@@ -1209,6 +1209,6 @@ fn save_last_wasm_exit_fp_and_pc(
MemFlags::trusted(),
wasm_pc,
limits,
- ptr.vmruntime_limits_last_wasm_exit_pc(),
+ ptr.vmstore_context_last_wasm_exit_pc(),
);
}
diff --git a/crates/cranelift/src/compiler/component.rs b/crates/cranelift/src/compiler/component.rs
index 796b029280a2..a88d26d22c4c 100644
--- a/crates/cranelift/src/compiler/component.rs
+++ b/crates/cranelift/src/compiler/component.rs
@@ -856,17 +856,17 @@ impl ComponentCompiler for Compiler {
wasmtime_environ::component::VMCOMPONENT_MAGIC,
);
if let Abi::Wasm = abi {
- let limits = c.builder.ins().load(
+ let vm_store_context = c.builder.ins().load(
pointer_type,
MemFlags::trusted(),
vmctx,
- i32::try_from(c.offsets.limits()).unwrap(),
+ i32::try_from(c.offsets.vm_store_context()).unwrap(),
);
super::save_last_wasm_exit_fp_and_pc(
&mut c.builder,
pointer_type,
&c.offsets.ptr,
- limits,
+ vm_store_context,
);
}
diff --git a/crates/cranelift/src/func_environ.rs b/crates/cranelift/src/func_environ.rs
index 67ed54a28a34..d1f5ba1e97a5 100644
--- a/crates/cranelift/src/func_environ.rs
+++ b/crates/cranelift/src/func_environ.rs
@@ -130,17 +130,17 @@ pub struct FuncEnvironment<'module_environment> {
/// A function-local variable which stores the cached value of the amount of
/// fuel remaining to execute. If used this is modified frequently so it's
/// stored locally as a variable instead of always referenced from the field
- /// in `*const VMRuntimeLimits`
+ /// in `*const VMStoreContext`
fuel_var: cranelift_frontend::Variable,
/// A function-local variable which caches the value of `*const
- /// VMRuntimeLimits` for this function's vmctx argument. This pointer is stored
+ /// VMStoreContext` for this function's vmctx argument. This pointer is stored
/// in the vmctx itself, but never changes for the lifetime of the function,
/// so if we load it up front we can continue to use it throughout.
- vmruntime_limits_ptr: ir::Value,
+ vmstore_context_ptr: ir::Value,
/// A cached epoch deadline value, when performing epoch-based
- /// interruption. Loaded from `VMRuntimeLimits` and reloaded after
+ /// interruption. Loaded from `VMStoreContext` and reloaded after
/// any yield.
epoch_deadline_var: cranelift_frontend::Variable,
@@ -199,7 +199,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
fuel_var: Variable::new(0),
epoch_deadline_var: Variable::new(0),
epoch_ptr_var: Variable::new(0),
- vmruntime_limits_ptr: ir::Value::reserved_value(),
+ vmstore_context_ptr: ir::Value::reserved_value(),
// Start with at least one fuel being consumed because even empty
// functions should consume at least some fuel.
@@ -304,8 +304,8 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
}
}
- fn declare_vmruntime_limits_ptr(&mut self, builder: &mut FunctionBuilder<'_>) {
- // We load the `*const VMRuntimeLimits` value stored within vmctx at the
+ fn declare_vmstore_context_ptr(&mut self, builder: &mut FunctionBuilder<'_>) {
+ // We load the `*const VMStoreContext` value stored within vmctx at the
// head of the function and reuse the same value across the entire
// function. This is possible since we know that the pointer never
// changes for the lifetime of the function.
@@ -313,8 +313,8 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
let vmctx = self.vmctx(builder.func);
let base = builder.ins().global_value(pointer_type, vmctx);
let offset = i32::from(self.offsets.ptr.vmctx_runtime_limits());
- debug_assert!(self.vmruntime_limits_ptr.is_reserved_value());
- self.vmruntime_limits_ptr =
+ debug_assert!(self.vmstore_context_ptr.is_reserved_value());
+ self.vmstore_context_ptr =
builder
.ins()
.load(pointer_type, ir::MemFlags::trusted(), base, offset);
@@ -324,7 +324,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
// On function entry we load the amount of fuel into a function-local
// `self.fuel_var` to make fuel modifications fast locally. This cache
// is then periodically flushed to the Store-defined location in
- // `VMRuntimeLimits` later.
+ // `VMStoreContext` later.
builder.declare_var(self.fuel_var, ir::types::I64);
self.fuel_load_into_var(builder);
self.fuel_check(builder);
@@ -372,13 +372,13 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
match op {
// Exiting a function (via a return or unreachable) or otherwise
// entering a different function (via a call) means that we need to
- // update the fuel consumption in `VMRuntimeLimits` because we're
+ // update the fuel consumption in `VMStoreContext` because we're
// about to move control out of this function itself and the fuel
// may need to be read.
//
// Before this we need to update the fuel counter from our own cost
// leading up to this function call, and then we can store
- // `self.fuel_var` into `VMRuntimeLimits`.
+ // `self.fuel_var` into `VMStoreContext`.
Operator::Unreachable
| Operator::Return
| Operator::CallIndirect { .. }
@@ -463,7 +463,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
builder.def_var(self.fuel_var, fuel);
}
- /// Loads the fuel consumption value from `VMRuntimeLimits` into `self.fuel_var`
+ /// Loads the fuel consumption value from `VMStoreContext` into `self.fuel_var`
fn fuel_load_into_var(&mut self, builder: &mut FunctionBuilder<'_>) {
let (addr, offset) = self.fuel_addr_offset();
let fuel = builder
@@ -473,7 +473,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
}
/// Stores the fuel consumption value from `self.fuel_var` into
- /// `VMRuntimeLimits`.
+ /// `VMStoreContext`.
fn fuel_save_from_var(&mut self, builder: &mut FunctionBuilder<'_>) {
let (addr, offset) = self.fuel_addr_offset();
let fuel_consumed = builder.use_var(self.fuel_var);
@@ -483,12 +483,12 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
}
/// Returns the `(address, offset)` of the fuel consumption within
- /// `VMRuntimeLimits`, used to perform loads/stores later.
+ /// `VMStoreContext`, used to perform loads/stores later.
fn fuel_addr_offset(&mut self) -> (ir::Value, ir::immediates::Offset32) {
- debug_assert!(!self.vmruntime_limits_ptr.is_reserved_value());
+ debug_assert!(!self.vmstore_context_ptr.is_reserved_value());
(
- self.vmruntime_limits_ptr,
- i32::from(self.offsets.ptr.vmruntime_limits_fuel_consumed()).into(),
+ self.vmstore_context_ptr,
+ i32::from(self.offsets.ptr.vmstore_context_fuel_consumed()).into(),
)
}
@@ -672,15 +672,12 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
// We keep the deadline cached in a register to speed the checks
// in the common case (between epoch ticks) but we want to do a
// precise check here by reloading the cache first.
- let deadline =
- builder.ins().load(
- ir::types::I64,
- ir::MemFlags::trusted(),
- self.vmruntime_limits_ptr,
- ir::immediates::Offset32::new(
- self.offsets.ptr.vmruntime_limits_epoch_deadline() as i32
- ),
- );
+ let deadline = builder.ins().load(
+ ir::types::I64,
+ ir::MemFlags::trusted(),
+ self.vmstore_context_ptr,
+ ir::immediates::Offset32::new(self.offsets.ptr.vmstore_context_epoch_deadline() as i32),
+ );
builder.def_var(self.epoch_deadline_var, deadline);
self.epoch_check_cached(builder, cur_epoch_value, continuation_block);
@@ -3088,10 +3085,10 @@ impl FuncEnvironment<'_> {
self.conditionally_trap(builder, overflow, ir::TrapCode::STACK_OVERFLOW);
}
- // If the `vmruntime_limits_ptr` variable will get used then we initialize
- // it here.
+ // If the `vmstore_context_ptr` variable will get used then we
+ // initialize it here.
if self.tunables.consume_fuel || self.tunables.epoch_interruption {
- self.declare_vmruntime_limits_ptr(builder);
+ self.declare_vmstore_context_ptr(builder);
}
// Additionally we initialize `fuel_var` if it will get used.
if self.tunables.consume_fuel {
diff --git a/crates/environ/src/builtin.rs b/crates/environ/src/builtin.rs
index 1b9d322b366e..a446829af7d8 100644
--- a/crates/environ/src/builtin.rs
+++ b/crates/environ/src/builtin.rs
@@ -116,7 +116,7 @@ macro_rules! foreach_builtin_function {
// Wasm code, so that it doesn't need to make a libcall to go from
// id to `VMFuncRef`. That will be a little tricky: it will also
// require updating the pointer to the slab in the `VMContext` (or
- // `VMRuntimeLimits` or wherever we put it) when the slab is
+ // `VMStoreContext` or wherever we put it) when the slab is
// resized.
#[cfg(feature = "gc")]
get_interned_func_ref(
diff --git a/crates/environ/src/component/vmcomponent_offsets.rs b/crates/environ/src/component/vmcomponent_offsets.rs
index 429a186cc689..9dbc0ee1a513 100644
--- a/crates/environ/src/component/vmcomponent_offsets.rs
+++ b/crates/environ/src/component/vmcomponent_offsets.rs
@@ -3,7 +3,7 @@
// struct VMComponentContext {
// magic: u32,
// builtins: &'static VMComponentBuiltins,
-// limits: *const VMRuntimeLimits,
+// limits: *const VMStoreContext,
// flags: [VMGlobalDefinition; component.num_runtime_component_instances],
// trampoline_func_refs: [VMFuncRef; component.num_trampolines],
// lowerings: [VMLowering; component.num_lowerings],
@@ -61,7 +61,7 @@ pub struct VMComponentOffsets
{
// precalculated offsets of various member fields
magic: u32,
builtins: u32,
- limits: u32,
+ vm_store_context: u32,
flags: u32,
trampoline_func_refs: u32,
lowerings: u32,
@@ -98,7 +98,7 @@ impl VMComponentOffsets