Fix concurrent compiles. Also configure 2 by default

dev/git-series/gccdum
Matt Godbolt 8 years ago
parent d5bef9ea85
commit 979942a906

@ -9,3 +9,4 @@ cacheMb=200
#androidNdk=/opt/google/android-ndk-r9c
language=C++
options=-O2
maxConcurrentCompiles=2

@ -88,7 +88,7 @@ Compile.prototype.runCompiler = function (compiler, options) {
stderr += data;
});
return new Promise(function (resolve, reject) {
child.on('error', function(e) {
child.on('error', function (e) {
reject(e);
});
child.on('exit', function (code) {
@ -120,7 +120,7 @@ Compile.prototype.compile = function (source, compiler, options, filters) {
}
self.cacheMisses++;
var tempFileAndDirPromise = self.compileQueue.add(function () {
var tempFileAndDirPromise = Promise.resolve().then(function () {
return self.newTempDir().then(function (dirPath) {
var inputFilename = path.join(dirPath, props.get("gcc-explorer", "compileFilename"));
return self.writeFile(inputFilename, source).then(function () {
@ -176,16 +176,18 @@ Compile.prototype.compile = function (source, compiler, options, filters) {
});
});
return compileToAsmPromise.then(function (result) {
if (result.dirPath) {
fs.remove(result.dirPath);
result.dirPath = undefined;
}
if (result.okToCache) {
self.cache.set(key, result);
self.cacheStats();
}
return result;
return self.compileQueue.add(function () {
return compileToAsmPromise.then(function (result) {
if (result.dirPath) {
fs.remove(result.dirPath);
result.dirPath = undefined;
}
if (result.okToCache) {
self.cache.set(key, result);
self.cacheStats();
}
return result;
});
});
};

Loading…
Cancel
Save