Mill Computing, Inc. Forums The Mill Architecture switches Reply To: switches

Ivan Godard
Keymaster
Post count: 689

Pick phase is after call phase, and you got it right from the doc. For some reason I was thinking of branches, for which the predicate is evaluated in writerPhase, after the pick. Sorry for the brain freeze 🙁

Hence your pick-and-call needs an extra instruction. As for ranges of calls, currently the compiler transforms your example into (in effect):

if (x < 0) return 0;
else if (x < 3) return bar();
else if (x < 6) return baz();
else return 0;

Your pick-based solution is better than this, even with the extra instruction, but it’s unclear that the case is common enough to look for.