@@ -82,68 +82,6 @@ impl Config {
82
82
features
83
83
}
84
84
85
- /// Sets the maximum recursion depth of the [`Engine`]'s stack during execution.
86
- ///
87
- /// # Note
88
- ///
89
- /// An execution traps if it exceeds this limits.
90
- ///
91
- /// [`Engine`]: [`crate::Engine`]
92
- pub fn set_max_recursion_depth ( & mut self , value : usize ) -> & mut Self {
93
- self . stack . set_max_recursion_depth ( value) ;
94
- self
95
- }
96
-
97
- /// Sets the minimum (or initial) height of the [`Engine`]'s value stack in bytes.
98
- ///
99
- /// # Note
100
- ///
101
- /// - Lower initial heights may improve memory consumption.
102
- /// - Higher initial heights may improve cold start times.
103
- ///
104
- /// # Panics
105
- ///
106
- /// If `value` is greater than the current maximum height of the value stack.
107
- ///
108
- /// [`Engine`]: [`crate::Engine`]
109
- pub fn set_min_stack_height ( & mut self , value : usize ) -> & mut Self {
110
- if self . stack . set_min_stack_height ( value) . is_err ( ) {
111
- let max = self . stack . max_stack_height ( ) ;
112
- panic ! ( "minimum stack height exceeds maximum: min={value}, max={max}" ) ;
113
- }
114
- self
115
- }
116
-
117
- /// Sets the maximum height of the [`Engine`]'s value stack in bytes.
118
- ///
119
- /// # Note
120
- ///
121
- /// An execution traps if it exceeds this limits.
122
- ///
123
- /// # Panics
124
- ///
125
- /// If `value` is less than the current minimum height of the value stack.
126
- ///
127
- /// [`Engine`]: [`crate::Engine`]
128
- pub fn set_max_stack_height ( & mut self , value : usize ) -> & mut Self {
129
- if self . stack . set_max_stack_height ( value) . is_err ( ) {
130
- let max = self . stack . min_stack_height ( ) ;
131
- panic ! ( "maximum stack height is lower than minimum: min={value}, max={max}" ) ;
132
- }
133
- self
134
- }
135
-
136
- /// Sets the maximum number of cached stacks for reuse for the [`Config`].
137
- ///
138
- /// # Note
139
- ///
140
- /// - A higher value may improve execution performance.
141
- /// - A lower value may improve memory consumption.
142
- pub fn set_max_cached_stacks ( & mut self , value : usize ) -> & mut Self {
143
- self . stack . set_max_cached_stacks ( value) ;
144
- self
145
- }
146
-
147
85
/// Enable or disable the [`mutable-global`] Wasm proposal for the [`Config`].
148
86
///
149
87
/// # Note
@@ -326,30 +264,66 @@ impl Config {
326
264
}
327
265
328
266
impl Config {
329
- /// Sets the [`StackLimits`] for the [`Config`].
330
- pub fn set_stack_limits ( & mut self , stack_limits : StackLimits ) -> & mut Self {
331
- self . stack_limits = stack_limits;
267
+ /// Sets the maximum recursion depth of the [`Engine`]'s stack during execution.
268
+ ///
269
+ /// # Note
270
+ ///
271
+ /// An execution traps if it exceeds this limits.
272
+ ///
273
+ /// [`Engine`]: [`crate::Engine`]
274
+ pub fn set_max_recursion_depth ( & mut self , value : usize ) -> & mut Self {
275
+ self . stack . set_max_recursion_depth ( value) ;
332
276
self
333
277
}
334
278
335
- /// Returns the [`StackLimits`] of the [`Config`].
336
- pub ( super ) fn stack_limits ( & self ) -> StackLimits {
337
- self . stack_limits
279
+ /// Sets the minimum (or initial) height of the [`Engine`]'s value stack in bytes.
280
+ ///
281
+ /// # Note
282
+ ///
283
+ /// - Lower initial heights may improve memory consumption.
284
+ /// - Higher initial heights may improve cold start times.
285
+ ///
286
+ /// # Panics
287
+ ///
288
+ /// If `value` is greater than the current maximum height of the value stack.
289
+ ///
290
+ /// [`Engine`]: [`crate::Engine`]
291
+ pub fn set_min_stack_height ( & mut self , value : usize ) -> & mut Self {
292
+ if self . stack . set_min_stack_height ( value) . is_err ( ) {
293
+ let max = self . stack . max_stack_height ( ) ;
294
+ panic ! ( "minimum stack height exceeds maximum: min={value}, max={max}" ) ;
295
+ }
296
+ self
338
297
}
339
298
340
- /// Sets the maximum amount of cached stacks for reuse for the [`Config`] .
299
+ /// Sets the maximum height of the [`Engine`]'s value stack in bytes .
341
300
///
342
301
/// # Note
343
302
///
344
- /// Defaults to 2.
345
- pub fn set_cached_stacks ( & mut self , amount : usize ) -> & mut Self {
346
- self . cached_stacks = amount;
303
+ /// An execution traps if it exceeds this limits.
304
+ ///
305
+ /// # Panics
306
+ ///
307
+ /// If `value` is less than the current minimum height of the value stack.
308
+ ///
309
+ /// [`Engine`]: [`crate::Engine`]
310
+ pub fn set_max_stack_height ( & mut self , value : usize ) -> & mut Self {
311
+ if self . stack . set_max_stack_height ( value) . is_err ( ) {
312
+ let max = self . stack . min_stack_height ( ) ;
313
+ panic ! ( "maximum stack height is lower than minimum: min={value}, max={max}" ) ;
314
+ }
347
315
self
348
316
}
349
317
350
- /// Returns the maximum amount of cached stacks for reuse of the [`Config`].
351
- pub ( super ) fn cached_stacks ( & self ) -> usize {
352
- self . cached_stacks
318
+ /// Sets the maximum number of cached stacks for reuse for the [`Config`].
319
+ ///
320
+ /// # Note
321
+ ///
322
+ /// - A higher value may improve execution performance.
323
+ /// - A lower value may improve memory consumption.
324
+ pub fn set_max_cached_stacks ( & mut self , value : usize ) -> & mut Self {
325
+ self . stack . set_max_cached_stacks ( value) ;
326
+ self
353
327
}
354
328
355
329
/// Configures whether Wasmi will consume fuel during execution to either halt execution as desired.
0 commit comments