1
1
use rustc_middle:: mir;
2
2
use rustc_target:: spec:: abi:: Abi ;
3
3
4
- use log:: trace;
5
-
6
4
use crate :: * ;
7
- use helpers:: { check_abi, check_arg_count} ;
8
- use shims:: windows:: sync:: EvalContextExt as _;
5
+ use helpers:: check_abi;
9
6
10
7
#[ derive( Debug , Copy , Clone ) ]
11
8
pub enum Dlsym {
12
- AcquireSRWLockExclusive ,
13
- ReleaseSRWLockExclusive ,
14
- TryAcquireSRWLockExclusive ,
15
- AcquireSRWLockShared ,
16
- ReleaseSRWLockShared ,
17
- TryAcquireSRWLockShared ,
18
9
}
19
10
20
11
impl Dlsym {
21
12
// Returns an error for unsupported symbols, and None if this symbol
22
13
// should become a NULL pointer (pretend it does not exist).
23
14
pub fn from_str ( name : & str ) -> InterpResult < ' static , Option < Dlsym > > {
24
15
Ok ( match name {
25
- "AcquireSRWLockExclusive" => Some ( Dlsym :: AcquireSRWLockExclusive ) ,
26
- "ReleaseSRWLockExclusive" => Some ( Dlsym :: ReleaseSRWLockExclusive ) ,
27
- "TryAcquireSRWLockExclusive" => Some ( Dlsym :: TryAcquireSRWLockExclusive ) ,
28
- "AcquireSRWLockShared" => Some ( Dlsym :: AcquireSRWLockShared ) ,
29
- "ReleaseSRWLockShared" => Some ( Dlsym :: ReleaseSRWLockShared ) ,
30
- "TryAcquireSRWLockShared" => Some ( Dlsym :: TryAcquireSRWLockShared ) ,
31
16
"GetSystemTimePreciseAsFileTime" => None ,
32
17
_ => throw_unsup_format ! ( "unsupported Windows dlsym: {}" , name) ,
33
18
} )
@@ -40,46 +25,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
40
25
& mut self ,
41
26
dlsym : Dlsym ,
42
27
abi : Abi ,
43
- args : & [ OpTy < ' tcx , Tag > ] ,
28
+ _args : & [ OpTy < ' tcx , Tag > ] ,
44
29
ret : Option < ( PlaceTy < ' tcx , Tag > , mir:: BasicBlock ) > ,
45
30
) -> InterpResult < ' tcx > {
46
31
let this = self . eval_context_mut ( ) ;
47
- let ( dest , ret ) = ret. expect ( "we don't support any diverging dlsym" ) ;
32
+ let ( _dest , _ret ) = ret. expect ( "we don't support any diverging dlsym" ) ;
48
33
assert ! ( this. tcx. sess. target. os == "windows" ) ;
49
34
50
35
check_abi ( abi, Abi :: System ) ?;
51
36
52
- match dlsym {
53
- Dlsym :: AcquireSRWLockExclusive => {
54
- let & [ ptr] = check_arg_count ( args) ?;
55
- this. AcquireSRWLockExclusive ( ptr) ?;
56
- }
57
- Dlsym :: ReleaseSRWLockExclusive => {
58
- let & [ ptr] = check_arg_count ( args) ?;
59
- this. ReleaseSRWLockExclusive ( ptr) ?;
60
- }
61
- Dlsym :: TryAcquireSRWLockExclusive => {
62
- let & [ ptr] = check_arg_count ( args) ?;
63
- let ret = this. TryAcquireSRWLockExclusive ( ptr) ?;
64
- this. write_scalar ( Scalar :: from_u8 ( ret) , dest) ?;
65
- }
66
- Dlsym :: AcquireSRWLockShared => {
67
- let & [ ptr] = check_arg_count ( args) ?;
68
- this. AcquireSRWLockShared ( ptr) ?;
69
- }
70
- Dlsym :: ReleaseSRWLockShared => {
71
- let & [ ptr] = check_arg_count ( args) ?;
72
- this. ReleaseSRWLockShared ( ptr) ?;
73
- }
74
- Dlsym :: TryAcquireSRWLockShared => {
75
- let & [ ptr] = check_arg_count ( args) ?;
76
- let ret = this. TryAcquireSRWLockShared ( ptr) ?;
77
- this. write_scalar ( Scalar :: from_u8 ( ret) , dest) ?;
78
- }
79
- }
80
-
81
- trace ! ( "{:?}" , this. dump_place( * dest) ) ;
82
- this. go_to_block ( ret) ;
83
- Ok ( ( ) )
37
+ match dlsym { }
84
38
}
85
39
}
0 commit comments