Make BottomUpMutators parallel

Append .Parallel() to all of the RegisterBottomUpMutator calls to tell
Blueprint it can run them in parallel.

Test: identical build.ninja, passes race detector
Change-Id: I969a0689522d4cba7c8ff51e2aa00fe2fd338a89
This commit is contained in:
Colin Cross
2016-08-07 21:17:54 -07:00
parent 1317701114
commit e8a67a7c58
7 changed files with 38 additions and 19 deletions

View File

@@ -18,6 +18,7 @@ import (
"fmt"
"strconv"
"strings"
"sync"
"github.com/google/blueprint"
@@ -58,7 +59,8 @@ var (
// These libraries have migrated over to the new ndk_library, which is added
// as a variation dependency via depsMutator.
ndkMigratedLibs = []string{}
ndkMigratedLibs = []string{}
ndkMigratedLibsLock sync.Mutex // protects ndkMigratedLibs writes during parallel beginMutator
)
// Creates a stub shared library based on the provided version file.
@@ -177,6 +179,8 @@ func (c *stubDecorator) compilerInit(ctx BaseModuleContext) {
c.baseCompiler.compilerInit(ctx)
name := strings.TrimSuffix(ctx.ModuleName(), ".ndk")
ndkMigratedLibsLock.Lock()
defer ndkMigratedLibsLock.Unlock()
for _, lib := range ndkMigratedLibs {
if lib == name {
return