Commit Graph
195 Commits
Author SHA1 Message Date
José Valim 192aee5164 Use a single table instead of digraph for tracking locals
This reduces the number of spawned ETS tables from 3 to 1
per local tracker and also removes the need for a separate
process.

Closes #7091.
2017-12-06 19:49:54 +01:00
José Valim 10bc690a70 Add Kernel.ParallelCompiler.async/1
This gives developers more control over the parallel compiler
and allows a single file to compile multiple modules in parallel
by spawning tasks.
2017-11-02 17:30:32 +01:00
José Valim d475c8c286 Do not pass :in_memory to load_binary
Erlang's typespecs define only cover_compiled and preloaded
as valid atoms and uses an empty list for generated code.
So we should follow Erlang's rules until we can officially
relax them.
2017-10-14 23:19:32 +02:00
José Valim 606f683582 Remove ordering issue on errors_test.exs, closes #6490 2017-08-21 22:17:43 +02:00
José Valim f68a483f45 Ensure elixir_erl:debug_info/4 does not require elixir running (#6401) 2017-07-29 17:27:05 +02:00
José Valim a52c9ac9e0 Do not serialize references, closes #6393 2017-07-29 12:59:18 +02:00
José Valim a560a9feee Do not use named ETS tables during module definition
Tables named after modules are very likely to be used
the application itself, which can lead to conflicts in
scenarios such as code reloading.

Closes #6361
2017-07-19 23:22:25 +02:00
José Valim e503812f39 ETS table names are not quotable on OTP 20 2017-06-29 12:50:17 +02:00
José Valim d79f69969c Cache the AST on definitions
This speeds up the compilation time from 10% to 15%
measured across different projects.
2017-06-29 10:53:14 +02:00
Michał Muskała d8d412cbf2 Make sure System.stracktrace is first thing done in the handler (#6119)
If any of the functions catches an error, we'd get a wrong trace
2017-05-18 12:27:17 +02:00
Sam Davies 3fe59919a8 Do not warn about missing @impl for overridable functions (#6098) 2017-05-11 19:49:01 +02:00
José Valim 5390eac99e Make sure @impl warns even when @impl is first-used later 2017-05-09 16:26:59 +02:00
Sam Davies 265e53fefd Implement @impl directive
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2017-05-09 16:26:59 +02:00
José Valim 5889718983 Use the new debug_info option on OTP 20 2017-05-08 19:59:57 +02:00
José Valim 6c0f374a20 Do not include typespecs on module map
They include the environment which would make
storing them very expensive.
2017-05-08 17:56:16 +02:00
José Valim 89d7e178ba Build a metadata module for the compiler 2017-05-08 16:30:25 +02:00
José Valim 6ca9ab69b3 Read compiler option directly from the function that uses it 2017-04-22 13:18:36 +02:00
José Valim 9307611ecc Support custom backends (undocumented behaviour for now) 2017-02-23 14:27:17 +01:00
José Valim c11a9b616f Move beam building to elixir_erl 2017-02-23 13:42:41 +01:00
José Valim ac5a0cf9ec Add elixir_erl_compiler 2017-02-23 13:15:26 +01:00
José Valim 9ba49d2347 Start refactoring on elixir_compiler 2017-02-23 13:15:26 +01:00
José Valim 8cbb5938b5 Move more from elixir_module to elixir_erl 2017-02-20 01:35:02 +01:00
José Valim 526618e7be Deprecate parse transforms, closes #5762 2017-02-19 23:56:27 +01:00
Aleksei Magusev c1c009537a Rename m/2 helper macro to key/2 in the main header file 2017-02-19 21:56:05 +01:00
José Valim a722e6c18c More module renaming and organizing 2017-02-19 21:20:43 +01:00
José Valim adb0a0f095 Move erlang modules to new erl namespace 2017-02-19 20:20:59 +01:00
José Valim d01d3af856 Start moving files to elixir_erl 2017-02-19 19:40:21 +01:00
José Valim f9d46d9145 Split erl and ex passes in elixir_def 2017-02-19 13:01:13 +01:00
José Valim e2db69cf69 Convert default argument handling to Elixir pass 2017-02-18 19:44:38 +01:00
José Valim f702241d6a Include proper line numbers on unused module attribute warning, closes #5490 2016-11-29 11:15:37 +01:00
José Valim 2eb6a5c67f Warn for unused module attributes
Module attributes that are imported from other
contexts are not warned. This keeps the same
semantics regarding variables and function definition
ordering which are not warned when they come from
other contexts.
2016-11-20 00:08:20 +01:00
José Valim 41f7cd7a0e Move module attributes to a new structure to support warnings 2016-11-20 00:08:20 +01:00
José Valim f3af2cc350 Serialize lookups to avoid race in tests 2016-11-03 13:45:33 +01:00
José Valim e2c871c8ae Always include the compiled file source in manifests
See https://github.com/plataformatec/nimble_csv/issues/4.
2016-08-04 20:12:24 +02:00
José Valim 2599bc124b Do not attempt to load modules that have not been required, closes #4900
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2016-06-29 01:21:53 +01:00
José Valim 035d9a34ec Use a more explicit pdict key 2016-06-04 16:47:00 +02:00
José Valim 719928b25c Keep the full list of modules being defined 2016-06-04 11:53:40 +02:00
Andrea Leopardi 1e71e3402a Add support for the @optional_callbacks behaviour attribute (#4705) 2016-05-28 13:19:12 +02:00
José Valim 20c4c4d7f7 Store function definitions and clauses in the same table 2016-05-19 13:23:19 +02:00
eksperimental 685e87bdf0 Formmating: Add white space around vertical bar (#4507) 2016-04-25 00:55:49 +02:00
José Valim 80557a6b1f Improvements to the parallel compiler
In previous versions, when trying to compile a file and the file
depended on a module that was not yet compiled or was unavailable,
the parallel compiler would wait until the missing dependency shows
up. In case it did not, the compiler would "release" the file being
compiled, disabling any further missing dependency resolution.

This lead to issues in code like the following:

    Code.ensure_compiled(SomeModuleThatWontBeAvailable)
    %SomeStructFromMyProject{}

Because `SomeModuleThatWontBeAvailable` would never be available,
the file above would block until released. When released, the
parallel compiler would disable further lookups for that file,
meaning we would no longer wait for missing dependencies when we
attempt to load the struct.

In the majorify of cases, the struct would already be available,
which meant compilation would work. But if the file that defined
the struct was also blocked by the compiler (and consequently
released), compilation would be non-deterministic.

This patch solves the issue by removing the "release" behaviour
from the compiler. If a dependency is not available, we will
notify the file of such and move on, with the parallel compiler
still enabled. In order to guarantee this works without
introducing deadlocks, the parallel compiler now also knows which
module is being defined by a given file, building a graph and
solving dependencies from the leaves. In case it is a cyclic
graph, we will raise that a deadlock was found.

Closes #4294
Closes #4055
2016-02-13 14:15:18 +01:00
José Valim a171294dce Support disabling autoload after compilation
Useful for delaying loading of modules that may depend
on NIFs until necessary.
2016-01-25 00:11:52 +01:00
José Valim cdb671cd60 Include where the module being redefined is currently loaded from 2016-01-21 13:24:41 +01:00
Alexei Sholik c6e843f28a Update the spec for the generated __info__/1 function to please Dialyzer
Verify the spec's correctness with `mix dialyze --specdiffs` in a dummy
mix project.
2015-12-25 22:39:37 +02:00
Aleksei Magusev 4deb67bb17 Favor local calls inside modules 2015-10-24 00:49:45 +02:00
José Valim 67d8bbb072 Solve bootstrap issues with @doc 2015-10-14 18:25:20 +02:00
José Valim 4e4f610e4f Forward all info values to get_module_info 2015-08-31 21:03:52 +02:00
jisaacstone 0ec127872a Line numbers for doctest errors. Fixes issue #3592
Note that this will change all line numbers retured by `Code.get_docs`.
2015-08-19 11:04:50 -07:00
José Valim edc9c1d596 Soft-deprecate Behaviour 2015-08-14 23:01:37 +02:00
Eric Entin aee7fbc0dc @callback can now be used directly (without Behaviour). Add @macrocallback. 2015-08-14 14:29:34 +01:00