Skip to content

Commit

Permalink
[devdoc] update section "reflection" (JuliaLang#43145)
Browse files Browse the repository at this point in the history
* [devdoc] fix typo

+ `isbitstype` accepts types, e.g.: `Int64`
+ `isbits` accepts instances, e.g.: `1`

* [devdoc] update REPL output

* [devdoc] mark code block type

* [devdoc] add space for inline code
  • Loading branch information
inkydragon committed Nov 19, 2021
1 parent 61c6f33 commit ee21d7b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions doc/src/devdocs/reflection.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ recursive application of [`subtypes`](@ref) may be used to inspect the full type
## DataType layout

The internal representation of a `DataType` is critically important when interfacing with C code
and several functions are available to inspect these details. [`isbits(T::DataType)`](@ref) returns
and several functions are available to inspect these details. [`isbitstype(T::DataType)`](@ref) returns
true if `T` is stored with C-compatible alignment. [`fieldoffset(T::DataType, i::Integer)`](@ref)
returns the (byte) offset for field *i* relative to the start of the type.

Expand Down Expand Up @@ -122,11 +122,12 @@ calls and expand argument types automatically:

```julia-repl
julia> @code_llvm +(1,1)
define i64 @"julia_+_130862"(i64, i64) {
; @ int.jl:87 within `+`
; Function Attrs: sspstrong uwtable
define i64 @"julia_+_476"(i64 signext %0, i64 signext %1) #0 {
top:
%2 = add i64 %1, %0
ret i64 %2
%2 = add i64 %1, %0
ret i64 %2
}
```

Expand All @@ -138,7 +139,7 @@ For more informations see [`@code_lowered`](@ref), [`@code_typed`](@ref), [`@cod
The aforementioned functions and macros take the keyword argument `debuginfo` that controls the level
debug information printed.

```
```julia-repl
julia> @code_typed debuginfo=:source +(1,1)
CodeInfo(
@ int.jl:53 within `+'
Expand All @@ -147,7 +148,7 @@ CodeInfo(
) => Int64
```

Possible values for `debuginfo` are: `:none`, `:source`, and`:default`.
Possible values for `debuginfo` are: `:none`, `:source`, and `:default`.
Per default debug information is not printed, but that can be changed
by setting `Base.IRShow.default_debuginfo[] = :source`.

0 comments on commit ee21d7b

Please sign in to comment.