Commit Graph
18 Commits
Author SHA1 Message Date
Eksperimental f7fa41cbde Complete specs and guards for Kernel module and some submodules (#5391) 2016-11-03 22:09:29 +01:00
Aleksei Magusev 96da837136 Emit warning when variable is being expanded to function call (#3517) 2016-06-11 22:31:03 +02:00
José Valim 2a1d3d6530 Keep the full list of modules being defined 2016-06-04 11:53:40 +02:00
José Valim b6dc389f5e 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
Joe Yates 05e426248c Fix typos in Elixir moduledocs 2015-12-01 13:45:33 +01:00
José Valim 3b34a57bd2 Avoid race conditions in the struct detection 2014-08-01 23:58:02 +02:00
James Fish 39cd4a6594 Fix unmatched returns dialyzer warnings 2014-07-04 02:45:16 +01:00
José Valim 56f15d9f4e Do not add spaces after { and before }
This makes the source code consistent with the result
returned by inspect/2.
2014-04-21 19:06:35 +02:00
José Valim 75de306c46 Make the ParallelCompiler aware of missing structs
This allows modules that have recursive dependencies on structs
to be defined by having a fine grained control on the struct
definition besides the module one.
2014-03-02 16:24:45 +01:00
José Valim 674f4a2cb3 Do not erase elixir_compiler_pid 2014-01-22 10:47:17 +01:00
José Valim 5a2e838def Deprecate <-/2 in favor of send/2 2014-01-14 18:27:41 +01:00
José Valim 7fcdecde95 Turn off dependency tracking for compilation on release, closes #1982 2014-01-09 15:50:48 +01:00
José Valim e98f3eae10 Use spawn_monitor instead of spawn_link to avoid EXIT
messages leaking into the mailbox.
2013-12-23 11:30:32 +01:00
José Valim c7af8bc2cc Improve compilation times and memory consumption
This commit includes three changes:

1. Previously, the parallel compiler released at once all processes
   depending on a particular module. This commit ensures they are
   released according to the number of cores available. This ensures
   we have fewer modules being compiled at once

2. Garbage collect the current process every time we are waiting
   for another module to be compiled

3. Do not compile a module for files that simply define modules
2013-12-21 20:06:50 +01:00
José Valim 52aa1fd068 Compile process upfront and do not rely on it in the error handler 2013-04-11 08:21:40 -07:00
José Valim 626ed9532b Erlang. syntax is deprecated in favor of simply using atoms 2012-10-05 17:08:22 -07:00
José Valim 576492ae48 Add Code.ensure_compiled 2012-07-23 09:51:15 +02:00
José Valim 7d1ef13f17 Rename Elixir.Builtin to Kernel, according to #390 2012-07-22 11:23:35 +02:00