This commit is contained in:
2026-05-25 23:13:33 -06:00
parent 198a85afe4
commit aca410fbc2
5 changed files with 16 additions and 99 deletions

94
runtime/Cargo.lock generated
View File

@@ -63,12 +63,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
[[package]]
name = "foldhash"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
[[package]]
name = "gyehoek"
version = "0.1.0"
@@ -77,7 +71,6 @@ dependencies = [
"const_panic",
"internment",
"libc",
"string-interner",
]
[[package]]
@@ -88,16 +81,7 @@ checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
dependencies = [
"allocator-api2",
"equivalent",
"foldhash 0.1.5",
]
[[package]]
name = "hashbrown"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
dependencies = [
"foldhash 0.2.0",
"foldhash",
]
[[package]]
@@ -106,7 +90,7 @@ version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "636d4b0f6a39fd684effe2a73f5310df16a3fa7954c26d36833e98f44d1977a2"
dependencies = [
"hashbrown 0.15.5",
"hashbrown",
]
[[package]]
@@ -115,88 +99,14 @@ version = "0.2.186"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
[[package]]
name = "proc-macro2"
version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
dependencies = [
"proc-macro2",
]
[[package]]
name = "serde"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
dependencies = [
"serde_core",
]
[[package]]
name = "serde_core"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "string-interner"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad3df9b59e2eded8d825c7c4363ad339a20fb6bc0b9a4778560f518f59910b15"
dependencies = [
"hashbrown 0.16.1",
"serde",
]
[[package]]
name = "syn"
version = "2.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "typewit"
version = "1.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "214ca0b2191785cbc06209b9ca1861e048e39b5ba33574b3cedd58363d5bb5f6"
[[package]]
name = "unicode-ident"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"

View File

@@ -15,7 +15,6 @@ bdwgc-alloc = { version = "0.6.13"
const_panic = "0.2.15"
internment = "0.8.6"
libc = "0.2.186"
string-interner = "0.20.0"
[patch.crates-io]
bdwgc-alloc = { git = 'https://git.deertopia.net/msyds/bdwgc-rust.git' }

View File

@@ -17,3 +17,6 @@ pub extern "C" fn scm_hash (ptr : *const u8, len : usize) -> u64 {
let bytes = unsafe { slice::from_raw_parts (ptr, len) };
crate::obarray::hash (str::from_utf8 (bytes).unwrap ())
}
// #[unsafe(no_mangle)]
// pub extern "C" fn scm_lookup (name : scm_)

View File

@@ -1,20 +1,19 @@
use std::{ops::DerefMut, sync::{LazyLock, Mutex, RwLock}};
use internment::Intern;
// mod fnv1a;
// use fnv1a::{FNV1a, SymbolHash};
use string_interner::{StringInterner, symbol::SymbolU32};
// use string_interner::{StringInterner, symbol::SymbolU32};
pub struct Obarray (
LazyLock <RwLock <StringInterner <string_interner::DefaultBackend>>>
LazyLock <RwLock < <string_interner::DefaultBackend>>>
);
impl Obarray {
pub const fn new () -> Obarray {
Obarray (LazyLock::new (|| RwLock::new (StringInterner::new ())))
}
}
impl Obarray {
pub fn intern (&self, name : &str) -> SymbolU32 {
let mut r = symbols.0.write ().unwrap ();
r.deref_mut ().get_or_intern (name)

View File

@@ -3,7 +3,7 @@
use std::slice;
use string_interner::Symbol as _;
use internment::Intern;
use crate::{gc, obarray};
@@ -156,5 +156,11 @@ pub fn make_symbol (name : &str) -> scm_bits {
pack_ptr (r)
}
pub fn string_to_symbol (str : scm_bits) {
pub fn make_symbol_off_heap (name : scm_bits) -> [scm_bits; 2] {
[ tc7_symbol, name ]
}
pub fn string_to_symbol (str : scm_bits) -> scm_bits {
let r = Intern::new (make_symbol_off_heap (str));
pack_ptr (r.as_ref () as *const scm_bits)
}