@@ -256,7 +256,7 @@ Memory allocation minimum alignment for instances of this type.
256
256
Can be called on any `isconcretetype`.
257
257
"""
258
258
function datatype_alignment (dt:: DataType )
259
- @_pure_meta
259
+ @_unsafe_pure_meta
260
260
dt. layout == C_NULL && throw (UndefRefError ())
261
261
alignment = unsafe_load (convert (Ptr{DataTypeLayout}, dt. layout)). alignment
262
262
return Int (alignment & 0x1FF )
@@ -270,7 +270,7 @@ with no intervening padding bytes.
270
270
Can be called on any `isconcretetype`.
271
271
"""
272
272
function datatype_haspadding (dt:: DataType )
273
- @_pure_meta
273
+ @_unsafe_pure_meta
274
274
dt. layout == C_NULL && throw (UndefRefError ())
275
275
alignment = unsafe_load (convert (Ptr{DataTypeLayout}, dt. layout)). alignment
276
276
return (alignment >> 9 ) & 1 == 1
@@ -283,7 +283,7 @@ Return whether instances of this type can contain references to gc-managed memor
283
283
Can be called on any `isconcretetype`.
284
284
"""
285
285
function datatype_pointerfree (dt:: DataType )
286
- @_pure_meta
286
+ @_unsafe_pure_meta
287
287
dt. layout == C_NULL && throw (UndefRefError ())
288
288
alignment = unsafe_load (convert (Ptr{DataTypeLayout}, dt. layout)). alignment
289
289
return (alignment >> 10 ) & 0xFFFFF == 0
@@ -299,7 +299,7 @@ Can be called on any `isconcretetype`.
299
299
See also [`Base.fieldoffset`](@ref).
300
300
"""
301
301
function datatype_fielddesc_type (dt:: DataType )
302
- @_pure_meta
302
+ @_unsafe_pure_meta
303
303
dt. layout == C_NULL && throw (UndefRefError ())
304
304
alignment = unsafe_load (convert (Ptr{DataTypeLayout}, dt. layout)). alignment
305
305
return (alignment >> 30 ) & 3
@@ -321,7 +321,7 @@ julia> isimmutable([1,2])
321
321
false
322
322
```
323
323
"""
324
- isimmutable (@nospecialize (x)) = (@_pure_meta ; ! typeof (x). mutable)
324
+ isimmutable (@nospecialize (x)) = (@_unsafe_pure_meta ; ! typeof (x). mutable)
325
325
326
326
"""
327
327
Base.isstructtype(T) -> Bool
@@ -330,7 +330,7 @@ Determine whether type `T` was declared as a struct type
330
330
(i.e. using the `struct` or `mutable struct` keyword).
331
331
"""
332
332
function isstructtype (@nospecialize (t:: Type ))
333
- @_pure_meta
333
+ @_unsafe_pure_meta
334
334
t = unwrap_unionall (t)
335
335
# TODO : what to do for `Union`?
336
336
isa (t, DataType) || return false
@@ -344,7 +344,7 @@ Determine whether type `T` was declared as a primitive type
344
344
(i.e. using the `primitive` keyword).
345
345
"""
346
346
function isprimitivetype (@nospecialize (t:: Type ))
347
- @_pure_meta
347
+ @_unsafe_pure_meta
348
348
t = unwrap_unionall (t)
349
349
# TODO : what to do for `Union`?
350
350
isa (t, DataType) || return false
@@ -372,14 +372,14 @@ julia> isbitstype(Complex)
372
372
false
373
373
```
374
374
"""
375
- isbitstype (@nospecialize (t:: Type )) = (@_pure_meta ; isa (t, DataType) && t. isbitstype)
375
+ isbitstype (@nospecialize (t:: Type )) = (@_unsafe_pure_meta ; isa (t, DataType) && t. isbitstype)
376
376
377
377
"""
378
378
isbits(x)
379
379
380
380
Return `true` if `x` is an instance of an `isbitstype` type.
381
381
"""
382
- isbits (@nospecialize x) = (@_pure_meta ; typeof (x). isbitstype)
382
+ isbits (@nospecialize x) = (@_unsafe_pure_meta ; typeof (x). isbitstype)
383
383
384
384
"""
385
385
isdispatchtuple(T)
@@ -388,7 +388,7 @@ Determine whether type `T` is a tuple "leaf type",
388
388
meaning it could appear as a type signature in dispatch
389
389
and has no subtypes (or supertypes) which could appear in a call.
390
390
"""
391
- isdispatchtuple (@nospecialize (t)) = (@_pure_meta ; isa (t, DataType) && t. isdispatchtuple)
391
+ isdispatchtuple (@nospecialize (t)) = (@_unsafe_pure_meta ; isa (t, DataType) && t. isdispatchtuple)
392
392
393
393
"""
394
394
isconcretetype(T)
@@ -417,7 +417,7 @@ julia> isconcretetype(Union{Int,String})
417
417
false
418
418
```
419
419
"""
420
- isconcretetype (@nospecialize (t)) = (@_pure_meta ; isa (t, DataType) && t. isconcretetype)
420
+ isconcretetype (@nospecialize (t)) = (@_unsafe_pure_meta ; isa (t, DataType) && t. isconcretetype)
421
421
422
422
"""
423
423
Base.isabstracttype(T)
@@ -435,7 +435,7 @@ false
435
435
```
436
436
"""
437
437
function isabstracttype (@nospecialize (t))
438
- @_pure_meta
438
+ @_unsafe_pure_meta
439
439
t = unwrap_unionall (t)
440
440
# TODO : what to do for `Union`?
441
441
return isa (t, DataType) && t. abstract
462
462
```
463
463
"""
464
464
function parameter_upper_bound (t:: UnionAll , idx)
465
- @_pure_meta
465
+ @_unsafe_pure_meta
466
466
return rewrap_unionall ((unwrap_unionall (t):: DataType ). parameters[idx], t)
467
467
end
468
468
472
472
Compute a type that contains the intersection of `T` and `S`. Usually this will be the
473
473
smallest such type or one close to it.
474
474
"""
475
- typeintersect (@nospecialize (a),@nospecialize (b)) = (@_pure_meta ; ccall (:jl_type_intersection , Any, (Any,Any), a, b))
475
+ typeintersect (@nospecialize (a),@nospecialize (b)) = (@_unsafe_pure_meta ; ccall (:jl_type_intersection , Any, (Any,Any), a, b))
476
476
477
477
"""
478
478
fieldoffset(type, i)
@@ -499,7 +499,7 @@ julia> structinfo(Base.Filesystem.StatStruct)
499
499
(0x0000000000000058, :ctime, Float64)
500
500
```
501
501
"""
502
- fieldoffset (x:: DataType , idx:: Integer ) = (@_pure_meta ; ccall (:jl_get_field_offset , Csize_t, (Any, Cint), x, idx))
502
+ fieldoffset (x:: DataType , idx:: Integer ) = (@_unsafe_pure_meta ; ccall (:jl_get_field_offset , Csize_t, (Any, Cint), x, idx))
503
503
504
504
"""
505
505
fieldtype(T, name::Symbol | index::Int)
@@ -611,7 +611,7 @@ julia> instances(Color)
611
611
function instances end
612
612
613
613
function to_tuple_type (@nospecialize (t))
614
- @_pure_meta
614
+ @_unsafe_pure_meta
615
615
if isa (t,Tuple) || isa (t,AbstractArray) || isa (t,SimpleVector)
616
616
t = Tuple{t... }
617
617
end
0 commit comments