Commit Graph
189 Commits
Author SHA1 Message Date
José Valim bb028b951f Always consider Elixir modules on inference (#14000) 2024-11-19 13:40:16 +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
José Valim 705407b61a Share profiling code in ParallelCompiler 2024-10-30 20:05:34 +01:00
André Albuquerque 63aa5703de Measure each_cycle callback + deadlock detection (#13941) 2024-10-30 19:45:32 +01:00
Steffen Deusch c28a4eb040 Add max_concurrency to Kernel.ParallelCompiler (#13634) 2024-06-04 16:04:15 +02:00
José Valim de74ea5d52 Remove duplicate purge compiler modules call 2024-02-15 17:24:11 +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 0da0b2899e Ensure the compiler is notified immediately after async 2024-01-18 15:52:58 +01:00
José Valim e4a71032d5 Always log errors at the end 2024-01-17 23:14:20 +01:00
José Valim af2b21d67d Do not crash parallel compiler on external reports, closes #13224 2024-01-10 10:16:49 +01:00
José Valim 4a14c03135 Remove unecessary @doc false function 2023-12-31 18:04:18 +01:00
José Valim 3a52c2d729 Add source field to diagnostics 2023-12-21 17:05:47 +01:00
José Valim a818ee3dd0 Normalize exception handling in diagnostics 2023-12-17 11:41:02 +01:00
José Valim 4d712b25ea Normalize token missing and mismatched delimiter exceptions
Closes #13183.
Closes #13185.
Closes #13186.
Closes #13187.
2023-12-14 17:02:15 +01:00
José Valim ed2bbe5b37 Pass original exception down to details in diagnostic, closes #13142 2023-12-10 03:23:45 +11:00
Vinícius Müller 7e9006988d Add span field to diagnostics (#12843) 2023-09-03 21:14:51 +02:00
José Valim 22dcba75d2 Introduce Kernel.ParallelCompiler.pmap/2 (#12899) 2023-08-30 14:59:48 +02:00
sabiwara 4fc5b77c40 Code.with_diagnostics/2 formats paths as relative (#12590)
* Code.with_diagnostics/2 formats paths as relative

* Fix in :elixir_errors instead

* Fix it in parallel checker too
2023-05-25 20:07:09 +09:00
José Valim e9f305c56b Fix typespecs and code comments 2023-05-16 14:21:41 +02:00
José Valim a0f0f75ee8 Add Code.with_diagnostics/2, closes #12276 2023-05-16 11:52:59 +02:00
José Valim 6476355246 Keep stacktrace in diagnostics 2023-05-15 23:35:07 +02:00
José Valim 48e2efd2d9 Return diagnostics from Kernel.ParallelCompiler 2023-05-10 12:32:25 +02:00
John Bampton d6ba278b31 Fix some typos here and there (#12396) 2023-02-13 21:41:57 +01:00
José Valim 6b078a21fe Track compile and runtime warnings separately, closes #12372 2023-02-13 15:18:42 +01:00
Greg Mefford f8540ab193 Add details about waiting information in --profile time compiler output (#12310) 2023-01-04 23:31:21 +01:00
José Valim c6bce1b115 Precompile runtime module paths 2022-12-08 07:02:56 +01:00
José Valim 2b1efdea7a Revert "Ensure all runtime_modules loaded before mapping their paths (#12287)"
We don't want to load all modules because some may have specified
`@compile {:autoload, false}`.

This reverts commit 28e22d090c.
2022-12-08 06:39:31 +01:00
Alex NaserandAlex Naser 28e22d090c Ensure all runtime_modules loaded before mapping their paths (#12287)
Co-authored-by: Alex Naser <alex.naser@remote.com>
2022-12-05 20:45:41 +01:00
José Valim b24869687b Introduce mechanism to collect several errors in a module (#12275) 2022-11-28 15:40:30 +01:00
José Valim 4a20f87a71 Assert there are no files if waiting/spawn are empty 2022-11-06 20:41:11 +01:00
José Valim 5b4956fe5f Use the result mapping to track waiting processes 2022-08-19 12:38:01 +02:00
José Valim 5af48aaab8 Keep waiting in parallel compiler as a map for faster lookups 2022-08-19 11:26:15 +02:00
José Valim 4ce0376e76 Only consume DOWN messages dedicated to the parallel compiler, closes #12087 2022-08-19 09:49:03 +02:00
sabiwara 29bf449f3f Evaluate formating charlists as ~c sigils (#12064) 2022-08-10 06:47:00 +02:00
José Valim ed82538f9a Simplify passing of values to the checker 2022-07-12 12:55:48 +02:00
José Valim 5f0454d27d Start checker processes lazily 2022-07-12 12:13:04 +02:00
José Valim 390fab4495 Include column information on error diagnostics when possible, closes #11964 2022-07-05 22:49:53 +02:00
Łukasz Samson bd89d5fbbc Improve diagnostic and compile typespec (#11962) 2022-07-05 12:10:15 +02:00
Eksperimental 37d18271d3 Replace misspelt helper nillify with nilify (#11919) 2022-06-11 18:06:46 +02:00
sabiwara d509be1b6f Add line in diagnostic for invalid struct key (#11701) 2022-03-13 09:06:06 +01:00
José Valim 293a1ae27b Deprecate features pending for v1.14 2021-11-09 18:34:01 +01:00
Michał Łępicki f362c623cd Fix mistake in ParallelCompiler.require/2 spec (#11340) 2021-10-25 10:45:48 +02:00
José Valim 65ab34224f Include column in warnings emitted by compiler (#11339)
We also extend Mix.Tasks.Compiler.Diagnostic
to include {line, column} as possible position.
We also explicitly document the behaviour of
line=0, which is equivalent to unknown line.
Elixir was already setting the line to zero in
multiple occasions prior to this patch, so this
patch makes it official and we stop returning `nil`
for said cases.
2021-10-24 16:28:36 +02:00
José Valim 3f5b93a578 Align profiling times for better readability
Before we would write:

    lib/foo.ex compiled in 10ms (plus 100ms waiting)

However, because the file name is variable, it was
hard to see which file took the longest. Now we will
write:

        10ms compiling +    100ms waiting for lib/foo.ex

By right aligning all times, we can easily look in
the first row and see which file took the longest.
We can also provide a summary option in the future,
if necessary.
2021-06-05 19:21:12 +02:00
José Valim a355450af8 Ensure waiting is tracked across typespecs
The Elixir compiler spawns a separate process per file.
When a file has to wait on another module, Elixir tracks
in the compiler that the file is waiting.

However, every time a module is defined, the Elixir compiler
spawns a separate process to compile to .beam, and this
process may expand structs in the typespec. Since this
new process is no longer the original file process, Elixir
was not able to track its waiting time.

This PR address this issue by passing the original file_pid
to the .beam compiler process. Note though that, if we
change typespecs to be compiled in the original file process,
this change is no longer required, but at the moment there are
no plans to make such change.

Closes #11036.
2021-06-05 19:21:12 +02:00
José Valim f2689a4b48 Clean up shared parallel checker table 2021-05-09 09:08:39 +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 1d5aac82ce Make sure we traverse all files when looking for definitions 2021-04-12 13:15:07 +02:00
José Valim dcd0b6d4d1 Use persistent term for tokenizer and bootstrap 2021-04-01 10:45:15 +02:00
José Valim e6ab57ba91 More docs and code comments for ensure_compiled! 2021-03-26 10:29:09 +01:00