theseus-os / Theseus

Theseus is a modern OS written from scratch in Rust that explores 𝐢𝐧𝐭𝐫𝐚𝐥𝐢𝐧𝐠𝐮𝐚𝐥 𝐝𝐞𝐬𝐢𝐠𝐧: closing the semantic gap between compiler and hardware by maximally leveraging the power of language safety and affine types. Theseus aims to shift OS responsibilities like resource management into the compiler.
https://www.theseus-os.com/
MIT License
2.92k stars 172 forks source link

Add support for `std` #1069

Open tsoutsman opened 1 year ago

tsoutsman commented 1 year ago

The CI is too slow to even check out the rust submodule, let alone build the compiler. Probably best to create a separate branch rather than merging into theseus_main.

To upstream this we would have to:

tsoutsman commented 1 year ago

@kevinaboos should be ready for review

kevinaboos commented 1 year ago

@kevinaboos should be ready for review

Great! I'll take a look tonight or tomorrow late afternoon.

tsoutsman commented 1 year ago

couldn't we just have the shim and libtheseus layers convert to/from those existing ABI-stable FFI types, regardless of whether they came from our lib or another lib?

So not really. E.g. we call app_io::stdout and get an alloc::sync::Arc<dyn Writer>. We can't call stabby::Arc::from_raw(alloc::sync::Arc::into_raw(writer)) because stabby::Arc and sync::Arc could have different layouts. And there's not really much else we could do. We can't get an owned reference to the dyn Writer and so we can't turn it into a stabby trait object and wrap it in a stabby::Arc.

And conceptually that makes sense. writer is layed out in memory as an alloc::sync::Arc<dyn Writer> and there is no way we can interpret it as a stabby::Arc<vtable!(dyn Writer)> because they have different layouts.