Sujet : Re: Making Lemonade (Floating-point format changes)
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.archDate : 10. Jun 2024, 03:46:16
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v45pdn$3n9j$1@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : Pan/0.158 (Avdiivka; )
On Mon, 13 May 2024 21:16:48 +0000, MitchAlsup1 wrote:
Emulation is slow when trap overhead is large and not-slow when trap
overhead is small.
I think it was a particular version of the old Mac OS, from around 1990 or
so, that implemented a really amazing hack. Some 32-bit machines had
hardware floating-point, others didn’t. So developers of numerics-
intensive apps had to build two versions of their code, one with the
floating-point instructions, the other with calls to Apple’s SANE library.
The hack involved running code built to use hardware floating-point
instructions, on hardware that didn’t have them. The instructions were of
course trapped and emulated. But more than that, the system would patch
the instruction that caused the trap, turning it into a direct call into
the emulation routine. So after the first execution, each such instruction
would run much faster. Until the code got unloaded from RAM and the patch
was lost, of course.