@@ -156,13 +156,13 @@ pub unsafe fn record_rust_managed_stack_bounds(stack_lo: uint, stack_hi: uint) {
156
156
#[ cfg( not( windows) ) ] #[ inline( always) ]
157
157
unsafe fn target_record_stack_bounds ( _stack_lo : uint , _stack_hi : uint ) { }
158
158
159
- #[ cfg( windows, target_arch = "x86" ) ] #[ inline( always) ]
159
+ #[ cfg( all ( windows, target_arch = "x86" ) ) ] #[ inline( always) ]
160
160
unsafe fn target_record_stack_bounds ( stack_lo : uint , stack_hi : uint ) {
161
161
// stack range is at TIB: %fs:0x04 (top) and %fs:0x08 (bottom)
162
162
asm ! ( "mov $0, %fs:0x04" :: "r" ( stack_hi) :: "volatile" ) ;
163
163
asm ! ( "mov $0, %fs:0x08" :: "r" ( stack_lo) :: "volatile" ) ;
164
164
}
165
- #[ cfg( windows, target_arch = "x86_64" ) ] #[ inline( always) ]
165
+ #[ cfg( all ( windows, target_arch = "x86_64" ) ) ] #[ inline( always) ]
166
166
unsafe fn target_record_stack_bounds ( stack_lo : uint , stack_hi : uint ) {
167
167
// stack range is at TIB: %gs:0x08 (top) and %gs:0x10 (bottom)
168
168
asm ! ( "mov $0, %gs:0x08" :: "r" ( stack_hi) :: "volatile" ) ;
@@ -189,49 +189,53 @@ pub unsafe fn record_sp_limit(limit: uint) {
189
189
return target_record_sp_limit ( limit) ;
190
190
191
191
// x86-64
192
- #[ cfg( target_arch = "x86_64" , target_os = "macos" ) ]
193
- #[ cfg( target_arch = "x86_64" , target_os = "ios" ) ] #[ inline( always) ]
192
+ #[ cfg( all( target_arch = "x86_64" ,
193
+ any( target_os = "macos" , target_os = "ios" ) ) ) ]
194
+ #[ inline( always) ]
194
195
unsafe fn target_record_sp_limit ( limit : uint ) {
195
196
asm ! ( "movq $$0x60+90*8, %rsi
196
197
movq $0, %gs:(%rsi)" :: "r" ( limit) : "rsi" : "volatile" )
197
198
}
198
- #[ cfg( target_arch = "x86_64" , target_os = "linux" ) ] #[ inline( always) ]
199
+ #[ cfg( all ( target_arch = "x86_64" , target_os = "linux" ) ) ] #[ inline( always) ]
199
200
unsafe fn target_record_sp_limit ( limit : uint ) {
200
201
asm ! ( "movq $0, %fs:112" :: "r" ( limit) :: "volatile" )
201
202
}
202
- #[ cfg( target_arch = "x86_64" , target_os = "windows" ) ] #[ inline( always) ]
203
+ #[ cfg( all ( target_arch = "x86_64" , target_os = "windows" ) ) ] #[ inline( always) ]
203
204
unsafe fn target_record_sp_limit ( _: uint ) {
204
205
}
205
- #[ cfg( target_arch = "x86_64" , target_os = "freebsd" ) ] #[ inline( always) ]
206
+ #[ cfg( all ( target_arch = "x86_64" , target_os = "freebsd" ) ) ] #[ inline( always) ]
206
207
unsafe fn target_record_sp_limit ( limit : uint ) {
207
208
asm ! ( "movq $0, %fs:24" :: "r" ( limit) :: "volatile" )
208
209
}
209
- #[ cfg( target_arch = "x86_64" , target_os = "dragonfly" ) ] #[ inline( always) ]
210
+ #[ cfg( all ( target_arch = "x86_64" , target_os = "dragonfly" ) ) ] #[ inline( always) ]
210
211
unsafe fn target_record_sp_limit ( limit : uint ) {
211
212
asm ! ( "movq $0, %fs:32" :: "r" ( limit) :: "volatile" )
212
213
}
213
214
214
215
// x86
215
- #[ cfg( target_arch = "x86" , target_os = "macos" ) ]
216
- #[ cfg( target_arch = "x86" , target_os = "ios" ) ] #[ inline( always) ]
216
+ #[ cfg( all( target_arch = "x86" ,
217
+ any( target_os = "macos" , target_os = "ios" ) ) ) ]
218
+ #[ inline( always) ]
217
219
unsafe fn target_record_sp_limit ( limit : uint ) {
218
220
asm ! ( "movl $$0x48+90*4, %eax
219
221
movl $0, %gs:(%eax)" :: "r" ( limit) : "eax" : "volatile" )
220
222
}
221
- #[ cfg( target_arch = "x86" , target_os = "linux" ) ]
222
- #[ cfg( target_arch = "x86" , target_os = "freebsd" ) ] #[ inline( always) ]
223
+ #[ cfg( all( target_arch = "x86" ,
224
+ any( target_os = "linux" , target_os = "freebsd" ) ) ) ]
225
+ #[ inline( always) ]
223
226
unsafe fn target_record_sp_limit ( limit : uint ) {
224
227
asm ! ( "movl $0, %gs:48" :: "r" ( limit) :: "volatile" )
225
228
}
226
- #[ cfg( target_arch = "x86" , target_os = "windows" ) ] #[ inline( always) ]
229
+ #[ cfg( all ( target_arch = "x86" , target_os = "windows" ) ) ] #[ inline( always) ]
227
230
unsafe fn target_record_sp_limit ( _: uint ) {
228
231
}
229
232
230
233
// mips, arm - Some brave soul can port these to inline asm, but it's over
231
234
// my head personally
232
- #[ cfg( target_arch = "mips" ) ]
233
- #[ cfg( target_arch = "mipsel" ) ]
234
- #[ cfg( target_arch = "arm" , not( target_os = "ios" ) ) ] #[ inline( always) ]
235
+ #[ cfg( any( target_arch = "mips" ,
236
+ target_arch = "mipsel" ,
237
+ all( target_arch = "arm" , not( target_os = "ios" ) ) ) ) ]
238
+ #[ inline( always) ]
235
239
unsafe fn target_record_sp_limit ( limit : uint ) {
236
240
use libc:: c_void;
237
241
return record_sp_limit ( limit as * const c_void ) ;
@@ -241,7 +245,7 @@ pub unsafe fn record_sp_limit(limit: uint) {
241
245
}
242
246
243
247
// iOS segmented stack is disabled for now, see related notes
244
- #[ cfg( target_arch = "arm" , target_os = "ios" ) ] #[ inline( always) ]
248
+ #[ cfg( all ( target_arch = "arm" , target_os = "ios" ) ) ] #[ inline( always) ]
245
249
unsafe fn target_record_sp_limit ( _: uint ) {
246
250
}
247
251
}
@@ -259,31 +263,32 @@ pub unsafe fn get_sp_limit() -> uint {
259
263
return target_get_sp_limit ( ) ;
260
264
261
265
// x86-64
262
- #[ cfg( target_arch = "x86_64" , target_os = "macos" ) ]
263
- #[ cfg( target_arch = "x86_64" , target_os = "ios" ) ] #[ inline( always) ]
266
+ #[ cfg( all( target_arch = "x86_64" ,
267
+ any( target_os = "macos" , target_os = "ios" ) ) ) ]
268
+ #[ inline( always) ]
264
269
unsafe fn target_get_sp_limit ( ) -> uint {
265
270
let limit;
266
271
asm ! ( "movq $$0x60+90*8, %rsi
267
272
movq %gs:(%rsi), $0" : "=r" ( limit) :: "rsi" : "volatile" ) ;
268
273
return limit;
269
274
}
270
- #[ cfg( target_arch = "x86_64" , target_os = "linux" ) ] #[ inline( always) ]
275
+ #[ cfg( all ( target_arch = "x86_64" , target_os = "linux" ) ) ] #[ inline( always) ]
271
276
unsafe fn target_get_sp_limit ( ) -> uint {
272
277
let limit;
273
278
asm ! ( "movq %fs:112, $0" : "=r" ( limit) :: : "volatile" ) ;
274
279
return limit;
275
280
}
276
- #[ cfg( target_arch = "x86_64" , target_os = "windows" ) ] #[ inline( always) ]
281
+ #[ cfg( all ( target_arch = "x86_64" , target_os = "windows" ) ) ] #[ inline( always) ]
277
282
unsafe fn target_get_sp_limit ( ) -> uint {
278
283
return 1024 ;
279
284
}
280
- #[ cfg( target_arch = "x86_64" , target_os = "freebsd" ) ] #[ inline( always) ]
285
+ #[ cfg( all ( target_arch = "x86_64" , target_os = "freebsd" ) ) ] #[ inline( always) ]
281
286
unsafe fn target_get_sp_limit ( ) -> uint {
282
287
let limit;
283
288
asm ! ( "movq %fs:24, $0" : "=r" ( limit) :: : "volatile" ) ;
284
289
return limit;
285
290
}
286
- #[ cfg( target_arch = "x86_64" , target_os = "dragonfly" ) ] #[ inline( always) ]
291
+ #[ cfg( all ( target_arch = "x86_64" , target_os = "dragonfly" ) ) ] #[ inline( always) ]
287
292
unsafe fn target_get_sp_limit ( ) -> uint {
288
293
let limit;
289
294
asm ! ( "movq %fs:32, $0" : "=r" ( limit) :: : "volatile" ) ;
@@ -292,31 +297,34 @@ pub unsafe fn get_sp_limit() -> uint {
292
297
293
298
294
299
// x86
295
- #[ cfg( target_arch = "x86" , target_os = "macos" ) ]
296
- #[ cfg( target_arch = "x86" , target_os = "ios" ) ] #[ inline( always) ]
300
+ #[ cfg( all( target_arch = "x86" ,
301
+ any( target_os = "macos" , target_os = "ios" ) ) ) ]
302
+ #[ inline( always) ]
297
303
unsafe fn target_get_sp_limit ( ) -> uint {
298
304
let limit;
299
305
asm ! ( "movl $$0x48+90*4, %eax
300
306
movl %gs:(%eax), $0" : "=r" ( limit) :: "eax" : "volatile" ) ;
301
307
return limit;
302
308
}
303
- #[ cfg( target_arch = "x86" , target_os = "linux" ) ]
304
- #[ cfg( target_arch = "x86" , target_os = "freebsd" ) ] #[ inline( always) ]
309
+ #[ cfg( all( target_arch = "x86" ,
310
+ any( target_os = "linux" , target_os = "freebsd" ) ) ) ]
311
+ #[ inline( always) ]
305
312
unsafe fn target_get_sp_limit ( ) -> uint {
306
313
let limit;
307
314
asm ! ( "movl %gs:48, $0" : "=r" ( limit) :: : "volatile" ) ;
308
315
return limit;
309
316
}
310
- #[ cfg( target_arch = "x86" , target_os = "windows" ) ] #[ inline( always) ]
317
+ #[ cfg( all ( target_arch = "x86" , target_os = "windows" ) ) ] #[ inline( always) ]
311
318
unsafe fn target_get_sp_limit ( ) -> uint {
312
319
return 1024 ;
313
320
}
314
321
315
322
// mips, arm - Some brave soul can port these to inline asm, but it's over
316
323
// my head personally
317
- #[ cfg( target_arch = "mips" ) ]
318
- #[ cfg( target_arch = "mipsel" ) ]
319
- #[ cfg( target_arch = "arm" , not( target_os = "ios" ) ) ] #[ inline( always) ]
324
+ #[ cfg( any( target_arch = "mips" ,
325
+ target_arch = "mipsel" ,
326
+ all( target_arch = "arm" , not( target_os = "ios" ) ) ) ) ]
327
+ #[ inline( always) ]
320
328
unsafe fn target_get_sp_limit ( ) -> uint {
321
329
use libc:: c_void;
322
330
return get_sp_limit ( ) as uint ;
@@ -328,7 +336,7 @@ pub unsafe fn get_sp_limit() -> uint {
328
336
// iOS doesn't support segmented stacks yet. This function might
329
337
// be called by runtime though so it is unsafe to mark it as
330
338
// unreachable, let's return a fixed constant.
331
- #[ cfg( target_arch = "arm" , target_os = "ios" ) ] #[ inline( always) ]
339
+ #[ cfg( all ( target_arch = "arm" , target_os = "ios" ) ) ] #[ inline( always) ]
332
340
unsafe fn target_get_sp_limit ( ) -> uint {
333
341
1024
334
342
}
0 commit comments