diff --git a/.gitignore b/.gitignore index 55de121..90624f7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ Cargo.lock **/*.o test +test.exe +test.ilk +test.pdb *.dSYM .vscode proptest-regressions/ \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 10c0cfa..9531890 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,12 +12,12 @@ path = "src/lib.rs" clap = { version = "^3.0.14", features = ["derive"] } codespan = "0.11.1" codespan-reporting = "0.11.1" -cranelift-codegen = "0.99.1" -cranelift-jit = "0.99.1" -cranelift-frontend = "0.99.1" -cranelift-module = "0.99.1" -cranelift-native = "0.99.1" -cranelift-object = "0.99.1" +cranelift-codegen = "0.99.2" +cranelift-jit = "0.99.2" +cranelift-frontend = "0.99.2" +cranelift-module = "0.99.2" +cranelift-native = "0.99.2" +cranelift-object = "0.99.2" internment = { version = "0.7.0", default-features = false, features = ["arc"] } lalrpop-util = "^0.20.0" lazy_static = "^1.4.0" diff --git a/src/backend.rs b/src/backend.rs index 9667665..4ac8e83 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -60,6 +60,7 @@ pub struct Backend { defined_strings: HashMap, defined_symbols: HashMap, output_buffer: Option, + platform: Triple, } impl Backend { @@ -90,6 +91,7 @@ impl Backend { defined_strings: HashMap::new(), defined_symbols: HashMap::new(), output_buffer, + platform: Triple::host(), }) } @@ -128,6 +130,7 @@ impl Backend { defined_strings: HashMap::new(), defined_symbols: HashMap::new(), output_buffer: None, + platform, }) } diff --git a/src/backend/eval.rs b/src/backend/eval.rs index 306c1fc..78ed7a5 100644 --- a/src/backend/eval.rs +++ b/src/backend/eval.rs @@ -31,7 +31,8 @@ impl Backend { let compiled_bytes = jitter.bytes(function_id); let compiled_function = unsafe { std::mem::transmute::<_, fn() -> ()>(compiled_bytes) }; compiled_function(); - Ok(jitter.output()) + let output = jitter.output(); + Ok(output) } } diff --git a/src/backend/into_crane.rs b/src/backend/into_crane.rs index 759eab1..e398e3d 100644 --- a/src/backend/into_crane.rs +++ b/src/backend/into_crane.rs @@ -43,7 +43,7 @@ impl Backend { let basic_signature = Signature { params: vec![], returns: vec![], - call_conv: CallConv::SystemV, + call_conv: CallConv::triple_default(&self.platform), }; // this generates the handle for the function that we'll eventually want to @@ -211,7 +211,7 @@ impl Backend { // so we register it using the function ID and our builder context. However, the // result of this function isn't actually super helpful. So we ignore it, unless // it's an error. - let _ = self.module.define_function(func_id, &mut ctx)?; + self.module.define_function(func_id, &mut ctx)?; // done! Ok(func_id)