David Chisnall's CPU Feature Wishlist
- Polymorphic Instructions and Typed Memory
- User Mode Traps
- Hardware Sparse Arrays
- Mondrian Memory Protection
- Message Passing Primitives
The current generation of CPUs are all designed with ALGOL-family languages in mind. With the current transition from x86 to ARM (which already has instruction-set extensions for Java) in a lot of places, it seems like a good time to list a few features I'd like to see added to a modern architecture for better supporting dynamic languages.
The big difference between a typical ALGOL-family language, such as C, and a classical RISC instruction set is that the ALGOL-family language supports subroutines (also called procedures or, misleadingly, functions). Rather than joining bits of the program with a series of conditional jumps, component parts of the program are in semi-isolated components that return control to the last point of execution when they finish. CPUs often include a CALL instruction that encapsulates this behavior.
Dynamic languages have a layer of indirection in the way. On every sub-program invocation (message send or method call), a function is run to determine which subroutine should be executed. This is the main cause of dynamic language programs being slow. The other is related to the type systems used in these languages.
Polymorphic Instructions and Typed Memory