3 ms·
Regarding systems with segmented memory models, I think it would be kind of cool if a language like Rust, with its emphasis on both safety and zero-overhead abs
by mwcampbell 7y ago
Regarding systems with segmented memory models, I think it would be kind of cool if a language like Rust, with its emphasis on both safety and zero-overhead abstractions, could be cross-compiled for my first computer, the Apple IIGS, with its 65C816 processor. But I admit I don't want it enough to put any serious work into making it happen. Probably time to let that nostalgia go.
- zozbot234 7y agoYou'd need to get the architecture supported by LLVM first. This can be a hurdle, because LLVM backends need to be actively maintained to keep up with the rest of the code. The MC68K (far more popular than the 65C816) is still not supported for example, and work on it is really just starting. Segmented memory can be supported by C itself in a quasi-standard way, because the "Embedded C" technical report has a proviso for "multiple address spaces". Loosely speaking, this means that a "fully general" pointer type, encompassing all possible address spaces, still has to exist; but address-space specific pointers are also made possible.
- pshc 7y agoWould it work to compile rust code to WebAssembly first and translate that to 65C816 opcodes?
- zozbot234 7y agoIt would be quite inefficient. And you'd still need to write a JIT from WASM to the 65C816.
- johnsoft 7y agoAnother possible avenue is mrustc, an alternative Rust compiler which compiles Rust code to C code. Every platform has a C compiler (though maybe not C11, which is what mrustc targets). https://github.com/thepowersgang/mrustc https://github.com/thepowersgang/mrustc