mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-11-30 19:14:32 -06:00
Merge branch 'master' into execution
This commit is contained in:
Generated
+11
-11
@@ -1,19 +1,19 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Cargo <rustfilt>">
|
||||
<CLASSES>
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/thread-id-2.0.0" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/kernel32-sys-0.2.2" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-0.2.2" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.18" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/thread_local-0.2.7" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-build-0.1.1" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-0.1.80" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/aho-corasick-0.5.3" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/memchr-0.1.11" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-syntax-0.3.9" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.2.8" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-demangle-0.1.3" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/utf8-ranges-0.1.3" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.18" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-0.2.2" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/thread-id-2.0.0" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/kernel32-sys-0.2.2" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-0.1.80" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-syntax-0.3.9" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/thread_local-0.2.7" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/memchr-0.1.11" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-0.2.8" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-build-0.1.1" />
|
||||
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/aho-corasick-0.5.3" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
|
||||
@@ -51,7 +51,7 @@ $(BOWER_MODULES): bower.json $(NODE_MODULES)
|
||||
@touch $@
|
||||
|
||||
lint: $(NODE_MODULES)
|
||||
$(NODE) ./node_modules/.bin/jshint app.js $(shell find lib static -name '*.js' -not -path 'static/ext/*')
|
||||
$(NODE) ./node_modules/.bin/jshint app.js $(shell find lib static -name '*.js' -not -path 'static/ext/*' -not -path static/analytics.js)
|
||||
|
||||
LANG:=C++
|
||||
|
||||
|
||||
@@ -15,7 +15,9 @@ Try out one of the demo sites: [C++][cpp], [Rust][rust], [D][d] or [Go][go].
|
||||
[d]: https://d.godbolt.org/ "Compiler Explorer for D"
|
||||
[go]: https://go.godbolt.org/ "Compiler Explorer for Go"
|
||||
|
||||
### Developing
|
||||
You can support this [this project on Patreon](https://patreon.com/mattgodbolt).
|
||||
|
||||
### Developing or running a local instance
|
||||
|
||||
Compiler Explorer is written in node.js.
|
||||
|
||||
@@ -33,7 +35,65 @@ The config system leaves a lot to be desired, I'm working on porting [CCS](https
|
||||
Feel free to raise an issue on [github](https://github.com/mattgodbolt/compiler-explorer/issues) or
|
||||
[email me directly](mailto:matt@godbolt.org) for more help.
|
||||
|
||||
There's now a [Road map](Roadmap.md) that gives a little insight into future plans for Compiler Explorer.
|
||||
|
||||
### Credits
|
||||
|
||||
Compiler Explorer is maintained by [Matt Godbolt](http://xania.org). Multiple compiler and difference view was
|
||||
implemented by [Gabriel Devillers](https://github.com/voxelf).
|
||||
|
||||
### RESTful API
|
||||
|
||||
There's a simple restful API that can be used to do compiles to asm and to list compilers. In general
|
||||
all handlers live in `/api/*` endpoints, and will accept JSON or text in POSTs, and will return text responses
|
||||
or JSON responses depending on the request's `Accept` header.
|
||||
|
||||
At a later date there may be some form of rate-limiting: currently requests will be queued and dealt with
|
||||
exactly like interactive requests on the main site. Authentication might be required at some point in the
|
||||
future (for the main Compiler Explorer site anyway).
|
||||
|
||||
The following endpoints are defined:
|
||||
|
||||
#### `GET /api/compilers` - return a list of compilers
|
||||
|
||||
Returns a list of compilers. In text form, there's a simple formatting of the ID of the compiler and its
|
||||
description. In JSON, all the information is returned as an array of compilers, with the `id` key being the
|
||||
primary identifier of each compiler.
|
||||
|
||||
#### `POST /api/<compiler-id>/compiler` - perform a compilation
|
||||
|
||||
To specify a compilation request as a JSON document, post it as the appropriate type and send an object of
|
||||
the form: `{'source': 'source to compile', 'options': 'compiler flags', 'filters': {'filter': true}}`. The filters are an JSON object with true/false. If not supplied, defaults are used. If supplied, the filters are used
|
||||
as-is.
|
||||
|
||||
A text compilation request has the source as the body of the post, and uses query parameters to pass the
|
||||
options and filters. Filters are supplied as a comma-separated string. Use the query parameter `filters=XX`
|
||||
to set the filters directly, else `addFilters=XX` to add a filter to defaults, or `removeFilters` to remove from defaults. Compiler parameters should be passed as `options=-O2` and default to empty.
|
||||
|
||||
Filters include `binary`, `labels`, `intel`, `comments` and `directives` and correspond to the UI buttons on
|
||||
the HTML version.
|
||||
|
||||
The text request is designed for simplicity for command-line clients like `curl`:
|
||||
|
||||
```bash
|
||||
$ curl 'https://gcc.godbolt.org/api/compiler/g63/compile?options=-Wall' --data-binary 'int foo() { return 1; }'
|
||||
# Compilation provided by Compiler Explorer at gcc.godbolt.org
|
||||
foo():
|
||||
push rbp
|
||||
mov rbp, rsp
|
||||
mov eax, 1
|
||||
pop rbp
|
||||
ret
|
||||
```
|
||||
|
||||
If JSON is present in the request's `Accept` header, the compilation results are of the form:
|
||||
|
||||
```
|
||||
{
|
||||
code: 0 if successful, else compiler return code,
|
||||
stdout: [ { text: "Output",
|
||||
(optional) tag: {line: source line, text: "parsed error for that line"} } ],
|
||||
stderr: (as above),
|
||||
asm: [ { text: "assembly text", source: source line number or null if none } ]
|
||||
}
|
||||
```
|
||||
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
# Compiler Explorer Road Map
|
||||
|
||||
CE was started in 2012 to serve my needs at [my company](http:/drw.com) in terms of showing how
|
||||
C++ constructs translated to assembly code. It started out as a `tmux` session with `vi` running in one
|
||||
pane and `watch gcc -S foo.cc -o -` running in the other. Since those days it's now a public website
|
||||
serving the C++, Rust, Go and D communities and performs around 20,000 compilations per day.
|
||||
|
||||
This document is an attempt to capture thoughts on the future direction of Compiler Explorer.
|
||||
|
||||
## Areas to improve
|
||||
|
||||
### Mobile client support
|
||||
|
||||
CE's UI doesn't work well with mobile clients. The editor doesn't work well on many mobile clients, and the
|
||||
layout doesn't lend itself well to small screens.
|
||||
|
||||
Ideas for improving mobile support include automatically folding up all the panes into a single tab upon
|
||||
detection of a mobile client. This would require a bunch of fixes in the
|
||||
underlying [UI library](http://golden-layout.com) as this doesn't properly work with mobile and tabs.
|
||||
|
||||
Perhaps a read-only simplified view would work better: the main reason one brings up the CE website is to
|
||||
look at tweeted links rather than author content.
|
||||
|
||||
### UI improvements
|
||||
|
||||
The UI has a number of things that need improving:
|
||||
|
||||
* Multiple editor windows
|
||||
* Saving and restoring from browser-local storage
|
||||
* Handling the loss of data if one has a work-in-progress CE window open and then clicks another CE link.
|
||||
|
||||
### Diff view
|
||||
|
||||
A frequently requested feature is to be able to diff output. A large patch was provided by @Voxelf which
|
||||
helped spur on the development of the new UI, but the diff view he created has yet to be merged. There's
|
||||
a possibility that moving to the [Monaco](https://microsoft.github.io/monaco-editor/) editor will not only
|
||||
give a better editing experience, but also bring pretty much free diff windows out of the box.
|
||||
|
||||
### Execution support
|
||||
|
||||
Another big ticket item is to allow executing of the user's code. This is fraught with security issues, and
|
||||
brings up a number of UI and API considerations. Compiling code every time to execute with different params
|
||||
seems wasteful, so caching seems good; but in a multi-instance setup a shared cache woudl be needed. Perhaps
|
||||
a backend system that caches the executables (and makes them downloadable; at least for some compilers where
|
||||
license allows), and stores the binaries in ephemeral, shared storage. This same backend system could also
|
||||
be used to store code, and could be part of a whole new way of sending and sharing code (if made permanent
|
||||
storage).
|
||||
|
||||
### Support more compilers
|
||||
|
||||
Most of the open tickets are to do with adding new compilers, or fixing issues with existing compilers.
|
||||
Continuing to add more compilers and make it easier for others to submit PRs to add new compilers is
|
||||
very important.
|
||||
|
||||
## Tensions
|
||||
|
||||
There's an inherent tension between the standalone, run-it-yourself version of CE and the scalable, AWS-backed
|
||||
CE instance. Care must be taken to keep the standalone version usable, not least as the majority of CE's
|
||||
development is done on a laptop during a commute (with little or no internet access).
|
||||
|
||||
## Priorities
|
||||
|
||||
Above all, the priority is to keep the main CE site up, stable and dependable. After that, features are
|
||||
added honestly in the order that is most useful and interesting to the primary developer (Matt Godbolt).
|
||||
|
||||
## Non-goals
|
||||
|
||||
CE will remain ad-free, open-source and non-commercial. There's no plans at all to add "freemium" content.
|
||||
|
||||
## 2017 goals
|
||||
|
||||
With all this in mind, the tentative goals for 2017 are:
|
||||
|
||||
* Move to the Monaco editor
|
||||
* Implement diff view
|
||||
* Come up with a decent secure solution for code execution
|
||||
* Design an API that can handle remote code execution and download needs
|
||||
* Implement remote execution UIs
|
||||
|
||||
These goals will be refined as time ticks on.
|
||||
@@ -138,8 +138,8 @@ fileSources.forEach(function (source) {
|
||||
});
|
||||
|
||||
var clientOptionsHandler = new ClientOptionsHandler(fileSources);
|
||||
var apiHandler = new ApiHandler();
|
||||
var compileHandler = new CompileHandler(gccProps, compilerProps);
|
||||
var apiHandler = new ApiHandler(compileHandler);
|
||||
|
||||
// auxiliary function used in clientOptionsHandler
|
||||
function compareOn(key) {
|
||||
@@ -271,7 +271,10 @@ function findCompilers() {
|
||||
var request = http.get({
|
||||
hostname: host,
|
||||
port: port,
|
||||
path: "/api/compilers"
|
||||
path: "/api/compilers",
|
||||
headers: {
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
}, function (res) {
|
||||
var str = '';
|
||||
res.on('data', function (chunk) {
|
||||
@@ -386,27 +389,32 @@ function findCompilers() {
|
||||
});
|
||||
}
|
||||
|
||||
// Instantiate a function that writes information on the compiler,
|
||||
// in JSON format, for ease of external listing.
|
||||
function ApiHandler() {
|
||||
var reply = "";
|
||||
function ApiHandler(compileHandler) {
|
||||
this.compilers = [];
|
||||
this.compileHandler = compileHandler;
|
||||
this.setCompilers = function (compilers) {
|
||||
reply = JSON.stringify(compilers);
|
||||
this.compilers = compilers;
|
||||
};
|
||||
this.handler = function apiHandler(req, res, next) {
|
||||
var bits = req.url.split("/");
|
||||
if (bits.length !== 2 || req.method !== "GET") return next();
|
||||
switch (bits[1]) {
|
||||
default:
|
||||
next();
|
||||
break;
|
||||
|
||||
case "compilers":
|
||||
res.set('Content-Type', 'application/json');
|
||||
res.end(reply);
|
||||
break;
|
||||
this.handler = express.Router();
|
||||
this.handler.get('/compilers', _.bind(function (req, res, next) {
|
||||
if (req.accepts(['text', 'json']) == 'json') {
|
||||
res.set('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(this.compilers));
|
||||
} else {
|
||||
res.set('Content-Type', 'text/plain');
|
||||
var title = 'Compiler Name';
|
||||
var maxLength = _.max(_.pluck(_.pluck(this.compilers, 'id').concat([title]), 'length'));
|
||||
res.write(utils.padRight(title, maxLength) + ' | Description\n');
|
||||
res.end(_.map(this.compilers, function (compiler) {
|
||||
return utils.padRight(compiler.id, maxLength) + ' | ' + compiler.name;
|
||||
}).join("\n"));
|
||||
}
|
||||
};
|
||||
}, this));
|
||||
this.handler.param('compiler', _.bind(function (req, res, next, compilerName) {
|
||||
req.compiler = compilerName;
|
||||
next();
|
||||
}, this));
|
||||
this.handler.post('/compiler/:compiler/compile', this.compileHandler.handler);
|
||||
}
|
||||
|
||||
function shortUrlHandler(req, res, next) {
|
||||
@@ -455,7 +463,6 @@ function embeddedHandler(req, res, next) {
|
||||
res.end();
|
||||
}
|
||||
|
||||
|
||||
findCompilers()
|
||||
.then(function (compilers) {
|
||||
var prevCompilers;
|
||||
@@ -485,7 +492,6 @@ findCompilers()
|
||||
|
||||
var webServer = express(),
|
||||
sFavicon = require('serve-favicon'),
|
||||
sStatic = require('serve-static'),
|
||||
bodyParser = require('body-parser'),
|
||||
morgan = require('morgan'),
|
||||
compression = require('compression'),
|
||||
@@ -502,24 +508,29 @@ findCompilers()
|
||||
.use(morgan('combined', {stream: logger.stream}))
|
||||
.use(compression())
|
||||
.use(sFavicon(staticDir + '/favicon.ico'))
|
||||
.use('/v', sStatic(staticDir + '/v', {maxAge: Infinity}))
|
||||
.use(sStatic(staticDir, {maxAge: staticMaxAgeSecs * 1000}));
|
||||
.use('/v', express.static(staticDir + '/v', {maxAge: Infinity, index: false}))
|
||||
.use(express.static(staticDir, {maxAge: staticMaxAgeSecs * 1000}));
|
||||
if (archivedVersions) {
|
||||
// The archived versions directory is used to serve "old" versioned data during updates. It's expected
|
||||
// to contain all the SHA-hashed directories from previous versions of Compiler Explorer.
|
||||
logger.info(" serving archived versions from", archivedVersions);
|
||||
webServer.use('/v', sStatic(archivedVersions, {maxAge: Infinity}));
|
||||
webServer.use('/v', express.static(archivedVersions, {maxAge: Infinity, index: false}));
|
||||
}
|
||||
webServer
|
||||
.use(bodyParser.json({limit: gccProps('bodyParserLimit', '1mb')}))
|
||||
.use(bodyParser.text({
|
||||
limit: gccProps('bodyParserLimit', '1mb'), type: function () {
|
||||
return true;
|
||||
}
|
||||
}))
|
||||
.use(restreamer())
|
||||
.get('/client-options.json', clientOptionsHandler.handler)
|
||||
.use('/source', getSource)
|
||||
.use('/api', apiHandler.handler)
|
||||
.use('/g', shortUrlHandler)
|
||||
.use('/e', embeddedHandler)
|
||||
.post('/compile', compileHandler.handler) // used inside static/compiler.js
|
||||
.post('/diff', diffHandler); // used inside static/compiler.js
|
||||
.post('/compile', compileHandler.handler)
|
||||
.post('/diff', diffHandler);
|
||||
logger.info("=======================================");
|
||||
|
||||
webServer.on('error', function (err) {
|
||||
|
||||
@@ -15,7 +15,7 @@ ALLOWED_FOR_READ=${ALLOWED_FOR_READ}:/usr/share/fonts:/etc/passwd
|
||||
|
||||
# Last-gasp limits
|
||||
ulimit -m $((512 * 1024)) # RSS limit in K
|
||||
ulimit -t 5 # CPU time in seconds
|
||||
ulimit -t 10 # CPU time in seconds
|
||||
ulimit -v $((2 * 1024 * 1024)) # virtual RAM limit in K
|
||||
|
||||
"$@"
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
compilers=gcc1204@20480:&gcc86:&icc:&clang:&cl:&cross:&ellcc
|
||||
defaultCompiler=g63
|
||||
textBanner=Compilation provided by Compiler Explorer at https://gcc.godbolt.org/
|
||||
|
||||
###############################
|
||||
# GCC for x86
|
||||
group.gcc86.compilers=g471:g472:g473:g474:g481:g482:g483:g484:g485:g490:g491:g492:g493:g494:g510:g520:g530:g540:g6:g62:g63:g7snapshot
|
||||
group.gcc86.compilers=g464:g471:g472:g473:g474:g481:g482:g483:g484:g485:g490:g491:g492:g493:g494:g510:g520:g530:g540:g6:g62:g63:g7snapshot
|
||||
compiler.g464.exe=/opt/compiler-explorer/gcc-4.6.4/bin/g++
|
||||
compiler.g464.alias=/usr/bin/g++-4.6
|
||||
compiler.g464.name=x86-64 gcc 4.6.4
|
||||
compiler.g471.exe=/opt/compiler-explorer/gcc-4.7.1/bin/g++
|
||||
compiler.g471.name=x86-64 gcc 4.7.1
|
||||
compiler.g472.exe=/opt/compiler-explorer/gcc-4.7.2/bin/g++
|
||||
@@ -50,10 +55,28 @@ compiler.g7snapshot.exe= /opt/compiler-explorer/gcc-7-snapshot/bin/g++
|
||||
compiler.g7snapshot.name=x86-64 gcc 7 (snapshot)
|
||||
|
||||
# Clang for x86
|
||||
group.clang.compilers=clang350:clang351:clang37x:clang36x:clang371:clang380:clang381:clang390:clang391:clang_trunk
|
||||
group.clang.compilers=clang30:clang31:clang32:clang33:clang341:clang350:clang351:clang37x:clang36x:clang371:clang380:clang381:clang390:clang391:clang_trunk
|
||||
group.clang.intelAsm=-masm=intel
|
||||
group.clang.options=--gcc-toolchain=/opt/compiler-explorer/gcc-6.2.0
|
||||
compiler.clang350.exe=/usr/bin/clang++-3.5
|
||||
compiler.clang30.exe=/opt/compiler-explorer/clang+llvm-3.0-x86_64-linux-Ubuntu-11_10/bin/clang++
|
||||
compiler.clang30.alias=/usr/bin/clang++
|
||||
compiler.clang30.name=x86-64 clang 3.0
|
||||
compiler.clang30.options=
|
||||
compiler.clang31.exe=/opt/compiler-explorer/clang+llvm-3.1-x86_64-linux-ubuntu_12.04/bin/clang++
|
||||
compiler.clang31.name=x86-64 clang 3.1
|
||||
compiler.clang31.options=
|
||||
compiler.clang32.exe=/opt/compiler-explorer/clang-3.2/bin/clang++
|
||||
compiler.clang32.alias=/opt/clang-3.2/bin/clang++
|
||||
compiler.clang32.name=x86-64 clang 3.2
|
||||
compiler.clang32.options=
|
||||
compiler.clang33.exe=/opt/compiler-explorer/clang-3.3/bin/clang++
|
||||
compiler.clang33.alias=/opt/clang-3.3/bin/clang++
|
||||
compiler.clang33.name=x86-64 clang 3.3
|
||||
compiler.clang33.options=
|
||||
compiler.clang341.exe=/opt/compiler-explorer/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04/bin/clang++
|
||||
compiler.clang341.alias=/opt/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04/bin/clang++
|
||||
compiler.clang341.name=x86-64 clang 3.4.1
|
||||
compiler.clang350.exe=/opt/compiler-explorer/clang+llvm-3.5.0-x86_64-linux-gnu/bin/clang++
|
||||
compiler.clang350.name=x86-64 clang 3.5
|
||||
compiler.clang351.exe=/opt/compiler-explorer/clang+llvm-3.5.1-x86_64-linux-gnu/bin/clang++
|
||||
compiler.clang351.name=x86-64 clang 3.5.1
|
||||
@@ -77,9 +100,14 @@ compiler.clang_trunk.exe=/opt/compiler-explorer/clang-trunk/bin/clang++
|
||||
compiler.clang_trunk.name=x86-64 clang (trunk)
|
||||
|
||||
# icc for x86
|
||||
group.icc.compilers=icc16:icc17
|
||||
group.icc.compilers=icc1301:icc16:icc17
|
||||
group.icc.intelAsm=-masm=intel
|
||||
group.icc.needsMulti=false
|
||||
compiler.icc1301.exe=/opt/compiler-explorer/intel/bin/icc
|
||||
compiler.icc1301.alias=/opt/intel/bin/icc
|
||||
compiler.icc1301.name=x86-64 icc 13.0.1
|
||||
# intel 13.01 binary disabled: it just segfaults (no idea why)
|
||||
compiler.icc1301.supportsBinary=false
|
||||
compiler.icc16.exe=/opt/compiler-explorer/intel/xe_2016_update3/bin/icc
|
||||
compiler.icc16.name=x86-64 icc 16
|
||||
compiler.icc17.exe=/opt/compiler-explorer/intel/2017/bin/icc
|
||||
|
||||
@@ -1,41 +1,14 @@
|
||||
compilers=&gcc86:&clang:avrg453:&gccarm:icc1301:msp430g453
|
||||
compilers=&gcc86:avrg453:&gccarm:msp430g453
|
||||
defaultCompiler=g447
|
||||
###############################
|
||||
# GCC for x86
|
||||
group.gcc86.compilers=g447:g453:g464
|
||||
group.gcc86.compilers=g447:g453
|
||||
compiler.g447.exe=/usr/bin/g++-4.4
|
||||
compiler.g447.alias=/usr/bin/g++-4.4
|
||||
compiler.g447.name=x86-64 gcc 4.4.7
|
||||
compiler.g453.exe=/usr/bin/g++-4.5
|
||||
compiler.g453.alias=/usr/bin/g++-4.5
|
||||
compiler.g453.name=x86-64 gcc 4.5.3
|
||||
compiler.g464.exe=/usr/bin/g++-4.6
|
||||
compiler.g464.alias=/usr/bin/g++-4.6
|
||||
compiler.g464.name=x86-64 gcc 4.6.4
|
||||
# Intel for x86
|
||||
compiler.icc1301.exe=/opt/compiler-explorer/intel/bin/icc
|
||||
compiler.icc1301.alias=/opt/intel/bin/icc
|
||||
compiler.icc1301.name=x86-64 icc 13.0.1
|
||||
compiler.icc1301.intelAsm=-masm=intel
|
||||
compiler.icc1301.needsMulti=false
|
||||
# intel binary disabled for now TODO why does it segfault? preload?
|
||||
compiler.icc1301.supportsBinary=false
|
||||
# Clang for x86
|
||||
group.clang.compilers=clang30:clang32:clang33:clang341
|
||||
group.clang.intelAsm=-mllvm --x86-asm-syntax=intel
|
||||
group.clang.options=--gcc-toolchain=/opt/compiler-explorer/gcc-6.2.0
|
||||
compiler.clang30.exe=/usr/bin/clang++
|
||||
compiler.clang30.alias=/usr/bin/clang++
|
||||
compiler.clang30.name=x86-64 clang 3.0
|
||||
compiler.clang32.exe=/opt/compiler-explorer/clang-3.2/bin/clang++
|
||||
compiler.clang32.alias=/opt/clang-3.2/bin/clang++
|
||||
compiler.clang32.name=x86-64 clang 3.2
|
||||
compiler.clang33.exe=/opt/compiler-explorer/clang-3.3/bin/clang++
|
||||
compiler.clang33.alias=/opt/clang-3.3/bin/clang++
|
||||
compiler.clang33.name=x86-64 clang 3.3
|
||||
compiler.clang341.exe=/opt/compiler-explorer/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04/bin/clang++
|
||||
compiler.clang341.alias=/opt/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04/bin/clang++
|
||||
compiler.clang341.name=x86-64 clang 3.4.1
|
||||
|
||||
###############################
|
||||
# GCC for ARM
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Matt's home development computer
|
||||
defaultCompiler=g54
|
||||
compilers=g54:g47:g48:avr
|
||||
textBanner=Testing the text banner
|
||||
#compilers=g54:g47:g48:avr
|
||||
#compilers=localhost@20480
|
||||
compiler.g54.exe=/usr/bin/g++
|
||||
compiler.g54.name=g++ 5.4
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Default settings for GCC Explorer.
|
||||
defaultCompiler=g52
|
||||
#compilers=g44:g45:g46:clang35:g51:g52:gdef:msp430g453:cl
|
||||
compilers=&gcc:&clang:&windows
|
||||
compilers=/usr/bin/g++:g44:g45:g46:clang35:g51:g52:gdef:msp430g453:cl:tcc
|
||||
#compilers=&gcc:&clang:&windows
|
||||
group.gcc.compilers=gdef:g62
|
||||
compiler.gdef.exe=/usr/bin/g++
|
||||
compiler.gdef.name=Default G++
|
||||
@@ -9,6 +9,12 @@ compiler.g62.exe=/home/mgodbolt/.fighome/runtime/gcc/6.2.0-1/bin/g++
|
||||
compiler.g62.name=G++ 6.2 from fig
|
||||
#compiler-wrapper=./c-preload/compiler-wrapper
|
||||
|
||||
compiler.tcc.exe=/home/mgodbolt/personal/dev/tcc-0.9.26/tcc
|
||||
compiler.tcc.name=TCC
|
||||
compiler.tcc.versionFlag=-v
|
||||
compileFilename=example.c
|
||||
compiler.tcc.options=-B /home/mgodbolt/personal/dev/tcc-0.9.26
|
||||
|
||||
group.clang.compilers=clang39
|
||||
group.clang.supportsBinary=false
|
||||
group.clang.intelAsm=-mllvm --x86-asm-syntax=intel
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Settings overridden for Amazon EC2 instances that power http://*.godbolt.org/
|
||||
googleApiKey=AIzaSyAaz35KJv8DA0ABoime0fEIh32NmbyYbcQ
|
||||
compileTimeoutMs=5000
|
||||
compileTimeoutMs=7500
|
||||
compiler-wrapper=./c-preload/compiler-wrapper
|
||||
max-asm-size=8388608
|
||||
staticMaxAgeSecs=30
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Default settings for GCC Explorer.
|
||||
port=10240
|
||||
compileTimeoutMs=3000
|
||||
compileTimeoutMs=10000
|
||||
defaultSource=builtin
|
||||
cacheMb=50
|
||||
language=C++
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
compilers=gdc48:gdc49:gdc52:&ldc
|
||||
textBanner=Compilation provided by Compiler Explorer at https://d.godbolt.org/
|
||||
defaultCompiler=gdc52
|
||||
# This is only due to limitations on the d.godbolt.org image for now.
|
||||
supportsBinary=false
|
||||
@@ -12,11 +13,13 @@ compiler.gdc48.name=gdc 4.8.2
|
||||
compiler.gdc52.exe=/opt/compiler-explorer/gdc5.2.0/x86_64-pc-linux-gnu/bin/gdc
|
||||
compiler.gdc52.name=gdc 5.2.0
|
||||
|
||||
group.ldc.compilers=ldc017:ldc100:ldcbeta
|
||||
group.ldc.compilers=ldc017:ldc100:ldc110:ldcbeta
|
||||
group.ldc.compilerType=ldc
|
||||
compiler.ldc017.exe=/opt/compiler-explorer/ldc0.17.2/ldc2-0.17.2-linux-x86_64/bin/ldc2
|
||||
compiler.ldc017.name=ldc 0.17.2
|
||||
compiler.ldc100.exe=/opt/compiler-explorer/ldc1.0.0/ldc2-1.0.0-linux-x86_64/bin/ldc2
|
||||
compiler.ldc100.name=ldc 1.0.0
|
||||
compiler.ldc110.exe=/opt/compiler-explorer/ldc1.1.0/ldc2-1.1.0-linux-x86_64/bin/ldc2
|
||||
compiler.ldc110.name=ldc 1.1.0
|
||||
compiler.ldcbeta.exe=/opt/compiler-explorer/ldcbeta/bin/ldc2
|
||||
compiler.ldcbeta.name=ldc beta
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
defaultCompiler=gccgo491
|
||||
textBanner=Compilation provided by Compiler Explorer at https://go.godbolt.org/
|
||||
compilers=gccgo491:6g141
|
||||
compileFilename=file.go
|
||||
compiler.gccgo491.exe=/usr/bin/gccgo
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
compilers=&rust
|
||||
textBanner=Compilation provided by Compiler Explorer at https://rust.godbolt.org/
|
||||
defaultCompiler=r1140
|
||||
group.rust.compilers=r1140:r1130:r1120:r1110:r1100:r190:r180:r170:r160:r150:r140:r130:r120:r110:r100:nightly:beta
|
||||
group.rust.compilerType=rust
|
||||
|
||||
+4
-4
@@ -34,12 +34,12 @@ var gccExplorerDir = /\\compiler-explorer-compiler/; // has to match part of the
|
||||
// * optional leading whitespace
|
||||
// * middle part
|
||||
// * comment part
|
||||
var parseRe = /^(\s*)([^;]*)(;.*)*$/;
|
||||
var isProc = /.*PROC$/;
|
||||
var isEndp = /.*ENDP$/;
|
||||
var parseRe = /^(\s*)([^;]*)(;.*)?$/;
|
||||
var isProc = /.*PROC\s*$/;
|
||||
var isEndp = /.*ENDP\s*$/;
|
||||
var constDef = /^([a-zA-Z_$@][a-zA-Z_$@0-9.]*)\s*=.*$/;
|
||||
var labelFind = /[.a-zA-Z_@$][a-zA-Z_$@0-9.]*/g;
|
||||
var labelDef = /^(.*):$/;
|
||||
var labelDef = /^(.*):\s*$/;
|
||||
// Anything identifier-looking with a "@@" in the middle, and a comment at the end
|
||||
// is treated as a mangled name. The comment will be used to replace the identifier.
|
||||
var mangledIdentifier = /\?[^ ]+@@[^ |]+/;
|
||||
|
||||
@@ -250,6 +250,10 @@ Compile.prototype.checkOptions = function (options) {
|
||||
return null;
|
||||
};
|
||||
|
||||
// This check for arbitrary user-controlled preprocessor inclusions
|
||||
// can be circumvented in more than one way. The goal here is to respond
|
||||
// to simple attempts with a clear diagnostic; the service still needs to
|
||||
// assume that malicious actors can make the compiler open arbitrary files.
|
||||
Compile.prototype.checkSource = function (source) {
|
||||
var re = /^\s*#\s*i(nclude|mport)(_next)?\s+["<"](\/|.*\.\.)/;
|
||||
var failed = [];
|
||||
@@ -319,4 +323,14 @@ Compile.prototype.getInfo = function () {
|
||||
return this.compiler;
|
||||
};
|
||||
|
||||
Compile.prototype.getDefaultFilters = function () {
|
||||
// TODO; propagate to UI?
|
||||
return {
|
||||
intel: true,
|
||||
commentOnly: true,
|
||||
directives: true,
|
||||
labels: true
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = Compile;
|
||||
|
||||
@@ -100,6 +100,10 @@ CompilationEnvironment.prototype.enqueue = function (job) {
|
||||
return this.compileQueue.add(job);
|
||||
};
|
||||
|
||||
CompilationEnvironment.prototype.isBusy = function () {
|
||||
return this.compileQueue.getPendingLength() > 0 || this.compileQueue.getQueueLength() > 0;
|
||||
};
|
||||
|
||||
CompilationEnvironment.prototype.findBadOptions = function (options) {
|
||||
return _.filter(options, function (option) {
|
||||
return !option.match(this.okOptions) || option.match(this.badOptions);
|
||||
|
||||
+68
-20
@@ -33,26 +33,28 @@ var child_process = require('child_process'),
|
||||
|
||||
temp.track();
|
||||
|
||||
function periodicCleanup() {
|
||||
temp.cleanup(function (err, stats) {
|
||||
if (err) logger.error("Error cleaning directories: ", err);
|
||||
if (stats) logger.debug("Directory cleanup stats:", stats);
|
||||
});
|
||||
}
|
||||
|
||||
var oneTimeInit = false;
|
||||
function initialise(gccProps, compilerProps) {
|
||||
function initialise(gccProps, compilerEnv) {
|
||||
if (oneTimeInit) return;
|
||||
oneTimeInit = true;
|
||||
var tempDirCleanupSecs = gccProps("tempDirCleanupSecs", 600);
|
||||
logger.info("Cleaning temp dirs every " + tempDirCleanupSecs + " secs");
|
||||
setInterval(periodicCleanup, tempDirCleanupSecs * 1000);
|
||||
setInterval(function () {
|
||||
if (compilerEnv.isBusy()) {
|
||||
logger.warn("Skipping temporary file clean up as compiler environment is busy");
|
||||
return;
|
||||
}
|
||||
temp.cleanup(function (err, stats) {
|
||||
if (err) logger.error("Error cleaning directories: ", err);
|
||||
if (stats) logger.debug("Directory cleanup stats:", stats);
|
||||
});
|
||||
}, tempDirCleanupSecs * 1000);
|
||||
}
|
||||
|
||||
function CompileHandler(gccProps, compilerProps) {
|
||||
initialise(gccProps, compilerProps);
|
||||
this.compilersById = {};
|
||||
this.compilerEnv = new CompilationEnvironment(gccProps, compilerProps);
|
||||
initialise(gccProps, this.compilerEnv);
|
||||
this.factories = {};
|
||||
|
||||
this.create = function (compiler) {
|
||||
@@ -83,39 +85,85 @@ function CompileHandler(gccProps, compilerProps) {
|
||||
});
|
||||
};
|
||||
var proxy = httpProxy.createProxyServer({});
|
||||
var textBanner = compilerProps('textBanner');
|
||||
|
||||
this.handler = _.bind(function compile(req, res, next) {
|
||||
var compiler = this.compilersById[req.body.compiler];
|
||||
if (!compiler) return next();
|
||||
|
||||
var source, options, filters, compiler;
|
||||
if (req.is('json')) {
|
||||
// JSON-style request
|
||||
compiler = this.compilersById[req.compiler || req.body.compiler];
|
||||
if (!compiler) return next();
|
||||
source = req.body.source;
|
||||
options = req.body.options;
|
||||
filters = req.body.filters || compiler.getDefaultFilters();
|
||||
} else {
|
||||
// API-style
|
||||
compiler = this.compilersById[req.compiler];
|
||||
if (!compiler) return next();
|
||||
source = req.body;
|
||||
options = req.query.options;
|
||||
// By default we get the default filters.
|
||||
filters = compiler.getDefaultFilters();
|
||||
// If specified exactly, we'll take that with ?filters=a,b,c
|
||||
if (req.query.filters) {
|
||||
filters = _.object(_.map(req.query.filters.split(","), function (filter) {
|
||||
return [filter, true];
|
||||
}));
|
||||
}
|
||||
// Add a filter. ?addFilters=binary
|
||||
_.each((req.query.addFilters || "").split(","), function (filter) {
|
||||
filters[filter] = true;
|
||||
});
|
||||
// Remove a filter. ?removeFilter=intel
|
||||
_.each((req.query.removeFilters || "").split(","), function (filter) {
|
||||
delete filters[filter];
|
||||
});
|
||||
}
|
||||
var remote = compiler.getRemote();
|
||||
if (remote) {
|
||||
req.url = req.originalUrl; // Undo any routing that was done to get here (i.e. /api/* path has been removed)
|
||||
proxy.web(req, res, {target: remote}, function (e) {
|
||||
logger.error("Proxy error: ", e);
|
||||
next(e);
|
||||
});
|
||||
return;
|
||||
}
|
||||
var source = req.body.source;
|
||||
var options = req.body.options || '';
|
||||
|
||||
if (source === undefined) {
|
||||
return next(new Error("Bad request"));
|
||||
}
|
||||
options = _.chain(quote.parse(options)
|
||||
options = _.chain(quote.parse(options || '')
|
||||
.map(function (x) {
|
||||
if (typeof(x) == "string") return x;
|
||||
return x.pattern;
|
||||
}))
|
||||
.filter(_.identity)
|
||||
.value();
|
||||
var filters = req.body.filters;
|
||||
function textify(array) {
|
||||
return _.pluck(array || [], 'text').join("\n");
|
||||
}
|
||||
|
||||
compiler.compile(source, options, filters).then(
|
||||
function (result) {
|
||||
res.set('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(result));
|
||||
if (req.accepts(['text', 'json']) === 'json') {
|
||||
res.set('Content-Type', 'application/json');
|
||||
res.end(JSON.stringify(result));
|
||||
} else {
|
||||
res.set('Content-Type', 'text/plain');
|
||||
try {
|
||||
if (!_.isEmpty(textBanner)) res.write('# ' + textBanner + "\n");
|
||||
res.write(textify(result.asm));
|
||||
if (result.code !== 0) res.write("\n# Compiler exited with result code " + result.code);
|
||||
if (!_.isEmpty(result.stdout)) res.write("\nStandard out:\n" + textify(result.stdout));
|
||||
if (!_.isEmpty(result.stderr)) res.write("\nStandard error:\n" + textify(result.stderr));
|
||||
} catch (ex) {
|
||||
re.write("Error handling request: " + ex);
|
||||
}
|
||||
res.end('\n');
|
||||
}
|
||||
},
|
||||
function (error) {
|
||||
logger.error("Error: " + error);
|
||||
logger.error("Error: " + error.stack || error);
|
||||
if (typeof(error) !== "string") {
|
||||
error = "Internal GCC explorer error: " + error.toString();
|
||||
}
|
||||
|
||||
+6
-2
@@ -24,7 +24,8 @@
|
||||
|
||||
var child_process = require('child_process'),
|
||||
path = require('path'),
|
||||
logger = require('./logger').logger;
|
||||
logger = require('./logger').logger,
|
||||
treeKill = require('tree-kill');
|
||||
|
||||
function execute(command, args, options) {
|
||||
options = options || {};
|
||||
@@ -43,8 +44,10 @@ function execute(command, args, options) {
|
||||
env: env,
|
||||
detached: process.platform == 'linux'
|
||||
});
|
||||
var running = true;
|
||||
|
||||
var killChild = options.killChild || function () {
|
||||
child.kill();
|
||||
if (running) treeKill(child.pid);
|
||||
};
|
||||
var stderr = "";
|
||||
var stdout = "";
|
||||
@@ -79,6 +82,7 @@ function execute(command, args, options) {
|
||||
child.on('exit', function (code) {
|
||||
logger.debug({type: 'exited', code: code});
|
||||
if (timeout !== undefined) clearTimeout(timeout);
|
||||
running = false;
|
||||
});
|
||||
return new Promise(function (resolve, reject) {
|
||||
child.on('error', function (e) {
|
||||
|
||||
+8
-1
@@ -66,4 +66,11 @@ function parseOutput(lines, inputFilename) {
|
||||
return result;
|
||||
}
|
||||
|
||||
exports.parseOutput = parseOutput;
|
||||
exports.parseOutput = parseOutput;
|
||||
|
||||
function padRight(name, len) {
|
||||
while (name.length < len) name = name + ' ';
|
||||
return name;
|
||||
}
|
||||
|
||||
exports.padRight = padRight;
|
||||
+1
-1
@@ -28,8 +28,8 @@
|
||||
"promise-queue": "2.1.x",
|
||||
"nopt": "3.0.x",
|
||||
"serve-favicon": "2.3.x",
|
||||
"serve-static": "1.10.x",
|
||||
"temp": "0.8.x",
|
||||
"tree-kill": "1.1.x",
|
||||
"underscore-node": "*",
|
||||
"shell-quote": "1.6.x",
|
||||
"winston": "2.2.x"
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2012-2017, Matt Godbolt
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
define(function (require) {
|
||||
var $ = require('jquery');
|
||||
|
||||
function Alert() {
|
||||
this.modal = $('#alert');
|
||||
this.title = this.modal.find('.modal-title');
|
||||
this.body = this.modal.find('.modal-body');
|
||||
}
|
||||
|
||||
Alert.prototype.alert = function (title, body) {
|
||||
this.title.html(title);
|
||||
this.body.html(body);
|
||||
this.modal.modal();
|
||||
};
|
||||
return Alert;
|
||||
});
|
||||
@@ -55,6 +55,51 @@ define(function (require) {
|
||||
gaProxy = function () {
|
||||
window.ga.apply(window.ga, arguments);
|
||||
};
|
||||
// fullstory stuff:
|
||||
window['_fs_debug'] = false;
|
||||
window['_fs_host'] = 'www.fullstory.com';
|
||||
window['_fs_org'] = '2F4NV';
|
||||
window['_fs_namespace'] = 'FS';
|
||||
(function (m, n, e, t, l, o, g, y) {
|
||||
if (e in m && m.console && m.console.log) {
|
||||
m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].');
|
||||
return;
|
||||
}
|
||||
g = m[e] = function (a, b) {
|
||||
g.q ? g.q.push([a, b]) : g._api(a, b);
|
||||
};
|
||||
g.q = [];
|
||||
o = n.createElement(t);
|
||||
o.async = 1;
|
||||
o.src = 'https://' + _fs_host + '/s/fs.js';
|
||||
y = n.getElementsByTagName(t)[0];
|
||||
y.parentNode.insertBefore(o, y);
|
||||
g.identify = function (i, v) {
|
||||
g(l, {uid: i});
|
||||
if (v) g(l, v)
|
||||
};
|
||||
g.setUserVars = function (v) {
|
||||
g(l, v)
|
||||
};
|
||||
g.identifyAccount = function (i, v) {
|
||||
o = 'account';
|
||||
v = v || {};
|
||||
v.acctId = i;
|
||||
g(o, v)
|
||||
};
|
||||
g.clearUserCookie = function (c, d, i) {
|
||||
if (!c || document.cookie.match('fs_uid=[`;`]*`[`;`]*`[`;`]*`')) {
|
||||
d = n.domain;
|
||||
while (1) {
|
||||
n.cookie = 'fs_uid=;domain=' + d +
|
||||
';path=/;expires=' + new Date(0).toUTCString();
|
||||
i = d.indexOf('.');
|
||||
if (i < 0)break;
|
||||
d = d.slice(i + 1)
|
||||
}
|
||||
}
|
||||
};
|
||||
})(window, document, window['_fs_namespace'], 'script', 'user');
|
||||
} else {
|
||||
gaProxy = function () {
|
||||
};
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 658 B |
Binary file not shown.
|
After Width: | Height: | Size: 987 B |
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2012-2017, Matt Godbolt
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
define({
|
||||
load: function (name, req, onLoad, config) {
|
||||
if (config.isBuild) return onLoad(null); // optimizer build
|
||||
|
||||
req(['jquery'], function ($) {
|
||||
$.ajax({type: "GET", url: name}).done(function (response) {
|
||||
onLoad(response);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
+3
-7
@@ -113,7 +113,7 @@ define(function (require) {
|
||||
self.eventHub.emit('compilerClose', self.id);
|
||||
}, this);
|
||||
container.on('resize', this.resize, this);
|
||||
container.on('shown', this.refresh, this);
|
||||
container.on('shown', this.resize, this);
|
||||
container.on('open', function () {
|
||||
self.eventHub.emit('compilerOpen', self.id);
|
||||
self.updateFontScale();
|
||||
@@ -154,10 +154,6 @@ define(function (require) {
|
||||
this.saveState();
|
||||
}
|
||||
|
||||
Compiler.prototype.refresh = function () {
|
||||
this.outputEditor.refresh();
|
||||
};
|
||||
|
||||
// TODO: need to call resize if either .top-bar or .bottom-bar resizes, which needs some work.
|
||||
// Issue manifests if you make a window where one compiler is small enough that the buttons spill onto two lines:
|
||||
// reload the page and the bottom-bar is off the bottom until you scroll a tiny bit.
|
||||
@@ -165,7 +161,7 @@ define(function (require) {
|
||||
var topBarHeight = this.domRoot.find(".top-bar").outerHeight(true);
|
||||
var bottomBarHeight = this.domRoot.find(".bottom-bar").outerHeight(true);
|
||||
this.outputEditor.setSize(this.domRoot.width(), this.domRoot.height() - topBarHeight - bottomBarHeight);
|
||||
this.refresh();
|
||||
this.outputEditor.refresh();
|
||||
};
|
||||
|
||||
// Gets the filters that will actually be used (accounting for issues with binary
|
||||
@@ -218,7 +214,7 @@ define(function (require) {
|
||||
}, this), 500);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/compile',
|
||||
url: '/api/compiler/' + encodeURIComponent(request.compiler) + '/compile',
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
data: jsonRequest,
|
||||
|
||||
+2
-6
@@ -122,14 +122,10 @@ define(function (require) {
|
||||
this.debouncedEmitChange();
|
||||
}, this));
|
||||
|
||||
function refresh() {
|
||||
self.editor.refresh();
|
||||
}
|
||||
|
||||
function resize() {
|
||||
var topBarHeight = self.domRoot.find(".top-bar").outerHeight(true);
|
||||
self.editor.setSize(self.domRoot.width(), self.domRoot.height() - topBarHeight);
|
||||
refresh();
|
||||
self.editor.refresh();
|
||||
}
|
||||
|
||||
this.domRoot.find('.load-save').click(_.bind(function () {
|
||||
@@ -141,7 +137,7 @@ define(function (require) {
|
||||
}, this));
|
||||
|
||||
container.on('resize', resize);
|
||||
container.on('shown', refresh);
|
||||
container.on('shown', resize);
|
||||
container.on('open', function () {
|
||||
self.eventHub.emit('editorOpen', self.id);
|
||||
});
|
||||
|
||||
+16
-1
@@ -6,7 +6,16 @@
|
||||
|
||||
.navbar {
|
||||
border-radius: 0;
|
||||
margin-bottom: 5px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.navbar-inverse {
|
||||
background-color: #226;
|
||||
}
|
||||
|
||||
.navbar-inverse .navbar-brand {
|
||||
color: #ddd;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.float-link {
|
||||
@@ -213,4 +222,10 @@ pre.content {
|
||||
.compile-time {
|
||||
font-size: x-small;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.url-parse-info {
|
||||
font-size: small;
|
||||
margin-top: 1em;
|
||||
font-style: italic;
|
||||
}
|
||||
+33
-2
@@ -13,12 +13,23 @@
|
||||
<div class="navbar navbar-inverse">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
|
||||
data-target="#navbar-collapse" aria-expanded="false">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="#">Compiler Explorer ‐ <span class="language-name"></span></a>
|
||||
</div>
|
||||
<li class="navbar-collapse collapse">
|
||||
<li class="navbar-collapse collapse" id="navbar-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="https://www.patreon.com/mattgodbolt">
|
||||
<img height="20" width="20" src="assets/patreon_logo.png">
|
||||
Become a Patron</a></li>
|
||||
<li class="if-github-enabled">
|
||||
<a href="https://github.com/mattgodbolt/compiler-explorer">Source on GitHub</a>
|
||||
<a href="https://github.com/mattgodbolt/compiler-explorer">
|
||||
<img height="20" width="20" src="assets/GitHub-Mark-20px.png"> Source on GitHub</a>
|
||||
</li>
|
||||
<li><a href="#" id="share">Share</a></li>
|
||||
<li class="dropdown if-share-enabled">
|
||||
@@ -39,6 +50,7 @@
|
||||
<li class="divider"></li>
|
||||
<li><a href="#" id="ui-reset">Reset UI layout</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="#" id="thanks-to">Thanks to...</a></li>
|
||||
<li><a href="http://xania.org/201609/how-compiler-explorer-runs-on-amazon">How it works</a></li>
|
||||
<li><a href="mailto:matt@godbolt.org">Contact the author</a></li>
|
||||
<li><a href="http://xania.org/MattGodbolt" rel="author">About the author</a></li>
|
||||
@@ -243,5 +255,24 @@ int square(int num) {
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
<div class="modal fade gl_keep" id="alert">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Something alert worthy</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
</div>
|
||||
<!-- model-body -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+18
-1
@@ -64,6 +64,7 @@ define(function (require) {
|
||||
var clipboard = require('clipboard');
|
||||
var Hub = require('hub');
|
||||
var Raven = require('raven-js');
|
||||
var Alert = require('alert');
|
||||
|
||||
function start() {
|
||||
analytics.initialise();
|
||||
@@ -71,6 +72,7 @@ define(function (require) {
|
||||
|
||||
var options = require('options');
|
||||
$('.language-name').text(options.language);
|
||||
var alert = new Alert();
|
||||
|
||||
var safeLang = options.language.toLowerCase().replace(/[^a-z_]+/g, '');
|
||||
var defaultSrc = $('.template .lang.' + safeLang).text().trim();
|
||||
@@ -87,7 +89,17 @@ define(function (require) {
|
||||
|
||||
var config;
|
||||
if (!options.embedded) {
|
||||
config = url.deserialiseState(window.location.hash.substr(1));
|
||||
var serializedState = window.location.hash.substr(1);
|
||||
if (serializedState) {
|
||||
try {
|
||||
config = url.deserialiseState(serializedState);
|
||||
} catch (exception) {
|
||||
alert.alert("Unable to parse URL",
|
||||
"<div>Compiler Explorer was unable to parse the URL hash. " +
|
||||
"Please check it and try again.</div>" +
|
||||
"<div class='url-parse-info'>" + exception + "</div>");
|
||||
}
|
||||
}
|
||||
if (config) {
|
||||
// replace anything in the default config with that from the hash
|
||||
config = _.extend(defaultConfig, config);
|
||||
@@ -156,6 +168,11 @@ define(function (require) {
|
||||
window.localStorage.removeItem('gl');
|
||||
window.location.reload();
|
||||
});
|
||||
$('#thanks-to').click(function () {
|
||||
$.get('thanks.html', function (result) {
|
||||
alert.alert("Special thanks to", $(result));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(start);
|
||||
|
||||
+2
-2
@@ -25,8 +25,8 @@
|
||||
|
||||
define(function (require) {
|
||||
"use strict";
|
||||
var $ = require('jquery');
|
||||
var options = $.ajax({type: "GET", url: 'client-options.json', async: false}).responseJSON;
|
||||
var options = require('./async-get!client-options.json');
|
||||
options.embedded = window.location.pathname === "/embed.html";
|
||||
return options;
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<body>
|
||||
<ul>
|
||||
<li>Glenn</li>
|
||||
<li>Alexander Guettler</li>
|
||||
<li>Alejandro Lucena</li>
|
||||
<li>xyz</li>
|
||||
<li>Jon Kalb</li>
|
||||
<li>Reuben Scratton</li>
|
||||
<li>Gaëtan Barel</li>
|
||||
<li>Zhihao Yuan</li>
|
||||
<li>David Jones</li>
|
||||
<li>relgukxilef</li>
|
||||
<li>Markus Lanner</li>
|
||||
<li>Igor Ivanov</li>
|
||||
<li>Thomas Trummer</li>
|
||||
<li>Andy Bond</li>
|
||||
<li>Michael Spencer</li>
|
||||
<li>Dmitry Kozhevnikov</li>
|
||||
<li>David Starr</li>
|
||||
<li>Nejc Vivod</li>
|
||||
<li>Thomas Goyne</li>
|
||||
<li>Federico Lebron</li>
|
||||
<li>François Andrieux</li>
|
||||
<li>Mark Atkinson</li>
|
||||
<li>Thomas Pape</li>
|
||||
<li>Robin Jubber</li>
|
||||
<li>Laurynas Biveinis</li>
|
||||
<li>Robert Snell</li>
|
||||
<li>Michal Dominiak</li>
|
||||
<li>Chris Newland</li>
|
||||
<li>Miguel Escudero</li>
|
||||
<li>Ian Carroll</li>
|
||||
<li>Jonathan Anderson</li>
|
||||
<li>Vimarsh Raina</li>
|
||||
<li>Arne Mertz</li>
|
||||
<li>Gabriel Garcia</li>
|
||||
<li>Malcolm Rowe</li>
|
||||
<li>Peter Bindels</li>
|
||||
<li>Jon Raymond</li>
|
||||
<li>Bene</li>
|
||||
<li>Billy</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
+8
-5
@@ -34,7 +34,7 @@ define(function (require) {
|
||||
|
||||
function convertOldState(state) {
|
||||
var sc = state.compilers[0];
|
||||
if (!sc) return false;
|
||||
if (!sc) throw new Error("Unable to determine compiler from old state");
|
||||
var content = [];
|
||||
var source;
|
||||
if (sc.sourcez) {
|
||||
@@ -68,7 +68,7 @@ define(function (require) {
|
||||
state = GoldenLayout.unminifyConfig(state);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
throw new Error("Invalid version '" + state.version + "'");
|
||||
}
|
||||
return state;
|
||||
}
|
||||
@@ -83,21 +83,24 @@ define(function (require) {
|
||||
|
||||
function deserialiseState(stateText) {
|
||||
var state;
|
||||
var exception;
|
||||
try {
|
||||
state = unrisonify(stateText);
|
||||
if (state && state.z) {
|
||||
state = unrisonify(lzstring.decompressFromBase64(state.z));
|
||||
}
|
||||
} catch (ignored) {
|
||||
} catch (ex) {
|
||||
exception = ex;
|
||||
}
|
||||
|
||||
|
||||
if (!state) {
|
||||
try {
|
||||
state = $.parseJSON(decodeURIComponent(stateText));
|
||||
} catch (ignored) {
|
||||
} catch (ex) {
|
||||
if (!exception) exception = ex;
|
||||
}
|
||||
}
|
||||
if (!state && exception) throw exception;
|
||||
return loadState(state);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.00.24224.0
|
||||
|
||||
include listing.inc
|
||||
|
||||
INCLUDELIB LIBCMT
|
||||
INCLUDELIB OLDNAMES
|
||||
|
||||
PUBLIC main
|
||||
PUBLIC ??$make_array@$00$02$04$01$02$04$05$03$07$08$01@@YA?AV?$array@H$0L@@std@@XZ ; make_array<1,3,5,2,3,5,6,4,8,9,2>
|
||||
PUBLIC ??A?$array@H$0L@@std@@QEBAAEBH_K@Z ; std::array<int,11>::operator[]
|
||||
; Function compile flags: /Ogtpy
|
||||
; File z:\home\mgodbolt\apps\windows\14.0.24224-pre\lib\native\include\array
|
||||
; COMDAT ??A?$array@H$0L@@std@@QEBAAEBH_K@Z
|
||||
_TEXT SEGMENT
|
||||
this$ = 8
|
||||
_Pos$ = 16
|
||||
??A?$array@H$0L@@std@@QEBAAEBH_K@Z PROC ; std::array<int,11>::operator[], COMDAT
|
||||
|
||||
; 167 : #if _ITERATOR_DEBUG_LEVEL == 0
|
||||
; 168 : return (_Elems[_Pos]);
|
||||
|
||||
00000 48 8d 04 91 lea rax, QWORD PTR [rcx+rdx*4]
|
||||
|
||||
; 169 :
|
||||
; 170 : #else /* _ITERATOR_DEBUG_LEVEL == 0 */
|
||||
; 171 : return (_Size <= _Pos
|
||||
; 172 : ? (_Bad_subscript(), _Elems[_Pos])
|
||||
; 173 : : _Elems[_Pos]);
|
||||
; 174 : #endif /* _ITERATOR_DEBUG_LEVEL == 0 */
|
||||
; 175 : }
|
||||
|
||||
00004 c3 ret 0
|
||||
??A?$array@H$0L@@std@@QEBAAEBH_K@Z ENDP ; std::array<int,11>::operator[]
|
||||
_TEXT ENDS
|
||||
; Function compile flags: /Ogtpy
|
||||
; File z:\tmp\example.cpp
|
||||
; COMDAT ??$make_array@$00$02$04$01$02$04$05$03$07$08$01@@YA?AV?$array@H$0L@@std@@XZ
|
||||
_TEXT SEGMENT
|
||||
$T1 = 8
|
||||
??$make_array@$00$02$04$01$02$04$05$03$07$08$01@@YA?AV?$array@H$0L@@std@@XZ PROC ; make_array<1,3,5,2,3,5,6,4,8,9,2>, COMDAT
|
||||
|
||||
; 6 : return std::array<int, sizeof...(vars)>{vars...};
|
||||
|
||||
00000 c7 01 01 00 00
|
||||
00 mov DWORD PTR [rcx], 1
|
||||
00006 48 8b c1 mov rax, rcx
|
||||
00009 c7 41 04 03 00
|
||||
00 00 mov DWORD PTR [rcx+4], 3
|
||||
00010 c7 41 08 05 00
|
||||
00 00 mov DWORD PTR [rcx+8], 5
|
||||
00017 c7 41 0c 02 00
|
||||
00 00 mov DWORD PTR [rcx+12], 2
|
||||
0001e c7 41 10 03 00
|
||||
00 00 mov DWORD PTR [rcx+16], 3
|
||||
00025 c7 41 14 05 00
|
||||
00 00 mov DWORD PTR [rcx+20], 5
|
||||
0002c c7 41 18 06 00
|
||||
00 00 mov DWORD PTR [rcx+24], 6
|
||||
00033 c7 41 1c 04 00
|
||||
00 00 mov DWORD PTR [rcx+28], 4
|
||||
0003a c7 41 20 08 00
|
||||
00 00 mov DWORD PTR [rcx+32], 8
|
||||
00041 c7 41 24 09 00
|
||||
00 00 mov DWORD PTR [rcx+36], 9
|
||||
00048 c7 41 28 02 00
|
||||
00 00 mov DWORD PTR [rcx+40], 2
|
||||
|
||||
; 7 : }
|
||||
|
||||
0004f c3 ret 0
|
||||
??$make_array@$00$02$04$01$02$04$05$03$07$08$01@@YA?AV?$array@H$0L@@std@@XZ ENDP ; make_array<1,3,5,2,3,5,6,4,8,9,2>
|
||||
_TEXT ENDS
|
||||
; Function compile flags: /Ogtpy
|
||||
; File z:\tmp\example.cpp
|
||||
; COMDAT main
|
||||
_TEXT SEGMENT
|
||||
main PROC ; COMDAT
|
||||
|
||||
; 11 : constexpr auto a = make_array<1,3,5,2,3,5,6,4,8,9,2>();
|
||||
; 12 :
|
||||
; 13 : return a[2];
|
||||
|
||||
00000 b8 05 00 00 00 mov eax, 5
|
||||
|
||||
; 14 : }
|
||||
|
||||
00005 c3 ret 0
|
||||
main ENDP
|
||||
_TEXT ENDS
|
||||
END
|
||||
@@ -0,0 +1,94 @@
|
||||
[
|
||||
{
|
||||
"source": null,
|
||||
"text": "std::array<int,11>::operator[], COMDAT PROC"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " lea rax, QWORD PTR [rcx+rdx*4]"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " ret 0"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": "std::array<int,11>::operator[] ENDP"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": "make_array<1,3,5,2,3,5,6,4,8,9,2>, COMDAT PROC"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " mov DWORD PTR [rcx], 1"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " mov rax, rcx"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " mov DWORD PTR [rcx+4], 3"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " mov DWORD PTR [rcx+8], 5"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " mov DWORD PTR [rcx+12], 2"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " mov DWORD PTR [rcx+16], 3"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " mov DWORD PTR [rcx+20], 5"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " mov DWORD PTR [rcx+24], 6"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " mov DWORD PTR [rcx+28], 4"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " mov DWORD PTR [rcx+32], 8"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " mov DWORD PTR [rcx+36], 9"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " mov DWORD PTR [rcx+40], 2"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " ret 0"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": "make_array<1,3,5,2,3,5,6,4,8,9,2> ENDP"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": "main PROC; COMDAT"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " mov eax, 5"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": " ret 0"
|
||||
},
|
||||
{
|
||||
"source": null,
|
||||
"text": "main ENDP"
|
||||
}
|
||||
]
|
||||
@@ -98,6 +98,7 @@ function testFilter(filename, suffix, filters) {
|
||||
// bless("cases/cl-regex.asm", "cases/cl-regex.asm.dlcb.json", {directives: true, labels: true, commentOnly: true, binary:true});
|
||||
// bless("cases/cl-maxarray.asm", "cases/cl-maxarray.asm.dlcb.json", {directives: true, labels: true, commentOnly: true, binary:true});
|
||||
// bless("cases/cl64-sum.asm", "cases/cl64-sum.asm.dlcb.json", {directives: true, labels: true, commentOnly: true, binary:true});
|
||||
// bless("cases/cl-main-opt-out.asm", "cases/cl-main-opt-out.directives.labels.comments.json", {directives: true, labels: true, commentOnly: true});
|
||||
// bless("cases/avr-loop.asm", "cases/avr-loop.asm.directives.labels.comments.json", {directives: true, labels: true, commentOnly: true});
|
||||
// bless("cases/bug-192.asm", "cases/bug-192.asm.directives.labels.comments.json", {directives: true, labels: true, commentOnly: true});
|
||||
// bless("cases/arm-moose.asm", "cases/arm-moose.asm.directives.labels.comments.json", {directives: true, labels: true, commentOnly: true});
|
||||
@@ -133,3 +134,4 @@ describe('Filter test cases', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user