@@ -31,7 +31,8 @@ fn mutexattr_get_kind<'mir, 'tcx: 'mir>(
31
31
// Ensure that the following read at an offset to the attr pointer is within bounds
32
32
assert_ptr_target_min_size ( ecx, attr_op, 4 ) ?;
33
33
let attr_place = ecx. deref_operand ( attr_op) ?;
34
- let kind_place = attr_place. offset ( Size :: ZERO , MemPlaceMeta :: None , ecx. i32_layout ( ) ?, ecx) ?;
34
+ let kind_place =
35
+ attr_place. offset ( Size :: ZERO , MemPlaceMeta :: None , ecx. machine . layouts . i32 , ecx) ?;
35
36
ecx. read_scalar ( kind_place. into ( ) )
36
37
}
37
38
@@ -43,7 +44,8 @@ fn mutexattr_set_kind<'mir, 'tcx: 'mir>(
43
44
// Ensure that the following write at an offset to the attr pointer is within bounds
44
45
assert_ptr_target_min_size ( ecx, attr_op, 4 ) ?;
45
46
let attr_place = ecx. deref_operand ( attr_op) ?;
46
- let kind_place = attr_place. offset ( Size :: ZERO , MemPlaceMeta :: None , ecx. i32_layout ( ) ?, ecx) ?;
47
+ let kind_place =
48
+ attr_place. offset ( Size :: ZERO , MemPlaceMeta :: None , ecx. machine . layouts . i32 , ecx) ?;
47
49
ecx. write_scalar ( kind. into ( ) , kind_place. into ( ) )
48
50
}
49
51
@@ -63,8 +65,12 @@ fn mutex_get_locked_count<'mir, 'tcx: 'mir>(
63
65
// Ensure that the following read at an offset to the mutex pointer is within bounds
64
66
assert_ptr_target_min_size ( ecx, mutex_op, 20 ) ?;
65
67
let mutex_place = ecx. deref_operand ( mutex_op) ?;
66
- let locked_count_place =
67
- mutex_place. offset ( Size :: from_bytes ( 4 ) , MemPlaceMeta :: None , ecx. u32_layout ( ) ?, ecx) ?;
68
+ let locked_count_place = mutex_place. offset (
69
+ Size :: from_bytes ( 4 ) ,
70
+ MemPlaceMeta :: None ,
71
+ ecx. machine . layouts . u32 ,
72
+ ecx,
73
+ ) ?;
68
74
ecx. read_scalar ( locked_count_place. into ( ) )
69
75
}
70
76
@@ -76,8 +82,12 @@ fn mutex_set_locked_count<'mir, 'tcx: 'mir>(
76
82
// Ensure that the following write at an offset to the mutex pointer is within bounds
77
83
assert_ptr_target_min_size ( ecx, mutex_op, 20 ) ?;
78
84
let mutex_place = ecx. deref_operand ( mutex_op) ?;
79
- let locked_count_place =
80
- mutex_place. offset ( Size :: from_bytes ( 4 ) , MemPlaceMeta :: None , ecx. u32_layout ( ) ?, ecx) ?;
85
+ let locked_count_place = mutex_place. offset (
86
+ Size :: from_bytes ( 4 ) ,
87
+ MemPlaceMeta :: None ,
88
+ ecx. machine . layouts . u32 ,
89
+ ecx,
90
+ ) ?;
81
91
ecx. write_scalar ( locked_count. into ( ) , locked_count_place. into ( ) )
82
92
}
83
93
@@ -92,7 +102,7 @@ fn mutex_get_kind<'mir, 'tcx: 'mir>(
92
102
let kind_place = mutex_place. offset (
93
103
Size :: from_bytes ( kind_offset) ,
94
104
MemPlaceMeta :: None ,
95
- ecx. i32_layout ( ) ? ,
105
+ ecx. machine . layouts . i32 ,
96
106
ecx,
97
107
) ?;
98
108
ecx. read_scalar ( kind_place. into ( ) )
@@ -110,7 +120,7 @@ fn mutex_set_kind<'mir, 'tcx: 'mir>(
110
120
let kind_place = mutex_place. offset (
111
121
Size :: from_bytes ( kind_offset) ,
112
122
MemPlaceMeta :: None ,
113
- ecx. i32_layout ( ) ? ,
123
+ ecx. machine . layouts . i32 ,
114
124
ecx,
115
125
) ?;
116
126
ecx. write_scalar ( kind. into ( ) , kind_place. into ( ) )
@@ -131,8 +141,12 @@ fn rwlock_get_readers<'mir, 'tcx: 'mir>(
131
141
// Ensure that the following read at an offset to the rwlock pointer is within bounds
132
142
assert_ptr_target_min_size ( ecx, rwlock_op, 12 ) ?;
133
143
let rwlock_place = ecx. deref_operand ( rwlock_op) ?;
134
- let readers_place =
135
- rwlock_place. offset ( Size :: from_bytes ( 4 ) , MemPlaceMeta :: None , ecx. u32_layout ( ) ?, ecx) ?;
144
+ let readers_place = rwlock_place. offset (
145
+ Size :: from_bytes ( 4 ) ,
146
+ MemPlaceMeta :: None ,
147
+ ecx. machine . layouts . u32 ,
148
+ ecx,
149
+ ) ?;
136
150
ecx. read_scalar ( readers_place. into ( ) )
137
151
}
138
152
@@ -144,8 +158,12 @@ fn rwlock_set_readers<'mir, 'tcx: 'mir>(
144
158
// Ensure that the following write at an offset to the rwlock pointer is within bounds
145
159
assert_ptr_target_min_size ( ecx, rwlock_op, 12 ) ?;
146
160
let rwlock_place = ecx. deref_operand ( rwlock_op) ?;
147
- let readers_place =
148
- rwlock_place. offset ( Size :: from_bytes ( 4 ) , MemPlaceMeta :: None , ecx. u32_layout ( ) ?, ecx) ?;
161
+ let readers_place = rwlock_place. offset (
162
+ Size :: from_bytes ( 4 ) ,
163
+ MemPlaceMeta :: None ,
164
+ ecx. machine . layouts . u32 ,
165
+ ecx,
166
+ ) ?;
149
167
ecx. write_scalar ( readers. into ( ) , readers_place. into ( ) )
150
168
}
151
169
@@ -156,8 +174,12 @@ fn rwlock_get_writers<'mir, 'tcx: 'mir>(
156
174
// Ensure that the following read at an offset to the rwlock pointer is within bounds
157
175
assert_ptr_target_min_size ( ecx, rwlock_op, 12 ) ?;
158
176
let rwlock_place = ecx. deref_operand ( rwlock_op) ?;
159
- let writers_place =
160
- rwlock_place. offset ( Size :: from_bytes ( 8 ) , MemPlaceMeta :: None , ecx. u32_layout ( ) ?, ecx) ?;
177
+ let writers_place = rwlock_place. offset (
178
+ Size :: from_bytes ( 8 ) ,
179
+ MemPlaceMeta :: None ,
180
+ ecx. machine . layouts . u32 ,
181
+ ecx,
182
+ ) ?;
161
183
ecx. read_scalar ( writers_place. into ( ) )
162
184
}
163
185
@@ -169,8 +191,12 @@ fn rwlock_set_writers<'mir, 'tcx: 'mir>(
169
191
// Ensure that the following write at an offset to the rwlock pointer is within bounds
170
192
assert_ptr_target_min_size ( ecx, rwlock_op, 12 ) ?;
171
193
let rwlock_place = ecx. deref_operand ( rwlock_op) ?;
172
- let writers_place =
173
- rwlock_place. offset ( Size :: from_bytes ( 8 ) , MemPlaceMeta :: None , ecx. u32_layout ( ) ?, ecx) ?;
194
+ let writers_place = rwlock_place. offset (
195
+ Size :: from_bytes ( 8 ) ,
196
+ MemPlaceMeta :: None ,
197
+ ecx. machine . layouts . u32 ,
198
+ ecx,
199
+ ) ?;
174
200
ecx. write_scalar ( writers. into ( ) , writers_place. into ( ) )
175
201
}
176
202
0 commit comments