diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-08 23:25:04 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-08 23:25:04 +0000 |
commit | 26542b05b057b860dda4fe73a8ab179b86bccadd (patch) | |
tree | ab39fe280ad6581451492e8396e88d57ffbbd3b9 /tools/gn/config_values_generator.h | |
parent | bf72b5786dea227736e1394c5b5c42cecc422e31 (diff) | |
download | chromium_src-26542b05b057b860dda4fe73a8ab179b86bccadd.zip chromium_src-26542b05b057b860dda4fe73a8ab179b86bccadd.tar.gz chromium_src-26542b05b057b860dda4fe73a8ab179b86bccadd.tar.bz2 |
Refactor the GN threading model to reduce locking and simplify execution.
Old design: item_tree manages dependency resolution, target_manager creates and hooks up the target dependencies, and the toolchain manager does all kinds of crazy ordering and loading stuff on every thread. There is lots of locking every time the dependency tree is modified.
This patch completely deletes the toolchain manager, item tree, item node, and target manager.
The new design is that the build files are executed on background threads, but then they come back to the main thread which assembles the dependency tree and schedules other file loads. This eliminates almost all locking and a lot of complexity.
The Loader now manages loading the different build files in the correct context, and managing dependencies (loading the build config first, for example). The Builder manages the dependency tree and requests that the Loader load files that it encounters references to.
This simpler design reduces non-test code by ~350 lines. In the current gn build, lock acquisitions go down from 1808 to 116 and it saves about 20ms wall clock time (8% faster). This is a bit deceiving, though, because most of the time is spent on pkg-config which is constant. It speeds up running individual build files by 1000-1500%.
The work of putting the tree together that used to take up this time inside locks is now transferred to the main thread, which looks like it is *sometimes* a bottleneck. This should be easier to optimize in the future, though.
Other tweaks:
- I fixed cycle finding
- Directories look prettier on Windows using the "desc" command
- Tracing output now includes the main thread and marks it as such
- I updated the base BUILD.gn file for the more recent tree.
R=scottmg@chromium.org
Review URL: https://codereview.chromium.org/56433003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234032 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gn/config_values_generator.h')
-rw-r--r-- | tools/gn/config_values_generator.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/gn/config_values_generator.h b/tools/gn/config_values_generator.h index d58018e..eb8a2e6 100644 --- a/tools/gn/config_values_generator.h +++ b/tools/gn/config_values_generator.h @@ -16,11 +16,14 @@ class Err; class Scope; class Token; +// This class fills in the config values from a given scope. It's shared +// between the "config" function call and all the different binary target types +// (shared library, static library, etc.) since all of these support the +// various flags stored in the ConfigValues class. class ConfigValuesGenerator { public: ConfigValuesGenerator(ConfigValues* dest_values, Scope* scope, - const Token& function_token, const SourceDir& input_dir, Err* err); ~ConfigValuesGenerator(); @@ -31,7 +34,6 @@ class ConfigValuesGenerator { private: ConfigValues* config_values_; Scope* scope_; - const Token& function_token_; const SourceDir input_dir_; Err* err_; |