@@ -25,93 +25,93 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
25
25
26
26
let intrinsic_structure: Vec < _ > = intrinsic_name. split ( '_' ) . collect ( ) ;
27
27
28
- fn read_ord < ' tcx > ( ord : & str ) -> InterpResult < ' tcx , AtomicReadOrd > {
29
- Ok ( match ord {
28
+ fn read_ord ( ord : & str ) -> AtomicReadOrd {
29
+ match ord {
30
30
"seqcst" => AtomicReadOrd :: SeqCst ,
31
31
"acquire" => AtomicReadOrd :: Acquire ,
32
32
"relaxed" => AtomicReadOrd :: Relaxed ,
33
- _ => throw_unsup_format ! ( "unsupported read ordering `{ord}`" ) ,
34
- } )
33
+ _ => panic ! ( "invalid read ordering `{ord}`" ) ,
34
+ }
35
35
}
36
36
37
- fn write_ord < ' tcx > ( ord : & str ) -> InterpResult < ' tcx , AtomicWriteOrd > {
38
- Ok ( match ord {
37
+ fn write_ord ( ord : & str ) -> AtomicWriteOrd {
38
+ match ord {
39
39
"seqcst" => AtomicWriteOrd :: SeqCst ,
40
40
"release" => AtomicWriteOrd :: Release ,
41
41
"relaxed" => AtomicWriteOrd :: Relaxed ,
42
- _ => throw_unsup_format ! ( "unsupported write ordering `{ord}`" ) ,
43
- } )
42
+ _ => panic ! ( "invalid write ordering `{ord}`" ) ,
43
+ }
44
44
}
45
45
46
- fn rw_ord < ' tcx > ( ord : & str ) -> InterpResult < ' tcx , AtomicRwOrd > {
47
- Ok ( match ord {
46
+ fn rw_ord ( ord : & str ) -> AtomicRwOrd {
47
+ match ord {
48
48
"seqcst" => AtomicRwOrd :: SeqCst ,
49
49
"acqrel" => AtomicRwOrd :: AcqRel ,
50
50
"acquire" => AtomicRwOrd :: Acquire ,
51
51
"release" => AtomicRwOrd :: Release ,
52
52
"relaxed" => AtomicRwOrd :: Relaxed ,
53
- _ => throw_unsup_format ! ( "unsupported read-write ordering `{ord}`" ) ,
54
- } )
53
+ _ => panic ! ( "invalid read-write ordering `{ord}`" ) ,
54
+ }
55
55
}
56
56
57
- fn fence_ord < ' tcx > ( ord : & str ) -> InterpResult < ' tcx , AtomicFenceOrd > {
58
- Ok ( match ord {
57
+ fn fence_ord ( ord : & str ) -> AtomicFenceOrd {
58
+ match ord {
59
59
"seqcst" => AtomicFenceOrd :: SeqCst ,
60
60
"acqrel" => AtomicFenceOrd :: AcqRel ,
61
61
"acquire" => AtomicFenceOrd :: Acquire ,
62
62
"release" => AtomicFenceOrd :: Release ,
63
- _ => throw_unsup_format ! ( "unsupported fence ordering `{ord}`" ) ,
64
- } )
63
+ _ => panic ! ( "invalid fence ordering `{ord}`" ) ,
64
+ }
65
65
}
66
66
67
67
match & * intrinsic_structure {
68
- [ "load" , ord] => this. atomic_load ( args, dest, read_ord ( ord) ? ) ?,
69
- [ "store" , ord] => this. atomic_store ( args, write_ord ( ord) ? ) ?,
68
+ [ "load" , ord] => this. atomic_load ( args, dest, read_ord ( ord) ) ?,
69
+ [ "store" , ord] => this. atomic_store ( args, write_ord ( ord) ) ?,
70
70
71
- [ "fence" , ord] => this. atomic_fence_intrinsic ( args, fence_ord ( ord) ? ) ?,
72
- [ "singlethreadfence" , ord] => this. compiler_fence_intrinsic ( args, fence_ord ( ord) ? ) ?,
71
+ [ "fence" , ord] => this. atomic_fence_intrinsic ( args, fence_ord ( ord) ) ?,
72
+ [ "singlethreadfence" , ord] => this. compiler_fence_intrinsic ( args, fence_ord ( ord) ) ?,
73
73
74
- [ "xchg" , ord] => this. atomic_exchange ( args, dest, rw_ord ( ord) ? ) ?,
74
+ [ "xchg" , ord] => this. atomic_exchange ( args, dest, rw_ord ( ord) ) ?,
75
75
[ "cxchg" , ord1, ord2] =>
76
- this. atomic_compare_exchange ( args, dest, rw_ord ( ord1) ? , read_ord ( ord2) ? ) ?,
76
+ this. atomic_compare_exchange ( args, dest, rw_ord ( ord1) , read_ord ( ord2) ) ?,
77
77
[ "cxchgweak" , ord1, ord2] =>
78
- this. atomic_compare_exchange_weak ( args, dest, rw_ord ( ord1) ? , read_ord ( ord2) ? ) ?,
78
+ this. atomic_compare_exchange_weak ( args, dest, rw_ord ( ord1) , read_ord ( ord2) ) ?,
79
79
80
80
[ "or" , ord] =>
81
- this. atomic_rmw_op ( args, dest, AtomicOp :: MirOp ( BinOp :: BitOr , false ) , rw_ord ( ord) ? ) ?,
81
+ this. atomic_rmw_op ( args, dest, AtomicOp :: MirOp ( BinOp :: BitOr , false ) , rw_ord ( ord) ) ?,
82
82
[ "xor" , ord] =>
83
- this. atomic_rmw_op ( args, dest, AtomicOp :: MirOp ( BinOp :: BitXor , false ) , rw_ord ( ord) ? ) ?,
83
+ this. atomic_rmw_op ( args, dest, AtomicOp :: MirOp ( BinOp :: BitXor , false ) , rw_ord ( ord) ) ?,
84
84
[ "and" , ord] =>
85
- this. atomic_rmw_op ( args, dest, AtomicOp :: MirOp ( BinOp :: BitAnd , false ) , rw_ord ( ord) ? ) ?,
85
+ this. atomic_rmw_op ( args, dest, AtomicOp :: MirOp ( BinOp :: BitAnd , false ) , rw_ord ( ord) ) ?,
86
86
[ "nand" , ord] =>
87
- this. atomic_rmw_op ( args, dest, AtomicOp :: MirOp ( BinOp :: BitAnd , true ) , rw_ord ( ord) ? ) ?,
87
+ this. atomic_rmw_op ( args, dest, AtomicOp :: MirOp ( BinOp :: BitAnd , true ) , rw_ord ( ord) ) ?,
88
88
[ "xadd" , ord] =>
89
- this. atomic_rmw_op ( args, dest, AtomicOp :: MirOp ( BinOp :: Add , false ) , rw_ord ( ord) ? ) ?,
89
+ this. atomic_rmw_op ( args, dest, AtomicOp :: MirOp ( BinOp :: Add , false ) , rw_ord ( ord) ) ?,
90
90
[ "xsub" , ord] =>
91
- this. atomic_rmw_op ( args, dest, AtomicOp :: MirOp ( BinOp :: Sub , false ) , rw_ord ( ord) ? ) ?,
91
+ this. atomic_rmw_op ( args, dest, AtomicOp :: MirOp ( BinOp :: Sub , false ) , rw_ord ( ord) ) ?,
92
92
[ "min" , ord] => {
93
93
// Later we will use the type to indicate signed vs unsigned,
94
94
// so make sure it matches the intrinsic name.
95
95
assert ! ( matches!( args[ 1 ] . layout. ty. kind( ) , ty:: Int ( _) ) ) ;
96
- this. atomic_rmw_op ( args, dest, AtomicOp :: Min , rw_ord ( ord) ? ) ?;
96
+ this. atomic_rmw_op ( args, dest, AtomicOp :: Min , rw_ord ( ord) ) ?;
97
97
}
98
98
[ "umin" , ord] => {
99
99
// Later we will use the type to indicate signed vs unsigned,
100
100
// so make sure it matches the intrinsic name.
101
101
assert ! ( matches!( args[ 1 ] . layout. ty. kind( ) , ty:: Uint ( _) ) ) ;
102
- this. atomic_rmw_op ( args, dest, AtomicOp :: Min , rw_ord ( ord) ? ) ?;
102
+ this. atomic_rmw_op ( args, dest, AtomicOp :: Min , rw_ord ( ord) ) ?;
103
103
}
104
104
[ "max" , ord] => {
105
105
// Later we will use the type to indicate signed vs unsigned,
106
106
// so make sure it matches the intrinsic name.
107
107
assert ! ( matches!( args[ 1 ] . layout. ty. kind( ) , ty:: Int ( _) ) ) ;
108
- this. atomic_rmw_op ( args, dest, AtomicOp :: Max , rw_ord ( ord) ? ) ?;
108
+ this. atomic_rmw_op ( args, dest, AtomicOp :: Max , rw_ord ( ord) ) ?;
109
109
}
110
110
[ "umax" , ord] => {
111
111
// Later we will use the type to indicate signed vs unsigned,
112
112
// so make sure it matches the intrinsic name.
113
113
assert ! ( matches!( args[ 1 ] . layout. ty. kind( ) , ty:: Uint ( _) ) ) ;
114
- this. atomic_rmw_op ( args, dest, AtomicOp :: Max , rw_ord ( ord) ? ) ?;
114
+ this. atomic_rmw_op ( args, dest, AtomicOp :: Max , rw_ord ( ord) ) ?;
115
115
}
116
116
117
117
_ => return Ok ( EmulateItemResult :: NotSupported ) ,
0 commit comments