Skip to content

Commit 4ca5ea6

Browse files
authored
Fix a few stray references to "runtime limits" (#10509)
`VMRuntimeLimits` was renamed to `VMStoreContext` a little while back. Split off from #10503
1 parent df4cb6e commit 4ca5ea6

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

crates/cranelift/src/compiler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl wasmtime_environ::Compiler for Compiler {
249249
.create_global_value(ir::GlobalValueData::VMContext);
250250
let interrupts_ptr = context.func.create_global_value(ir::GlobalValueData::Load {
251251
base: vmctx,
252-
offset: i32::from(func_env.offsets.ptr.vmctx_runtime_limits()).into(),
252+
offset: i32::from(func_env.offsets.ptr.vmctx_store_context()).into(),
253253
global_type: isa.pointer_type(),
254254
flags: MemFlags::trusted().with_readonly(),
255255
});
@@ -329,12 +329,12 @@ impl wasmtime_environ::Compiler for Compiler {
329329
// what we are assuming with our offsets below.
330330
debug_assert_vmctx_kind(isa, &mut builder, vmctx, wasmtime_environ::VMCONTEXT_MAGIC);
331331
let offsets = VMOffsets::new(isa.pointer_bytes(), &translation.module);
332-
let vm_runtime_limits_offset = offsets.ptr.vmctx_runtime_limits();
332+
let vm_store_context_offset = offsets.ptr.vmctx_store_context();
333333
save_last_wasm_entry_fp(
334334
&mut builder,
335335
pointer_type,
336336
&offsets.ptr,
337-
vm_runtime_limits_offset.into(),
337+
vm_store_context_offset.into(),
338338
vmctx,
339339
);
340340

crates/cranelift/src/func_environ.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
314314
let pointer_type = self.pointer_type();
315315
let vmctx = self.vmctx(builder.func);
316316
let base = builder.ins().global_value(pointer_type, vmctx);
317-
let offset = i32::from(self.offsets.ptr.vmctx_runtime_limits());
317+
let offset = i32::from(self.offsets.ptr.vmctx_store_context());
318318
debug_assert!(self.vmstore_context_ptr.is_reserved_value());
319319
self.vmstore_context_ptr = builder.ins().load(
320320
pointer_type,

crates/environ/src/vmoffsets.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub trait PtrSize {
107107
/// Returns the pointer size, in bytes, for the target.
108108
fn size(&self) -> u8;
109109

110-
/// The offset of the `VMContext::runtime_limits` field
110+
/// The offset of the `VMContext::store_context` field
111111
fn vmcontext_store_context(&self) -> u8 {
112112
u8::try_from(align(
113113
u32::try_from(core::mem::size_of::<u32>()).unwrap(),
@@ -247,14 +247,14 @@ pub trait PtrSize {
247247

248248
/// Return the offset to the `VMStoreContext` structure
249249
#[inline]
250-
fn vmctx_runtime_limits(&self) -> u8 {
250+
fn vmctx_store_context(&self) -> u8 {
251251
self.vmctx_magic() + self.size()
252252
}
253253

254254
/// Return the offset to the `VMBuiltinFunctionsArray` structure
255255
#[inline]
256256
fn vmctx_builtin_functions(&self) -> u8 {
257-
self.vmctx_runtime_limits() + self.size()
257+
self.vmctx_store_context() + self.size()
258258
}
259259

260260
/// Return the offset to the `callee` member in this `VMContext`.

crates/wasmtime/src/runtime/vm/instance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ impl Instance {
583583
/// Return a pointer to the interrupts structure
584584
#[inline]
585585
pub fn vm_store_context(&mut self) -> NonNull<Option<VmPtr<VMStoreContext>>> {
586-
unsafe { self.vmctx_plus_offset_mut(self.offsets().ptr.vmctx_runtime_limits()) }
586+
unsafe { self.vmctx_plus_offset_mut(self.offsets().ptr.vmctx_store_context()) }
587587
}
588588

589589
/// Return a pointer to the global epoch counter used by this instance.

winch/codegen/src/codegen/mod.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,10 +1143,11 @@ where
11431143
/// Emits a series of instructions that load the `fuel_consumed` field from
11441144
/// `VMStoreContext`.
11451145
fn emit_load_fuel_consumed(&mut self, fuel_reg: Reg) -> Result<()> {
1146-
let limits_offset = self.env.vmoffsets.ptr.vmctx_runtime_limits();
1146+
let store_context_offset = self.env.vmoffsets.ptr.vmctx_store_context();
11471147
let fuel_offset = self.env.vmoffsets.ptr.vmstore_context_fuel_consumed();
11481148
self.masm.load_ptr(
1149-
self.masm.address_at_vmctx(u32::from(limits_offset))?,
1149+
self.masm
1150+
.address_at_vmctx(u32::from(store_context_offset))?,
11501151
writable!(fuel_reg),
11511152
)?;
11521153

@@ -1221,7 +1222,7 @@ where
12211222
epoch_counter_reg: Reg,
12221223
) -> Result<()> {
12231224
let epoch_ptr_offset = self.env.vmoffsets.ptr.vmctx_epoch_ptr();
1224-
let runtime_limits_offset = self.env.vmoffsets.ptr.vmctx_runtime_limits();
1225+
let store_context_offset = self.env.vmoffsets.ptr.vmctx_store_context();
12251226
let epoch_deadline_offset = self.env.vmoffsets.ptr.vmstore_context_epoch_deadline();
12261227

12271228
// Load the current epoch value into `epoch_counter_var`.
@@ -1241,7 +1242,7 @@ where
12411242
// Load the `VMStoreContext`.
12421243
self.masm.load_ptr(
12431244
self.masm
1244-
.address_at_vmctx(u32::from(runtime_limits_offset))?,
1245+
.address_at_vmctx(u32::from(store_context_offset))?,
12451246
writable!(epoch_deadline_reg),
12461247
)?;
12471248

@@ -1262,13 +1263,14 @@ where
12621263
return Ok(());
12631264
}
12641265

1265-
let limits_offset = self.env.vmoffsets.ptr.vmctx_runtime_limits();
1266+
let store_context_offset = self.env.vmoffsets.ptr.vmctx_store_context();
12661267
let fuel_offset = self.env.vmoffsets.ptr.vmstore_context_fuel_consumed();
12671268
let limits_reg = self.context.any_gpr(self.masm)?;
12681269

12691270
// Load `VMStoreContext` into the `limits_reg` reg.
12701271
self.masm.load_ptr(
1271-
self.masm.address_at_vmctx(u32::from(limits_offset))?,
1272+
self.masm
1273+
.address_at_vmctx(u32::from(store_context_offset))?,
12721274
writable!(limits_reg),
12731275
)?;
12741276

0 commit comments

Comments
 (0)