Skip to content

Commit

Permalink
dylib compilation and runtime loading (#127)
Browse files Browse the repository at this point in the history
Co-authored-by: tjjfvi <[email protected]>
  • Loading branch information
enricozb and tjjfvi authored May 2, 2024
1 parent 8a9a009 commit 87e6056
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 34 deletions.
13 changes: 12 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hvm-core"
version = "0.2.25"
version = "0.2.26"
edition = "2021"
description = "HVM-Core is a massively parallel Interaction Combinator evaluator."
license = "MIT"
Expand All @@ -27,6 +27,7 @@ debug = "full"
TSPL = "0.0.9"
arrayvec = "0.7.4"
clap = { version = "4.5.1", features = ["derive"], optional = true }
libloading = "0.8.3"
nohash-hasher = { version = "0.2.0" }
ordered-float = "4.2.0"
parking_lot = "0.12.1"
Expand Down
8 changes: 8 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use std::{env, process::Command};

fn main() {
let rustc_version = Command::new(env::var("RUSTC").unwrap()).arg("--version").output().unwrap().stdout;
let rustc_version = String::from_utf8(rustc_version).unwrap();

println!("cargo::rustc-env=RUSTC_VERSION={rustc_version}");
}
5 changes: 5 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"dereferencable",
"dref",
"dups",
"dylib",
"dylibs",
"effectful",
"fmts",
"fuzzer",
Expand All @@ -24,6 +26,8 @@
"ilog",
"inlinees",
"insta",
"libhvmc",
"libloading",
"lldb",
"lnet",
"lnum",
Expand All @@ -48,6 +52,7 @@
"rnet",
"rnum",
"rsplit",
"rustc",
"rwts",
"sigabrt",
"skippable",
Expand Down
6 changes: 5 additions & 1 deletion src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ fn _compile_host(host: &Host) -> Result<String, fmt::Error> {
continue;
}

let fields = refs.iter().map(|r| format!("def_{}", sanitize_name(r))).collect::<Vec<_>>().join(", ");
let fields = refs
.iter()
.map(|r| format!("def_{rust_name}: def_{rust_name}.clone()", rust_name = sanitize_name(r)))
.collect::<Vec<_>>()
.join(", ");

writeln!(
code,
Expand Down
Loading

0 comments on commit 87e6056

Please sign in to comment.