
On 20/01/2016, at 12:03 pm, Henning Thielemann
I am not thinking about a radically different machine language, just a common imperative machine language with some added instructions for tasks often found in machine code generated from Haskell. E.g. mainstream processors support C function calls with special jump instruction and stack handling. Maybe there could be instructions that assist handling thunks or Haskell function calls.
I was at a presentation once where the speaker showed how (thanks to the fact that Prolog doesn't evaluate arguments in calls) calling a procedure and executing the procedure could be overlapped, getting a factor of 2 speedup for an important part of the code. At another presentation a speaker showed how using a special outboard coprocessor could dramatically speed up memory management. I suspect that neither technique would be much help on today's machines and for Haskell. However, there is a hint here that doing something quite different might pay off. For example, if branch predictors don't do well with thunk handling, maybe there is a way of processing thunks that a quite different kind of branch predictor *might* cope with. Or maybe something that's expecting to process thousands of microthreads might not care about branch prediction. (Although that idea has been tried as a way of handling memory latency, I don't think it's been tried for Haskell.) Perhaps you might look for something different; instead of 'faster on similar hardware' you might look at 'cheaper'. Could a specialised Haskell processor use less energy than a standard CPU? Don't quit your day job, but don't be too sure there's nothing left to think of either.