@@ -131,10 +131,10 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
131
131
}
132
132
133
133
"free" => {
134
- let ptr = self . read_scalar ( args[ 0 ] ) ?. not_undef ( ) ?. erase_tag ( ) ; // raw ptr operation, no tag
134
+ let ptr = self . read_scalar ( args[ 0 ] ) ?. not_undef ( ) ?;
135
135
if !ptr. is_null_ptr ( self ) {
136
136
self . memory_mut ( ) . deallocate (
137
- ptr. to_ptr ( ) ?. with_default_tag ( ) ,
137
+ ptr. to_ptr ( ) ?,
138
138
None ,
139
139
MiriMemoryKind :: C . into ( ) ,
140
140
) ?;
@@ -179,7 +179,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
179
179
self . write_scalar ( Scalar :: Ptr ( ptr) , dest) ?;
180
180
}
181
181
"__rust_dealloc" => {
182
- let ptr = self . read_scalar ( args[ 0 ] ) ?. to_ptr ( ) ?. erase_tag ( ) ; // raw ptr operation, no tag
182
+ let ptr = self . read_scalar ( args[ 0 ] ) ?. to_ptr ( ) ?;
183
183
let old_size = self . read_scalar ( args[ 1 ] ) ?. to_usize ( self ) ?;
184
184
let align = self . read_scalar ( args[ 2 ] ) ?. to_usize ( self ) ?;
185
185
if old_size == 0 {
@@ -189,13 +189,13 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
189
189
return err ! ( HeapAllocNonPowerOfTwoAlignment ( align) ) ;
190
190
}
191
191
self . memory_mut ( ) . deallocate (
192
- ptr. with_default_tag ( ) ,
192
+ ptr,
193
193
Some ( ( Size :: from_bytes ( old_size) , Align :: from_bytes ( align, align) . unwrap ( ) ) ) ,
194
194
MiriMemoryKind :: Rust . into ( ) ,
195
195
) ?;
196
196
}
197
197
"__rust_realloc" => {
198
- let ptr = self . read_scalar ( args[ 0 ] ) ?. to_ptr ( ) ?. erase_tag ( ) ; // raw ptr operation, no tag
198
+ let ptr = self . read_scalar ( args[ 0 ] ) ?. to_ptr ( ) ?;
199
199
let old_size = self . read_scalar ( args[ 1 ] ) ?. to_usize ( self ) ?;
200
200
let align = self . read_scalar ( args[ 2 ] ) ?. to_usize ( self ) ?;
201
201
let new_size = self . read_scalar ( args[ 3 ] ) ?. to_usize ( self ) ?;
@@ -206,7 +206,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
206
206
return err ! ( HeapAllocNonPowerOfTwoAlignment ( align) ) ;
207
207
}
208
208
let new_ptr = self . memory_mut ( ) . reallocate (
209
- ptr. with_default_tag ( ) ,
209
+ ptr,
210
210
Size :: from_bytes ( old_size) ,
211
211
Align :: from_bytes ( align, align) . unwrap ( ) ,
212
212
Size :: from_bytes ( new_size) ,
@@ -238,8 +238,8 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
238
238
239
239
"dlsym" => {
240
240
let _handle = self . read_scalar ( args[ 0 ] ) ?;
241
- let symbol = self . read_scalar ( args[ 1 ] ) ?. to_ptr ( ) ?. erase_tag ( ) ;
242
- let symbol_name = self . memory ( ) . read_c_str ( symbol. with_default_tag ( ) ) ?;
241
+ let symbol = self . read_scalar ( args[ 1 ] ) ?. to_ptr ( ) ?;
242
+ let symbol_name = self . memory ( ) . read_c_str ( symbol) ?;
243
243
let err = format ! ( "bad c unicode symbol: {:?}" , symbol_name) ;
244
244
let symbol_name = :: std:: str:: from_utf8 ( symbol_name) . unwrap_or ( & err) ;
245
245
return err ! ( Unimplemented ( format!(
@@ -292,13 +292,13 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
292
292
return err ! ( MachineError ( "the evaluated program panicked" . to_string( ) ) ) ,
293
293
294
294
"memcmp" => {
295
- let left = self . read_scalar ( args[ 0 ] ) ?. not_undef ( ) ?. erase_tag ( ) ; // raw ptr operation
296
- let right = self . read_scalar ( args[ 1 ] ) ?. not_undef ( ) ?. erase_tag ( ) ; // raw ptr operation
295
+ let left = self . read_scalar ( args[ 0 ] ) ?. not_undef ( ) ?;
296
+ let right = self . read_scalar ( args[ 1 ] ) ?. not_undef ( ) ?;
297
297
let n = Size :: from_bytes ( self . read_scalar ( args[ 2 ] ) ?. to_usize ( self ) ?) ;
298
298
299
299
let result = {
300
- let left_bytes = self . memory ( ) . read_bytes ( left. with_default_tag ( ) , n) ?;
301
- let right_bytes = self . memory ( ) . read_bytes ( right. with_default_tag ( ) , n) ?;
300
+ let left_bytes = self . memory ( ) . read_bytes ( left, n) ?;
301
+ let right_bytes = self . memory ( ) . read_bytes ( right, n) ?;
302
302
303
303
use std:: cmp:: Ordering :: * ;
304
304
match left_bytes. cmp ( right_bytes) {
@@ -315,8 +315,8 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
315
315
}
316
316
317
317
"memrchr" => {
318
- let ptr = self . read_scalar ( args[ 0 ] ) ?. not_undef ( ) ?. erase_tag ( ) ; // raw ptr operation
319
- let ptr = ptr. with_default_tag ( ) ;
318
+ let ptr = self . read_scalar ( args[ 0 ] ) ?. not_undef ( ) ?;
319
+ let ptr = ptr;
320
320
let val = self . read_scalar ( args[ 1 ] ) ?. to_bytes ( ) ? as u8 ;
321
321
let num = self . read_scalar ( args[ 2 ] ) ?. to_usize ( self ) ?;
322
322
if let Some ( idx) = self . memory ( ) . read_bytes ( ptr, Size :: from_bytes ( num) ) ?
@@ -330,8 +330,8 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
330
330
}
331
331
332
332
"memchr" => {
333
- let ptr = self . read_scalar ( args[ 0 ] ) ?. not_undef ( ) ?. erase_tag ( ) ; // raw ptr operation
334
- let ptr = ptr. with_default_tag ( ) ;
333
+ let ptr = self . read_scalar ( args[ 0 ] ) ?. not_undef ( ) ?;
334
+ let ptr = ptr;
335
335
let val = self . read_scalar ( args[ 1 ] ) ?. to_bytes ( ) ? as u8 ;
336
336
let num = self . read_scalar ( args[ 2 ] ) ?. to_usize ( self ) ?;
337
337
if let Some ( idx) = self . memory ( ) . read_bytes ( ptr, Size :: from_bytes ( num) ) ?. iter ( ) . position (
@@ -347,8 +347,8 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
347
347
348
348
"getenv" => {
349
349
let result = {
350
- let name_ptr = self . read_scalar ( args[ 0 ] ) ?. to_ptr ( ) ?. erase_tag ( ) ; // raw ptr operation
351
- let name = self . memory ( ) . read_c_str ( name_ptr. with_default_tag ( ) ) ?;
350
+ let name_ptr = self . read_scalar ( args[ 0 ] ) ?. to_ptr ( ) ?;
351
+ let name = self . memory ( ) . read_c_str ( name_ptr) ?;
352
352
match self . machine . env_vars . get ( name) {
353
353
Some ( & var) => Scalar :: Ptr ( var) ,
354
354
None => Scalar :: ptr_null ( & * self . tcx ) ,
@@ -360,10 +360,10 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
360
360
"unsetenv" => {
361
361
let mut success = None ;
362
362
{
363
- let name_ptr = self . read_scalar ( args[ 0 ] ) ?. not_undef ( ) ?. erase_tag ( ) ; // raw ptr operation
363
+ let name_ptr = self . read_scalar ( args[ 0 ] ) ?. not_undef ( ) ?;
364
364
if !name_ptr. is_null_ptr ( self ) {
365
365
let name = self . memory ( ) . read_c_str ( name_ptr. to_ptr ( ) ?
366
- . with_default_tag ( ) ) ?. to_owned ( ) ;
366
+ ) ?. to_owned ( ) ;
367
367
if !name. is_empty ( ) && !name. contains ( & b'=' ) {
368
368
success = Some ( self . machine . env_vars . remove ( & name) ) ;
369
369
}
@@ -382,11 +382,11 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
382
382
"setenv" => {
383
383
let mut new = None ;
384
384
{
385
- let name_ptr = self . read_scalar ( args[ 0 ] ) ?. not_undef ( ) ?. erase_tag ( ) ; // raw ptr operation
386
- let value_ptr = self . read_scalar ( args[ 1 ] ) ?. to_ptr ( ) ?. erase_tag ( ) ; // raw ptr operation
387
- let value = self . memory ( ) . read_c_str ( value_ptr. with_default_tag ( ) ) ?;
385
+ let name_ptr = self . read_scalar ( args[ 0 ] ) ?. not_undef ( ) ?;
386
+ let value_ptr = self . read_scalar ( args[ 1 ] ) ?. to_ptr ( ) ?;
387
+ let value = self . memory ( ) . read_c_str ( value_ptr) ?;
388
388
if !name_ptr. is_null_ptr ( self ) {
389
- let name = self . memory ( ) . read_c_str ( name_ptr. to_ptr ( ) ?. with_default_tag ( ) ) ?;
389
+ let name = self . memory ( ) . read_c_str ( name_ptr. to_ptr ( ) ?) ?;
390
390
if !name. is_empty ( ) && !name. contains ( & b'=' ) {
391
391
new = Some ( ( name. to_owned ( ) , value. to_owned ( ) ) ) ;
392
392
}
@@ -417,14 +417,14 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
417
417
418
418
"write" => {
419
419
let fd = self . read_scalar ( args[ 0 ] ) ?. to_bytes ( ) ?;
420
- let buf = self . read_scalar ( args[ 1 ] ) ?. not_undef ( ) ?. erase_tag ( ) ;
420
+ let buf = self . read_scalar ( args[ 1 ] ) ?. not_undef ( ) ?;
421
421
let n = self . read_scalar ( args[ 2 ] ) ?. to_bytes ( ) ? as u64 ;
422
422
trace ! ( "Called write({:?}, {:?}, {:?})" , fd, buf, n) ;
423
423
let result = if fd == 1 || fd == 2 {
424
424
// stdout/stderr
425
425
use std:: io:: { self , Write } ;
426
426
427
- let buf_cont = self . memory ( ) . read_bytes ( buf. with_default_tag ( ) , Size :: from_bytes ( n) ) ?;
427
+ let buf_cont = self . memory ( ) . read_bytes ( buf, Size :: from_bytes ( n) ) ?;
428
428
let res = if fd == 1 {
429
429
io:: stdout ( ) . write ( buf_cont)
430
430
} else {
@@ -445,8 +445,8 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
445
445
}
446
446
447
447
"strlen" => {
448
- let ptr = self . read_scalar ( args[ 0 ] ) ?. to_ptr ( ) ?. erase_tag ( ) ;
449
- let n = self . memory ( ) . read_c_str ( ptr. with_default_tag ( ) ) ?. len ( ) ;
448
+ let ptr = self . read_scalar ( args[ 0 ] ) ?. to_ptr ( ) ?;
449
+ let n = self . memory ( ) . read_c_str ( ptr) ?. len ( ) ;
450
450
self . write_scalar ( Scalar :: from_uint ( n as u64 , dest. layout . size ) , dest) ?;
451
451
}
452
452
@@ -492,7 +492,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
492
492
493
493
// Hook pthread calls that go to the thread-local storage memory subsystem
494
494
"pthread_key_create" => {
495
- let key_ptr = self . read_scalar ( args[ 0 ] ) ?. to_ptr ( ) ?. erase_tag ( ) ; // raw ptr operation
495
+ let key_ptr = self . read_scalar ( args[ 0 ] ) ?. to_ptr ( ) ?;
496
496
497
497
// Extract the function type out of the signature (that seems easier than constructing it ourselves...)
498
498
let dtor = match self . read_scalar ( args[ 1 ] ) ?. not_undef ( ) ? {
@@ -515,7 +515,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
515
515
return err ! ( OutOfTls ) ;
516
516
}
517
517
self . memory_mut ( ) . write_scalar (
518
- key_ptr. with_default_tag ( ) ,
518
+ key_ptr,
519
519
key_layout. align ,
520
520
Scalar :: from_uint ( key, key_layout. size ) . into ( ) ,
521
521
key_layout. size ,
0 commit comments