Hi all, another few months, and something funny happened this morning: a tweet shows up in my timeline which links to this article on efficient codegen for dispatch with switch statements: <http://www.cipht.net/2017/10/03/are-jump-tables-always-fastest.html> Very interesting!
Why I'm resurrecting this thread is the reference to Arthur Sale's 1981 paper "The Implementation of Case Statements in Pascal". He compares linear lists, jumptables, binary search and masksearch (on B6700 machines). The bit on jumptables (journal-page 933) contains this part: """The jump-table itself consists of half-word (3 bytes) unconditional branches, and must be half-word synchronized. The range-check and indexed branch add up to 23 bytes of instructions on the assumption that the range limit values are fitted into 8-bit literals, and there is a 0-2 byte padding required to achieve jump-table synchronization. *The range check is never omitted as the consequences of a wild branch which lands outside the jump-table are potentially disastrous.* If the range is r, the space requirements are therefore [...]""" "potentially disastrous" probably didn't mean security as much as "my room-sized mainframe crashes", but the point stands... -- Martok _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel