Skip to content

Commit

Permalink
Minor enhancements to devdocs/ast.md (#31032)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy authored and JeffBezanson committed Feb 14, 2019
1 parent b1acb3c commit 111b385
Showing 1 changed file with 60 additions and 4 deletions.
64 changes: 60 additions & 4 deletions doc/src/devdocs/ast.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ Lowered form (IR) is more important to the compiler, since it is used for type i
optimizations like inlining, and and code generation. It is also less obvious to the human,
since it results from a significant rearrangement of the input syntax.

The following data types exist in lowered form:
In addition to `Symbol`s and some number types, the following data
types exist in lowered form:

* `Expr`

Expand Down Expand Up @@ -316,7 +317,7 @@ These symbols appear in the `head` field of [`Expr`](@ref)s in lowered form.

Adds a method to a generic function and assigns the result if necessary.

Has a 1-argument form and a 4-argument form. The 1-argument form arises from the syntax `function foo end`.
Has a 1-argument form and a 3-argument form. The 1-argument form arises from the syntax `function foo end`.
In the 1-argument form, the argument is a symbol. If this symbol already names a function in the
current scope, nothing happens. If the symbol is undefined, a new function is created and assigned
to the identifier specified by the symbol. If the symbol is defined but names a non-function,
Expand All @@ -325,7 +326,7 @@ These symbols appear in the `head` field of [`Expr`](@ref)s in lowered form.
type uniquely identifies the type to add the method to. When the type has fields, it wouldn't
be clear whether the method was being added to the instance or its type.

The 4-argument form has the following arguments:
The 3-argument form has the following arguments:

* `args[1]`

Expand All @@ -345,9 +346,55 @@ These symbols appear in the `head` field of [`Expr`](@ref)s in lowered form.
method to a function that also has methods defined in different scopes) this is an
expression that evaluates to a `:lambda` expression.

* `struct_type`

A 7-argument expression that defines a new `struct`:

* `args[1]`

The name of the `struct`

* `args[2]`

A `call` expression that creates `SimpleVector` specifying its parameters

* `args[3]`

A `call` expression that creates `SimpleVector` specifying its fieldnames

* `args[4]`

`true` or `false`, identifying whether the method is staged (`@generated function`).
A `Symbol` or `GlobalRef` specifying the supertype (e.g., `:Integer` or
`GlobalRef(Core, :Any)`)

* `args[5]`

A `call` expression that creates `SimpleVector` specifying its fieldtypes

* `args[6]`

A Bool, true if `mutable`

* `args[7]`

The number of arguments to initialize. This will be the number
of fields, or the minimum number of fields called by an inner
constructor's `new` statement.

* `abstract_type`

A 3-argument expression that defines a new abstract type. The
arguments are the same as the first three arguments of
`struct_type` expressions.

* `primitive_type`

A 4-argument expression that defines a new primitive type. Arguments 1, 2, and 4
are the same as `struct_type`. Argument 3 is the number of bits.

* `global`

Declares a global binding.

* `const`

Expand All @@ -368,6 +415,11 @@ These symbols appear in the `head` field of [`Expr`](@ref)s in lowered form.

Returns its argument as the value of the enclosing function.

* `isdefined`

`Expr(:isdefined, :x)` returns a Bool indicating whether `x` has
already been defined in the current scope.

* `the_exception`

Yields the caught exception inside a `catch` block, as returned by `jl_current_exception()`.
Expand Down Expand Up @@ -400,6 +452,10 @@ These symbols appear in the `head` field of [`Expr`](@ref)s in lowered form.
Has the value `false` if inlined into a section of code marked with `@inbounds`,
otherwise has the value `true`.

* `simdloop`

Marks the end of the inner loop of a `@simd` expression.

* `copyast`

Part of the implementation of quasi-quote. The argument is a surface syntax AST that is simply
Expand Down

2 comments on commit 111b385

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.