Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental JIT compiler #3292

Closed
wants to merge 10 commits into from
3 changes: 2 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ RUSTC_INPUTS := $(S)src/rustc/driver/rustc.rs
######################################################################

# FIXME: x86-ism
LLVM_COMPONENTS=x86 ipo bitreader bitwriter linker asmparser
LLVM_COMPONENTS=x86 ipo bitreader bitwriter linker asmparser jit mcjit \
interpreter

define DEF_LLVM_VARS
# The configure script defines these variables with the target triples
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ do
LLVM_TARGET="--target=$t"

# Disable unused LLVM features
LLVM_OPTS="$LLVM_DBG_OPTS --disable-docs --disable-jit \
LLVM_OPTS="$LLVM_DBG_OPTS --disable-docs \
--enable-bindings=none --disable-threads \
--disable-pthreads"

Expand Down
167 changes: 0 additions & 167 deletions mk/libuv/ia32/win/src/libuv/uv.target.mk.bak

This file was deleted.

7 changes: 6 additions & 1 deletion src/compiletest/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,10 @@ type config = {
// Flags to pass to the compiler
rustcflags: Option<~str>,

// Run tests using the JIT
jit: bool,

// Explain what's going on
verbose: bool};
verbose: bool

};
5 changes: 4 additions & 1 deletion src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ fn parse_config(args: ~[~str]) -> config {
getopts::reqopt(~"mode"), getopts::optflag(~"ignored"),
getopts::optopt(~"runtool"), getopts::optopt(~"rustcflags"),
getopts::optflag(~"verbose"),
getopts::optopt(~"logfile")];
getopts::optopt(~"logfile"),
getopts::optflag(~"jit")];

assert (vec::is_not_empty(args));
let args_ = vec::tail(args);
Expand Down Expand Up @@ -64,6 +65,7 @@ fn parse_config(args: ~[~str]) -> config {
|s| Path(s)),
runtool: getopts::opt_maybe_str(matches, ~"runtool"),
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
jit: getopts::opt_present(matches, ~"jit"),
verbose: getopts::opt_present(matches, ~"verbose")};
}

Expand All @@ -81,6 +83,7 @@ fn log_config(config: config) {
logv(c, fmt!("filter: %s", opt_str(config.filter)));
logv(c, fmt!("runtool: %s", opt_str(config.runtool)));
logv(c, fmt!("rustcflags: %s", opt_str(config.rustcflags)));
logv(c, fmt!("jit: %b", config.jit));
logv(c, fmt!("verbose: %b", config.verbose));
logv(c, fmt!("\n"));
}
Expand Down
41 changes: 33 additions & 8 deletions src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ fn run_cfail_test(config: config, props: test_props, testfile: &Path) {
}

fn run_rfail_test(config: config, props: test_props, testfile: &Path) {
let mut procres = compile_test(config, props, testfile);
let procres = if !config.jit {
let procres = compile_test(config, props, testfile);

if procres.status != 0 { fatal_procres(~"compilation failed!", procres); }
if procres.status != 0 {
fatal_procres(~"compilation failed!", procres);
}

procres = exec_compiled_test(config, props, testfile);
exec_compiled_test(config, props, testfile)
} else {
jit_test(config, props, testfile)
};

// The value our Makefile configures valgrind to return on failure
const valgrind_err: int = 100;
Expand All @@ -76,13 +82,23 @@ fn check_correct_failure_status(procres: procres) {
}

fn run_rpass_test(config: config, props: test_props, testfile: &Path) {
let mut procres = compile_test(config, props, testfile);
if !config.jit {
let mut procres = compile_test(config, props, testfile);

if procres.status != 0 { fatal_procres(~"compilation failed!", procres); }
if procres.status != 0 {
fatal_procres(~"compilation failed!", procres);
}

procres = exec_compiled_test(config, props, testfile);

procres = exec_compiled_test(config, props, testfile);
if procres.status != 0 {
fatal_procres(~"test run failed!", procres);
}
} else {
let mut procres = jit_test(config, props, testfile);

if procres.status != 0 { fatal_procres(~"test run failed!", procres); }
if procres.status != 0 { fatal_procres(~"jit failed!", procres); }
}
}

fn run_pretty_test(config: config, props: test_props, testfile: &Path) {
Expand Down Expand Up @@ -295,10 +311,19 @@ type procres = {status: int, stdout: ~str, stderr: ~str, cmdline: ~str};

fn compile_test(config: config, props: test_props,
testfile: &Path) -> procres {
compile_test_(config, props, testfile, [])
}

fn jit_test(config: config, props: test_props, testfile: &Path) -> procres {
compile_test_(config, props, testfile, [~"--jit"])
}

fn compile_test_(config: config, props: test_props,
testfile: &Path, extra_args: &[~str]) -> procres {
let link_args = ~[~"-L", aux_output_dir_name(config, testfile).to_str()];
compose_and_run_compiler(
config, props, testfile,
make_compile_args(config, props, link_args,
make_compile_args(config, props, link_args + extra_args,
make_exe_name, testfile),
None)
}
Expand Down
Loading