You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
avoid type-specialization in show-default (#37591)
Refs #37582
Fixes the data pointer for conversion of Ref{Any} to Ptr{Cvoid} to point
at the data, instead of the pointer. Then use that in show_default to
avoid specializing the Ref(Value) types of each input (causing poor
inference of unsafe_convert later).
|`void` and `[[noreturn]]` or `_Noreturn`|||`Union{}`|
384
-
|`void*`|||`Ptr{Cvoid}`|
385
-
|`T*` (where T represents an appropriately defined type) |||`Ref{T}`|
386
-
|`char*` (or `char[]`, e.g. a string) |`CHARACTER*N`||`Cstring` if NUL-terminated, or `Ptr{UInt8}` if not |
387
-
|`char**` (or `*char[]`) |||`Ptr{Ptr{UInt8}}`|
388
-
|`jl_value_t*` (any Julia Type) |||`Any`|
389
-
|`jl_value_t**` (a reference to a Julia Type) |||`Ref{Any}`|
390
-
|`va_arg`||| Not supported |
391
-
|`...` (variadic function specification) |||`T...` (where `T` is one of the above types, variadic functions of different argument types are not supported) |
379
+
|`ptrdiff_t`||`Cptrdiff_t`|`Int`|
380
+
|`ssize_t`||`Cssize_t`|`Int`|
381
+
|`size_t`||`Csize_t`|`UInt`|
382
+
|`void`|||`Cvoid`|
383
+
|`void` and `[[noreturn]]` or `_Noreturn`|||`Union{}`|
|`T*` (where T represents an appropriately defined type) |||`Ref{T}` (T may be safely mutated only if T is an isbits type) |
386
+
|`char*` (or `char[]`, e.g. a string) |`CHARACTER*N`||`Cstring` if NUL-terminated, or `Ptr{UInt8}` if not |
387
+
|`char**` (or `*char[]`) |||`Ptr{Ptr{UInt8}}`|
388
+
|`jl_value_t*` (any Julia Type) |||`Any`|
389
+
|`jl_value_t* const*` (a reference to a Julia value) |||`Ref{Any}` (const, since mutation would require a write barrier, which is not possible to insert correctly) |
390
+
|`va_arg`||| Not supported |
391
+
|`...` (variadic function specification) |||`T...` (where `T` is one of the above types, when using the `ccall` function) |
392
+
|`...` (variadic function specification) |||`; va_arg1::T, va_arg2::S, etc.` (only supported with `@ccall` macro) |
392
393
393
394
The [`Cstring`](@ref) type is essentially a synonym for `Ptr{UInt8}`, except the conversion to `Cstring`
394
395
throws an error if the Julia string contains any embedded NUL characters (which would cause the
@@ -651,21 +652,28 @@ For translating a C argument list to Julia:
651
652
652
653
*`Any`
653
654
* argument value must be a valid Julia object
654
-
*`jl_value_t**`
655
+
*`jl_value_t* const*`
655
656
656
657
*`Ref{Any}`
657
-
* argument value must be a valid Julia object (or `C_NULL`)
658
+
* argument list must be a valid Julia object (or `C_NULL`)
659
+
* cannot be used for an output parameter, unless the user is able to
660
+
manage to separate arrange for the object to be GC-preserved
658
661
*`T*`
659
662
660
663
*`Ref{T}`, where `T` is the Julia type corresponding to `T`
661
-
* argument value will be copied if it is an `isbits` type otherwise, the value must be a valid Julia
662
-
object
664
+
* argument value will be copied if it is an `inlinealloc` type (which
665
+
includes `isbits` otherwise, the value must be a valid Julia object
663
666
*`T (*)(...)` (e.g. a pointer to a function)
664
667
665
-
*`Ptr{Cvoid}` (you may need to use [`@cfunction`](@ref) explicitly to create this pointer)
668
+
*`Ptr{Cvoid}` (you may need to use [`@cfunction`](@ref) explicitly to
669
+
create this pointer)
666
670
*`...` (e.g. a vararg)
667
671
668
-
*`T...`, where `T` is the Julia type
672
+
*[for `ccall`]: `T...`, where `T` is the single Julia type of all
673
+
remaining arguments
674
+
*[for `@ccall`]: `; va_arg1::T, va_arg2::S, etc`, where `T` and `S` are
675
+
the Julia type (i.e. separate the regular arguments from varargs with
676
+
a `;`)
669
677
* currently unsupported by `@cfunction`
670
678
*`va_arg`
671
679
@@ -700,7 +708,6 @@ For translating a C return type to Julia:
700
708
*`jl_value_t**`
701
709
702
710
*`Ptr{Any}` (`Ref{Any}` is invalid as a return type)
703
-
* argument value must be a valid Julia object (or `C_NULL`)
704
711
*`T*`
705
712
706
713
* If the memory is already owned by Julia, or is an `isbits` type, and is known to be non-null:
0 commit comments