rust runtime
build / build (push) Failing after 1m8s

This commit is contained in:
2026-07-17 19:40:48 -06:00
parent 85d34883a6
commit 8f46f744b5
10 changed files with 1951 additions and 10 deletions
+6
View File
@@ -15,3 +15,9 @@ XXXX XXXX XXXX XXXX XXXX XXXX XXXX XX00
zero indicates a 30-bit fixnum /
in the upper bits
#+end_example
| type/value | low bits |
|------------+----------|
| small int | 0 |
| ~false~ | 01 |
| ~true~ | 11 |
+11 -9
View File
@@ -21,8 +21,7 @@
haskellNix.overlay
(final: prev: {
gyehoek-wasmtime-wrapper = final.callPackage ./wasmtime.nix {};
})
(final: prev: {
gyehoek-runtime = final.callPackage ./runtime {};
gyehoek = final.haskell-nix.project' {
src = ./.;
compiler-nix-name = "ghc912";
@@ -42,7 +41,9 @@
})];
shell = {
withHoogle = true;
inputsFrom = [];
inputsFrom = [
final.gyehoek-runtime
];
tools = {
cabal = {};
haskell-language-server = {};
@@ -50,12 +51,13 @@
buildInputs = with final; [
haskellPackages.cabal-fmt
self.packages.${final.stdenv.hostPlatform.system}.shake
final.wabt
final.nodejs
final.wasm-tools
final.wac-cli
final.guile
final.gyehoek-wasmtime-wrapper
wabt
nodejs
wasm-tools
wac-cli
guile
gyehoek-wasmtime-wrapper
rust-analyzer
];
};
};
+1
View File
@@ -0,0 +1 @@
target/
+1865
View File
File diff suppressed because it is too large Load Diff
+9
View File
@@ -0,0 +1,9 @@
[package]
name = "gyehoek-runtime"
version = "0.1.0"
edition = "2024"
[dependencies]
clap = { version = "4.6.1", features = ["derive"] }
clio = { version = "0.3.5", features = ["clap-parse"] }
wasmtime = "46.0.1"
+12
View File
@@ -0,0 +1,12 @@
{ rustPlatform
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "gyehoek-runtime";
version = "0.1.0";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
doCheck = true;
})
+5
View File
@@ -0,0 +1,5 @@
use wasmtime::*;
pub fn say_hi (_caller : Caller<'_, u32>) {
println! ("hiiii~")
}
+35
View File
@@ -0,0 +1,35 @@
mod gyehoek;
use std::io;
use std::io::Read;
use clio::*;
use clap::Parser;
use wasmtime::*;
/// A runtime for Gyehoek scheme.
#[derive(Parser, Debug)]
#[command(name = "gyehoek", version, about, long_about = None)]
struct Args {
/// Input file
#[clap(value_parser)]
input: Input,
}
fn read<R : Read> (mut rdr : R) -> io::Result<Vec<u8>> {
let mut buf = vec! [];
rdr.read_to_end (&mut buf)?;
Ok (buf)
}
pub fn main () -> wasmtime::Result<()> {
let args = Args::parse ();
let engine = Engine::default ();
let module = Module::new (&engine, read (args.input)?)?;
let mut linker = Linker::new (&engine);
linker.func_wrap ("gyehoek", "say-hi", gyehoek::say_hi)?;
let mut store : Store<u32> = Store::new (&engine, 4);
let instance = linker.instantiate (&mut store, &module)?;
let main = instance.get_typed_func::<(),()> (&mut store, "main")?;
main.call (&mut store, ())?;
Ok (())
}
+6
View File
@@ -0,0 +1,6 @@
(module
(import "gyehoek" "say-hi" (func $say-hi))
(func (export "main")
(call $say-hi)
(call $say-hi)
(call $say-hi)))
+1 -1
View File
@@ -110,7 +110,7 @@ lowerVal g (ValLit l) =
(i32.const #{b'})
ref.i31
|]
where b' :: Int = if b then 1 else 0
where b' :: Int = if b then 0b11 else 0b01
_ -> _
lowerVal g (ValVar x) = [expr|(local.get #{l})|]