Commit Graph
215 Commits
Author SHA1 Message Date
José Valim 370e7db14a Ensure compiler modules are returned on failures, closes #15279 2026-04-16 08:26:16 +02:00
José Valim b05fec0c87 Use evaluation when compiling modules (#15087) 2026-02-19 18:11:28 +01:00
José Valim c40c140e3f Postpone deletion of modules to avoid code server bottleneck 2026-01-31 13:56:15 +01:00
José Valim f1bbb2cd32 Infer types from guards and do post-inference on stdlib (#15032)
We now infer types from guards although we don't
yet infer conditional types (such as on `or`).
2026-01-02 19:48:45 +01:00
José Valim b60e424204 Typecheck Map.from_struct/1 2025-12-12 13:29:37 +01:00
Jonatan Männchen e1d171e5c7 Add inline License / Copyright to Erlang files (#14255) 2025-02-05 13:50:00 +01:00
José Valim 29e3b78da8 Allow controlling which applications are used during inference 2025-02-03 18:13:18 +01:00
José Valim c1c2cf8a65 Type checking of protocol dispatch (#14117) 2024-12-27 19:40:26 +01:00
José Valim cb2e03688e Perform return type inference and application across local calls (#13984) 2024-11-11 23:06:31 +01:00
José Valim 485ca72ae2 Infer types and use them across remote calls (#13981)
This also unifies handling of deterministic builds with Erlang/OTP
as well as warnings_as_errors.
2024-11-09 18:00:27 +01:00
Jonatan Kłosko 1c19c60abb Add source and behaviour information to docs chunk metadata (#13914) 2024-10-30 09:18:00 +01:00
José Valim 12f62e49ca Re-add simplified purging logic (#13455) 2024-03-30 18:30:42 +01:00
José Valim be2e26f465 Add define_alias, define_require, and expand_alias 2024-03-22 19:11:59 +01:00
José Valim 04e2724591 Do not purge compiler modules during compilation, only after (#13346)
The compiler freezing is mostly caused by a bug upstream,
but it may be speed up compilation to avoid purging as
we compile, as purging blocks the code server.

A potential downside is higher memory usage during
compilation.

Closes #13264.
2024-02-15 12:48:53 +01:00
José Valim a2676855fd Remove unused Args argument 2024-02-11 23:36:40 +01:00
José Valim 3ae8475e41 Add bitmask types to descr (#13230)
The bitmap represents all non-divisible types.
Currently it implements all types in our system,
but atoms, lists, tuples, maps, and functions
will be given more precise types later on.

Dynamic has not been yet implemented nor
optimizations for term.
2024-01-07 19:30:48 +01:00
José Valim 748722dc0d Trim down current typed module implementation (#13226) 2024-01-06 11:33:26 +01:00
José Valim aabe46536e Disable compiler optimizations only in module body 2023-12-10 03:23:45 +11:00
José Valim 93ff4a22de Disable tail call optimization on file root entries 2023-07-07 13:37:44 +02:00
sabiwara 4b5097ca6d Add :on_undefined_variable compiler option (#12279) 2022-12-03 18:41:41 +01:00
José Valim 749349205d Do not include module variables in prune_binding 2022-11-08 11:34:55 +01:00
José Valim 439a138089 Revert pruning of defmodule 2022-11-08 00:40:20 +01:00
José Valim 1fc747c75e Add prune binding to module tracing event 2022-11-08 00:40:20 +01:00
Marc-André Lafortune b5d40c6f99 Behaviour as runtime dependency (#12103) 2022-08-30 08:34:08 +02:00
José Valim dd01320f22 Optimize variable loading in eval 2022-07-15 11:41:47 +02:00
José Valim ed82538f9a Simplify passing of values to the checker 2022-07-12 12:55:48 +02:00
José Valim f77e83db7b Fix inspection of Macro.Env 2022-06-15 19:29:27 +02:00
José Valim 3bf9f0684b Skip docs on secondary bootstrap (#11883)
Docs will be compiled on the next pass.
2022-05-30 12:19:36 +02:00
José Valim 4e5c5f2f70 Ensure context modules are handled in optimized defmodule 2021-12-22 12:19:02 +01:00
José Valim 080528a308 Simplify contract between checker and compiler 2021-12-18 22:05:49 +01:00
José Valim c0d535bab7 Disable ssa and bool passes (#11420)
Module bodies, especially in tests, tend to be
long, which affects the performance of passes
such as beam_ssa_opt and beam_bool. This commit
disables those passes during module definition.
As an example, this makes loading Elixir's test
suite 7-8% faster.
2021-11-26 06:46:50 +01:00
José Valim af3f7eedcf Preserve opts while formatting failed inspect struct
Also make formatting consistent.
2021-11-25 18:11:05 +01:00
Eksperimental e352c889cb Improve user experience when there is a faulty Inspect implementation (#11403) 2021-11-25 17:41:03 +01:00
José Valim 2a3dfa7d7e Pass annotation forward when building Erlang AST 2021-09-11 10:21:31 +02:00
José Valim 92a2eb6328 Add mix xref trace that shows all deps for a given file (#11184) 2021-08-17 18:04:15 +02:00
José Valim 5eb2efe543 Break Macro.Env apart (#11164)
Previously, the internal Elixir expansion pass worked directly on
Macro.Env. However, this poised an issue, if we want to track
more information in the pass, we ended up exposing it on
Macro.Env, making it larger, and potentially slowing down
operations such as __ENV__ serialization.

This commit refactors the expansion pass to work with two
structures, the Macro.Env struct and a #elixir_ex{} record.
2021-08-03 13:35:15 +02:00
José Valim 259407ce17 Bypass evaluator on fast compile 2021-07-27 07:55:42 +02:00
José Valim 97ba4c4839 Use Code.quoted_to_algebra on Macro.to_string (#11003) 2021-05-24 16:00:57 +02:00
José Valim 189fca62ca Reduce the amount of module map copies when compiling
Prior to this commit, compilation would copy the module map
(which is the map with the module definitions, attriubutes,
etc) multiple times. In particular, the module execution
process would pass it to the compiler. Then the module
execution process would send it to the parallel compiler
coordinator, which would pass it to the parallel checker
coordinator and then to each individual parallel checker.
That's four copies, which can be quite expensive since it
has the whole Elixir AST.

This commit makes it so it is copied only once. The map
is assembled inside the compiler process and then copied
to the checker process.

This has yielded good improvements in Elixir's test suite.

Before:

    Finished in 27.3 seconds (14.4s on load, 7.0s async, 5.8s sync)

After:

    Finished in 22.0 seconds (9.4s on load, 6.7s async, 5.8s sync)
2021-05-07 16:41:10 +02:00
José Valim dcd0b6d4d1 Use persistent term for tokenizer and bootstrap 2021-04-01 10:45:15 +02:00
José Valim 3819745588 Infer -> Unify 2020-09-14 13:32:13 +02:00
José Valim 2a5caaf18c Move struct handling from unify to AST (#10320)
We also improve error messages to list all
available fields and introduce Module.Types.Of
module to hold shared functionality between Expr
and Pattern.
2020-09-11 19:51:46 +02:00
José Valim e7acc2540e Move Checker into ParallelChecker 2020-09-10 20:04:10 +02:00
José Valim 9848ce8f19 Merge remote with inference pass (#10305) 2020-09-08 09:08:44 +02:00
Fernando Tapia Rico 767a14d6a5 Add List.Chars to bootstrap modules
If there is a compile error, Kernel.ParallelCompiler raises
`** (UndefinedFunctionError) function List.Chars.to_charlist/1 is
undefined (module List.Chars is not available)`.
2020-07-16 13:20:38 +02:00
José Valim d35c3104e7 Recompile Kernel before bootstrapping stdlib (#10002)
Before this patch, we could have slightly different
AST while compiling modules in parallel, depending
if modules were recompiled or not. Now we always
recompile Kernel before compiling the whole stdlib.

We used this opportunity to simplify bootstrap by
breaking it two steps. The first step is the minimal
necessary to compile Kernel itself. The second step
contains the whole compiler.

Closes #10000.
2020-04-30 01:38:04 +02:00
Michał Łępicki 5cf65513bd Fix dialyzer errors caused by erl_anno:anno type being opaque (#9961) 2020-04-25 20:29:56 +02:00
Eric Meadows-Jönsson e98284fbb0 Add checking of patterns in body (#9828) 2020-02-20 16:46:06 +01:00
Wojtek Mach 63be6419ee Add :column to Code.string_to_quoted*/2 2020-01-12 15:41:36 +01:00
José Valim dbf8a7a9fe Use version metadata in Erlang pass 2019-11-16 02:45:55 +01:00