@@ -78,12 +78,12 @@ impl<'tcx> EnvVars<'tcx> {
78
78
) -> InterpResult < ' tcx > {
79
79
// Deallocate individual env vars.
80
80
for ( _name, ptr) in ecx. machine . env_vars . map . drain ( ) {
81
- ecx. memory . deallocate ( ptr, None , MiriMemoryKind :: Env . into ( ) ) ?;
81
+ ecx. memory . deallocate ( ptr, None , MiriMemoryKind :: Runtime . into ( ) ) ?;
82
82
}
83
83
// Deallocate environ var list.
84
84
let environ = ecx. machine . env_vars . environ . unwrap ( ) ;
85
85
let old_vars_ptr = ecx. read_pointer ( & environ. into ( ) ) ?;
86
- ecx. memory . deallocate ( old_vars_ptr, None , MiriMemoryKind :: Env . into ( ) ) ?;
86
+ ecx. memory . deallocate ( old_vars_ptr, None , MiriMemoryKind :: Runtime . into ( ) ) ?;
87
87
Ok ( ( ) )
88
88
}
89
89
}
@@ -96,7 +96,7 @@ fn alloc_env_var_as_c_str<'mir, 'tcx>(
96
96
let mut name_osstring = name. to_os_string ( ) ;
97
97
name_osstring. push ( "=" ) ;
98
98
name_osstring. push ( value) ;
99
- ecx. alloc_os_str_as_c_str ( name_osstring. as_os_str ( ) , MiriMemoryKind :: Env . into ( ) )
99
+ ecx. alloc_os_str_as_c_str ( name_osstring. as_os_str ( ) , MiriMemoryKind :: Runtime . into ( ) )
100
100
}
101
101
102
102
fn alloc_env_var_as_wide_str < ' mir , ' tcx > (
@@ -107,7 +107,7 @@ fn alloc_env_var_as_wide_str<'mir, 'tcx>(
107
107
let mut name_osstring = name. to_os_string ( ) ;
108
108
name_osstring. push ( "=" ) ;
109
109
name_osstring. push ( value) ;
110
- ecx. alloc_os_str_as_wide_str ( name_osstring. as_os_str ( ) , MiriMemoryKind :: Env . into ( ) )
110
+ ecx. alloc_os_str_as_wide_str ( name_osstring. as_os_str ( ) , MiriMemoryKind :: Runtime . into ( ) )
111
111
}
112
112
113
113
impl < ' mir , ' tcx : ' mir > EvalContextExt < ' mir , ' tcx > for crate :: MiriEvalContext < ' mir , ' tcx > { }
@@ -186,7 +186,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
186
186
}
187
187
// Allocate environment block & Store environment variables to environment block.
188
188
// Final null terminator(block terminator) is added by `alloc_os_str_to_wide_str`.
189
- let envblock_ptr = this. alloc_os_str_as_wide_str ( & env_vars, MiriMemoryKind :: Env . into ( ) ) ?;
189
+ let envblock_ptr =
190
+ this. alloc_os_str_as_wide_str ( & env_vars, MiriMemoryKind :: Runtime . into ( ) ) ?;
190
191
// If the function succeeds, the return value is a pointer to the environment block of the current process.
191
192
Ok ( envblock_ptr)
192
193
}
@@ -200,7 +201,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
200
201
this. assert_target_os ( "windows" , "FreeEnvironmentStringsW" ) ;
201
202
202
203
let env_block_ptr = this. read_pointer ( env_block_op) ?;
203
- let result = this. memory . deallocate ( env_block_ptr, None , MiriMemoryKind :: Env . into ( ) ) ;
204
+ let result = this. memory . deallocate ( env_block_ptr, None , MiriMemoryKind :: Runtime . into ( ) ) ;
204
205
// If the function succeeds, the return value is nonzero.
205
206
Ok ( result. is_ok ( ) as i32 )
206
207
}
@@ -231,7 +232,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
231
232
if let Some ( ( name, value) ) = new {
232
233
let var_ptr = alloc_env_var_as_c_str ( & name, & value, & mut this) ?;
233
234
if let Some ( var) = this. machine . env_vars . map . insert ( name, var_ptr) {
234
- this. memory . deallocate ( var, None , MiriMemoryKind :: Env . into ( ) ) ?;
235
+ this. memory . deallocate ( var, None , MiriMemoryKind :: Runtime . into ( ) ) ?;
235
236
}
236
237
this. update_environ ( ) ?;
237
238
Ok ( 0 ) // return zero on success
@@ -268,15 +269,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
268
269
} else if this. ptr_is_null ( value_ptr) ? {
269
270
// Delete environment variable `{name}`
270
271
if let Some ( var) = this. machine . env_vars . map . remove ( & name) {
271
- this. memory . deallocate ( var, None , MiriMemoryKind :: Env . into ( ) ) ?;
272
+ this. memory . deallocate ( var, None , MiriMemoryKind :: Runtime . into ( ) ) ?;
272
273
this. update_environ ( ) ?;
273
274
}
274
275
Ok ( 1 ) // return non-zero on success
275
276
} else {
276
277
let value = this. read_os_str_from_wide_str ( value_ptr) ?;
277
278
let var_ptr = alloc_env_var_as_wide_str ( & name, & value, & mut this) ?;
278
279
if let Some ( var) = this. machine . env_vars . map . insert ( name, var_ptr) {
279
- this. memory . deallocate ( var, None , MiriMemoryKind :: Env . into ( ) ) ?;
280
+ this. memory . deallocate ( var, None , MiriMemoryKind :: Runtime . into ( ) ) ?;
280
281
}
281
282
this. update_environ ( ) ?;
282
283
Ok ( 1 ) // return non-zero on success
@@ -301,7 +302,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
301
302
}
302
303
if let Some ( old) = success {
303
304
if let Some ( var) = old {
304
- this. memory . deallocate ( var, None , MiriMemoryKind :: Env . into ( ) ) ?;
305
+ this. memory . deallocate ( var, None , MiriMemoryKind :: Runtime . into ( ) ) ?;
305
306
}
306
307
this. update_environ ( ) ?;
307
308
Ok ( 0 )
@@ -437,7 +438,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
437
438
// Deallocate the old environ list, if any.
438
439
if let Some ( environ) = this. machine . env_vars . environ {
439
440
let old_vars_ptr = this. read_pointer ( & environ. into ( ) ) ?;
440
- this. memory . deallocate ( old_vars_ptr, None , MiriMemoryKind :: Env . into ( ) ) ?;
441
+ this. memory . deallocate ( old_vars_ptr, None , MiriMemoryKind :: Runtime . into ( ) ) ?;
441
442
} else {
442
443
// No `environ` allocated yet, let's do that.
443
444
// This is memory backing an extern static, hence `ExternStatic`, not `Env`.
@@ -455,7 +456,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
455
456
let tcx = this. tcx ;
456
457
let vars_layout =
457
458
this. layout_of ( tcx. mk_array ( tcx. types . usize , u64:: try_from ( vars. len ( ) ) . unwrap ( ) ) ) ?;
458
- let vars_place = this. allocate ( vars_layout, MiriMemoryKind :: Env . into ( ) ) ?;
459
+ let vars_place = this. allocate ( vars_layout, MiriMemoryKind :: Runtime . into ( ) ) ?;
459
460
for ( idx, var) in vars. into_iter ( ) . enumerate ( ) {
460
461
let place = this. mplace_field ( & vars_place, idx) ?;
461
462
this. write_pointer ( var, & place. into ( ) ) ?;
0 commit comments