mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 20:01:13 -06:00
Merge branch 'master' into release
This commit is contained in:
@@ -63,40 +63,6 @@ function compilerProps(property, defaultValue) {
|
||||
require('./lib/compile').initialise(gccProps, compilerProps);
|
||||
var staticMaxAgeMs = gccProps('staticMaxAgeMs', 0);
|
||||
|
||||
function initializeMemwatch() {
|
||||
var memwatch = require('memwatch-next');
|
||||
console.log("Initial GC");
|
||||
memwatch.gc();
|
||||
// Everything else happens a little later to let the initial GC finish.
|
||||
setTimeout(function () {
|
||||
var lastDiff = new memwatch.HeapDiff();
|
||||
memwatch.on('leak', function (info) {
|
||||
console.log("Memwatch leak: " + JSON.stringify(info));
|
||||
});
|
||||
|
||||
memwatch.on('stats', function (stats) {
|
||||
console.log("Memwatch stats: " + JSON.stringify(stats));
|
||||
});
|
||||
|
||||
var heapDiffEverySecs = gccProps('gcHeapDiffEverySecs', 0);
|
||||
if (heapDiffEverySecs) {
|
||||
console.log("Diffing heap every " + heapDiffEverySecs + "s");
|
||||
setInterval(function () {
|
||||
var diff = lastDiff.end();
|
||||
lastDiff = new memwatch.HeapDiff();
|
||||
console.log("Memwatch diff from last stats: " + JSON.stringify(diff));
|
||||
}, 1000 * heapDiffEverySecs);
|
||||
}
|
||||
var gcIntervalSecs = gccProps("gcIntervalSecs", 0);
|
||||
if (gcIntervalSecs) {
|
||||
console.log("Forcing a GC every " + gcIntervalSecs + "s");
|
||||
setInterval(function () {
|
||||
memwatch.gc();
|
||||
}, 1000 * gcIntervalSecs);
|
||||
}
|
||||
}, 1 * 1000);
|
||||
}
|
||||
|
||||
function loadSources() {
|
||||
var sourcesDir = "lib/sources";
|
||||
var sources = fs.readdirSync(sourcesDir)
|
||||
@@ -376,7 +342,6 @@ findCompilers().then(function (compilers) {
|
||||
console.log("=======================================");
|
||||
console.log("Listening on http://" + os.hostname() + ":" + port + "/");
|
||||
console.log("=======================================");
|
||||
initializeMemwatch();
|
||||
webServer.listen(port);
|
||||
}).catch(function (err) {
|
||||
console.log("Error: " + err.stack);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
compilers=gcc1204@20480:clang350:clang351:g482:g492:g510:g520:ppcg48:aarchg48:armhfg482:clang37x:clang36x
|
||||
compilers=gcc1204@20480:clang350:clang351:g482:g492:g510:g520:g530:ppcg48:aarchg48:armhfg482:clang37x:clang36x
|
||||
###############################
|
||||
# GCC for x86
|
||||
compiler.g492.exe=/usr/bin/g++-4.9
|
||||
@@ -7,6 +7,8 @@ compiler.g510.exe=/opt/gcc-5.1.0/bin/g++
|
||||
compiler.g510.name=x86 gcc 5.1.0
|
||||
compiler.g520.exe=/opt/gcc-5.2.0/bin/g++
|
||||
compiler.g520.name=x86 gcc 5.2.0
|
||||
compiler.g530.exe=/opt/gcc-5.3.0/bin/g++
|
||||
compiler.g530.name=x86 gcc 5.3.0
|
||||
compiler.g482.exe=/usr/bin/g++-4.8
|
||||
compiler.g482.name=x86 gcc 4.8.2
|
||||
compiler.clang350.exe=/usr/bin/clang++-3.5
|
||||
@@ -38,4 +40,4 @@ compiler.aarchg48.name=ARM64 gcc 4.8
|
||||
compiler.armhfg482.exe=/usr/bin/arm-linux-gnueabihf-g++
|
||||
compiler.armhfg482.name=ARM gcc 4.8.2
|
||||
compiler.armhfg482.supportsBinary=false
|
||||
compiler.aarchg48.supportsBinary=false
|
||||
compiler.aarchg48.supportsBinary=false
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Default settings for GCC Explorer.
|
||||
defaultCompiler=g46
|
||||
compilers=g44:g45:g46:clang35:g51
|
||||
defaultCompiler=g52
|
||||
compilers=g44:g45:g46:clang35:g51:g52
|
||||
compiler.g44.exe=/usr/bin/g++-4.4
|
||||
compiler.g44.name=g++ 4.4
|
||||
compiler.g44.alias=/usr/bin/g++-4.4
|
||||
@@ -16,4 +16,6 @@ compiler.clang35.intelAsm=-mllvm --x86-asm-syntax=intel
|
||||
compiler.clang35.supportsBinary=false
|
||||
compiler.g51.exe=/home/mgodbolt/.fighome/runtime/gcc/5.1.0-1/bin/g++
|
||||
compiler.g51.name=g++ 5.1
|
||||
compiler.g52.exe=/home/mgodbolt/.fighome/runtime/gcc/5.2.0-1/bin/g++
|
||||
compiler.g52.name=g++ 5.2
|
||||
#compiler-wrapper=./c-preload/compiler-wrapper
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
// Compile with -O3 -march=native to see autovectorization
|
||||
// assumes input is aligned on 64-byte boundary and that
|
||||
// length is a multiple of 64.
|
||||
int testFunction(int* input, int length) {
|
||||
// Alignment hints supported on GCC 4.7+ and any compiler
|
||||
// supporting the appropriate builtin (clang 3.6+).
|
||||
// Alignment hints supported on GCC 4.7+ and any compiler
|
||||
// supporting the appropriate builtin (clang 3.6+).
|
||||
#ifndef __has_builtin
|
||||
#define __has_builtin(x) 0
|
||||
#endif
|
||||
#if __GNUC__ > 4 \
|
||||
|| (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) \
|
||||
|| __has_builtin(__builtin_assume_aligned)
|
||||
input = static_cast<int*>(__builtin_assume_aligned(input, 16));
|
||||
|| (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) \
|
||||
|| __has_builtin(__builtin_assume_aligned)
|
||||
input = static_cast<int*>(__builtin_assume_aligned(input, 64));
|
||||
#endif
|
||||
if (length & 63) __builtin_unreachable();
|
||||
int sum = 0;
|
||||
for (int i = 0; i < length; ++i) {
|
||||
sum += input[i];
|
||||
|
||||
+19
-19
@@ -68,7 +68,7 @@ function Compile(compilers) {
|
||||
this.cache = LRU({
|
||||
max: gccProps('cacheMb') * 1024 * 1024,
|
||||
length: function (n) {
|
||||
return n.asm.length;
|
||||
return JSON.stringify(n).length;
|
||||
}
|
||||
});
|
||||
this.cacheHits = 0;
|
||||
@@ -149,8 +149,8 @@ Compile.prototype.runCompiler = function (compiler, options) {
|
||||
});
|
||||
child.on('exit', function (code) {
|
||||
clearTimeout(timeout);
|
||||
// TODO: why is this apparently needed in the getMultiarch case?
|
||||
// without it, I apparently get stdout/stderr callbacks *after* the exit
|
||||
// Why is this apparently needed in some cases (e.g. when I used to use this to do getMultiarch)?
|
||||
// Without it, I apparently get stdout/stderr callbacks *after* the exit...
|
||||
setTimeout(function () {
|
||||
resolve({code: code, stdout: stdout, stderr: stderr, okToCache: okToCache});
|
||||
}, 0);
|
||||
@@ -160,21 +160,19 @@ Compile.prototype.runCompiler = function (compiler, options) {
|
||||
};
|
||||
|
||||
Compile.prototype.getMultiarch = function () {
|
||||
// TODO; force caller to block until this is done...
|
||||
return this.runCompiler("gcc", ["-print-multiarch"])
|
||||
.then(function (obj) {
|
||||
if (obj.code === 0) {
|
||||
var multi = obj.stdout.trim();
|
||||
console.log("Multiarch: " + obj.stdout.trim());
|
||||
process.env.LIBRARY_PATH = '/usr/lib/' + multi;
|
||||
process.env.C_INCLUDE_PATH = '/usr/include/' + multi;
|
||||
process.env.CPLUS_INCLUDE_PATH = '/usr/include/' + multi;
|
||||
} else {
|
||||
console.log("Unable to get multiarch: " + err);
|
||||
}
|
||||
}, function (err) {
|
||||
console.log("Unable to get multiarch: " + err);
|
||||
});
|
||||
try {
|
||||
var multi = child_process.execSync("gcc -print-multiarch").toString().trim();
|
||||
if (multi) {
|
||||
console.log("Multiarch: " + multi);
|
||||
process.env.LIBRARY_PATH = '/usr/lib/' + multi;
|
||||
process.env.C_INCLUDE_PATH = '/usr/include/' + multi;
|
||||
process.env.CPLUS_INCLUDE_PATH = '/usr/include/' + multi;
|
||||
} else {
|
||||
console.log("No multiarch");
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("Unable to get multiarch: " + err);
|
||||
}
|
||||
};
|
||||
|
||||
Compile.prototype.objdump = function (outputFilename, result, maxSize, intelAsm) {
|
||||
@@ -332,7 +330,9 @@ Compile.prototype.checkSource = function (source) {
|
||||
};
|
||||
|
||||
Compile.prototype.cacheStats = function () {
|
||||
console.log("Cache stats: " + this.cacheHits + " hits, " + this.cacheMisses + " misses");
|
||||
var pc = (100 * this.cacheHits) / (this.cacheMisses + this.cacheHits);
|
||||
console.log("Cache stats: " + this.cacheHits + " hits, " + this.cacheMisses + " misses (" + pc.toFixed(2) +
|
||||
"%), LRU has " + this.cache.itemCount + " item(s) totalling " + this.cache.length + " bytes");
|
||||
};
|
||||
|
||||
function compileHandler(compilers) {
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
"fs-extra": "0.26.x",
|
||||
"http-proxy": "1.12.x",
|
||||
"lru-cache": "2.7.x",
|
||||
"memwatch-next": "0.2.x",
|
||||
"morgan": "1.6.x",
|
||||
"promise": "7.0.x",
|
||||
"promise-queue": "2.1.x",
|
||||
|
||||
Reference in New Issue
Block a user