@@ -130,17 +130,17 @@ pub struct FuncEnvironment<'module_environment> {
130130 /// A function-local variable which stores the cached value of the amount of
131131 /// fuel remaining to execute. If used this is modified frequently so it's
132132 /// stored locally as a variable instead of always referenced from the field
133- /// in `*const VMRuntimeLimits `
133+ /// in `*const VMStoreContext `
134134 fuel_var : cranelift_frontend:: Variable ,
135135
136136 /// A function-local variable which caches the value of `*const
137- /// VMRuntimeLimits ` for this function's vmctx argument. This pointer is stored
137+ /// VMStoreContext ` for this function's vmctx argument. This pointer is stored
138138 /// in the vmctx itself, but never changes for the lifetime of the function,
139139 /// so if we load it up front we can continue to use it throughout.
140- vmruntime_limits_ptr : ir:: Value ,
140+ vmstore_context_ptr : ir:: Value ,
141141
142142 /// A cached epoch deadline value, when performing epoch-based
143- /// interruption. Loaded from `VMRuntimeLimits ` and reloaded after
143+ /// interruption. Loaded from `VMStoreContext ` and reloaded after
144144 /// any yield.
145145 epoch_deadline_var : cranelift_frontend:: Variable ,
146146
@@ -199,7 +199,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
199199 fuel_var : Variable :: new ( 0 ) ,
200200 epoch_deadline_var : Variable :: new ( 0 ) ,
201201 epoch_ptr_var : Variable :: new ( 0 ) ,
202- vmruntime_limits_ptr : ir:: Value :: reserved_value ( ) ,
202+ vmstore_context_ptr : ir:: Value :: reserved_value ( ) ,
203203
204204 // Start with at least one fuel being consumed because even empty
205205 // functions should consume at least some fuel.
@@ -304,17 +304,17 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
304304 }
305305 }
306306
307- fn declare_vmruntime_limits_ptr ( & mut self , builder : & mut FunctionBuilder < ' _ > ) {
308- // We load the `*const VMRuntimeLimits ` value stored within vmctx at the
307+ fn declare_vmstore_context_ptr ( & mut self , builder : & mut FunctionBuilder < ' _ > ) {
308+ // We load the `*const VMStoreContext ` value stored within vmctx at the
309309 // head of the function and reuse the same value across the entire
310310 // function. This is possible since we know that the pointer never
311311 // changes for the lifetime of the function.
312312 let pointer_type = self . pointer_type ( ) ;
313313 let vmctx = self . vmctx ( builder. func ) ;
314314 let base = builder. ins ( ) . global_value ( pointer_type, vmctx) ;
315315 let offset = i32:: from ( self . offsets . ptr . vmctx_runtime_limits ( ) ) ;
316- debug_assert ! ( self . vmruntime_limits_ptr . is_reserved_value( ) ) ;
317- self . vmruntime_limits_ptr =
316+ debug_assert ! ( self . vmstore_context_ptr . is_reserved_value( ) ) ;
317+ self . vmstore_context_ptr =
318318 builder
319319 . ins ( )
320320 . load ( pointer_type, ir:: MemFlags :: trusted ( ) , base, offset) ;
@@ -324,7 +324,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
324324 // On function entry we load the amount of fuel into a function-local
325325 // `self.fuel_var` to make fuel modifications fast locally. This cache
326326 // is then periodically flushed to the Store-defined location in
327- // `VMRuntimeLimits ` later.
327+ // `VMStoreContext ` later.
328328 builder. declare_var ( self . fuel_var , ir:: types:: I64 ) ;
329329 self . fuel_load_into_var ( builder) ;
330330 self . fuel_check ( builder) ;
@@ -372,13 +372,13 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
372372 match op {
373373 // Exiting a function (via a return or unreachable) or otherwise
374374 // entering a different function (via a call) means that we need to
375- // update the fuel consumption in `VMRuntimeLimits ` because we're
375+ // update the fuel consumption in `VMStoreContext ` because we're
376376 // about to move control out of this function itself and the fuel
377377 // may need to be read.
378378 //
379379 // Before this we need to update the fuel counter from our own cost
380380 // leading up to this function call, and then we can store
381- // `self.fuel_var` into `VMRuntimeLimits `.
381+ // `self.fuel_var` into `VMStoreContext `.
382382 Operator :: Unreachable
383383 | Operator :: Return
384384 | Operator :: CallIndirect { .. }
@@ -463,7 +463,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
463463 builder. def_var ( self . fuel_var , fuel) ;
464464 }
465465
466- /// Loads the fuel consumption value from `VMRuntimeLimits ` into `self.fuel_var`
466+ /// Loads the fuel consumption value from `VMStoreContext ` into `self.fuel_var`
467467 fn fuel_load_into_var ( & mut self , builder : & mut FunctionBuilder < ' _ > ) {
468468 let ( addr, offset) = self . fuel_addr_offset ( ) ;
469469 let fuel = builder
@@ -473,7 +473,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
473473 }
474474
475475 /// Stores the fuel consumption value from `self.fuel_var` into
476- /// `VMRuntimeLimits `.
476+ /// `VMStoreContext `.
477477 fn fuel_save_from_var ( & mut self , builder : & mut FunctionBuilder < ' _ > ) {
478478 let ( addr, offset) = self . fuel_addr_offset ( ) ;
479479 let fuel_consumed = builder. use_var ( self . fuel_var ) ;
@@ -483,12 +483,12 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
483483 }
484484
485485 /// Returns the `(address, offset)` of the fuel consumption within
486- /// `VMRuntimeLimits `, used to perform loads/stores later.
486+ /// `VMStoreContext `, used to perform loads/stores later.
487487 fn fuel_addr_offset ( & mut self ) -> ( ir:: Value , ir:: immediates:: Offset32 ) {
488- debug_assert ! ( !self . vmruntime_limits_ptr . is_reserved_value( ) ) ;
488+ debug_assert ! ( !self . vmstore_context_ptr . is_reserved_value( ) ) ;
489489 (
490- self . vmruntime_limits_ptr ,
491- i32:: from ( self . offsets . ptr . vmruntime_limits_fuel_consumed ( ) ) . into ( ) ,
490+ self . vmstore_context_ptr ,
491+ i32:: from ( self . offsets . ptr . vmstore_context_fuel_consumed ( ) ) . into ( ) ,
492492 )
493493 }
494494
@@ -676,9 +676,9 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
676676 builder. ins ( ) . load (
677677 ir:: types:: I64 ,
678678 ir:: MemFlags :: trusted ( ) ,
679- self . vmruntime_limits_ptr ,
679+ self . vmstore_context_ptr ,
680680 ir:: immediates:: Offset32 :: new (
681- self . offsets . ptr . vmruntime_limits_epoch_deadline ( ) as i32
681+ self . offsets . ptr . vmstore_context_epoch_deadline ( ) as i32
682682 ) ,
683683 ) ;
684684 builder. def_var ( self . epoch_deadline_var , deadline) ;
@@ -3088,10 +3088,10 @@ impl FuncEnvironment<'_> {
30883088 self . conditionally_trap ( builder, overflow, ir:: TrapCode :: STACK_OVERFLOW ) ;
30893089 }
30903090
3091- // If the `vmruntime_limits_ptr ` variable will get used then we initialize
3092- // it here.
3091+ // If the `vmstore_context_ptr ` variable will get used then we
3092+ // initialize it here.
30933093 if self . tunables . consume_fuel || self . tunables . epoch_interruption {
3094- self . declare_vmruntime_limits_ptr ( builder) ;
3094+ self . declare_vmstore_context_ptr ( builder) ;
30953095 }
30963096 // Additionally we initialize `fuel_var` if it will get used.
30973097 if self . tunables . consume_fuel {
0 commit comments