This is something the CHERI architecture[0] (an extension to ARM and RISC-V that implements a capability memory model) can allow this performantly with compiled code (without needing to context switch). This PhD dissertation from Cambridge[1] implements this for C/C++ under CheriBSD (their fork of FreeBSD that supports CHERI).
illumos on RISC-V with CHERI would be the ultimate. There is another variant of RISC-V that is spectre immune. I have also recently heard of approaches at compile-time, such as RESPECTRE, that remove the spectre problem.
[0]: https://www.cl.cam.ac.uk/research/security/ctsrd/cheri/
[1]: https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-949.pdf