Browse Source

Early rust support

dev/git-series/gccdum
Matt Godbolt 9 years ago
parent
commit
43a2173b38
  1. 3
      app.js
  2. 2
      etc/config/builtin.rust.properties
  3. 4
      etc/config/gcc-explorer.lud-ldnmg01.properties
  4. 8
      etc/config/gcc-explorer.rust.properties
  5. 0
      examples/c++/max_array.cpp
  6. 0
      examples/c++/max_array_opt.cpp
  7. 0
      examples/c++/sum_over_array.cpp
  8. 0
      examples/c++/sum_over_array_opt.cpp
  9. 7
      examples/rust/max_array.rs
  10. 2
      lib/properties.js
  11. 5
      lib/sources/builtin.js

3
app.js

@ -146,7 +146,8 @@ function compile(req, res) {
if (filters["intel"] == "true") syntax = '-masm=intel';
options = options.concat([syntax]);
}
options = options.concat(['-g', '-o', outputFilename, '-S', inputFilename]);
var compileToAsm = props.get("gcc-explorer", "compileToAsm", "-S").split(" ");
options = options.concat(['-g', '-o', outputFilename]).concat(compileToAsm).concat([inputFilename]);
var file = fs.openSync(inputFilename, "w");
fs.writeSync(file, source);
fs.closeSync(file);

2
etc/config/builtin.rust.properties

@ -0,0 +1,2 @@
sourcepath=./examples/rust/
extensionRe=.*\.rs$

4
etc/config/gcc-explorer.lud-ldnmg01.properties

@ -1,7 +1,7 @@
# Default settings for GCC Explorer.
port=10240
#port=10240
compileTimeoutMs=5000
compilers=/usr/bin/g++-4.4:/usr/bin/g++-4.5:/usr/bin/g++-4.6:/usr/bin/g++-4.7:/usr/bin/clang++:/home/mgodbolt/apps/intel-icc-oss/bin/icc:/site/apps/gcc-4.7.2-drw.patched.6/bin/g++:/site/apps/gcc-4.8.0-drw.1/bin/g++
#compilers=/usr/bin/g++-4.4:/usr/bin/g++-4.5:/usr/bin/g++-4.6:/usr/bin/g++-4.7:/usr/bin/clang++:/home/mgodbolt/apps/intel-icc-oss/bin/icc:/site/apps/gcc-4.7.2-drw.patched.6/bin/g++:/site/apps/gcc-4.8.0-drw.1/bin/g++
#compiler-wrapper=./c-preload/compiler-wrapper
#compilers=/usr/bin/gdc:/usr/bin/gdc-4.4:/usr/bin/gdc-4.6
#compileFilename=example.d

8
etc/config/gcc-explorer.rust.properties

@ -0,0 +1,8 @@
port=10242
compileTimeoutMs=1500
compilers=/usr/local/bin/rustc
compileFilename=example.rs
compileToAsm=--emit asm --crate-type staticlib
#compiler-wrapper=./c-preload/compiler-wrapper
#max-asm-size=262144
#cacheMb=100

0
examples/max_array.cpp → examples/c++/max_array.cpp

0
examples/max_array_opt.cpp → examples/c++/max_array_opt.cpp

0
examples/sum_over_array.cpp → examples/c++/sum_over_array.cpp

0
examples/sum_over_array_opt.cpp → examples/c++/sum_over_array_opt.cpp

7
examples/rust/max_array.rs

@ -0,0 +1,7 @@
pub fn maxArray(x: &mut[int, ..65536], y: &[int, ..65536]) {
for i in range(0u, 65536) {
if y[i] > x[i] {
x[i] = y[i];
}
}
}

2
lib/properties.js

@ -34,7 +34,7 @@ function findProps(base, elem) {
}
function debug(string) {
//console.log("prop: " + string);
console.log("prop: " + string);
}
function get(base, property, defaultValue) {

5
lib/sources/builtin.js

@ -4,9 +4,10 @@ var props = require('../properties.js'),
path = require('path'),
fs = require('fs');
var sourcePath = props.get('builtin', 'sourcepath', './examples');
var sourcePath = props.get('builtin', 'sourcepath', './examples/c++');
var sourceMatch = new RegExp(props.get('builtin', 'extensionRe', '.*\.cpp$'));
var examples = fs.readdirSync(sourcePath)
.filter(function(file) { return file.match(/.*\.cpp$/); })
.filter(function(file) { return file.match(sourceMatch); })
.map(function(file) {
var nicename = file.replace(/\.cpp$/, '');
return { urlpart: nicename, name: nicename.replace(/_/g, ' '), path: path.join(sourcePath, file) };

Loading…
Cancel
Save