De-kludge and strength-reduce scavenge_interrupt_context()
commite4657a5f3785bb71434cbe8c5360433afd367db7
authorAlastair Bridgewater <alastair.bridgewater@gmail.com>
Sat, 15 Apr 2017 15:36:56 +0000 (15 11:36 -0400)
committerAlastair Bridgewater <alastair.bridgewater@gmail.com>
Sun, 16 Apr 2017 01:49:58 +0000 (15 21:49 -0400)
treea5df1ce5d03559da65dc412a80302648d17397b0
parentff39cbeb8631185ec62f57463b789385371df89e
De-kludge and strength-reduce scavenge_interrupt_context()

  * As pointed out by Douglas Katzman, and noticed independently I
don't know how many times, there is (was) an apparent duplication
of calls to scavenge() from scavenge_interrupt_context(), done in
two completely different styles, but apparently having identical
overall semantics.

  * These turn out to date back to July 5, 1994, in a CMUCL commit
(cdac17ab363c2c782c0873fde65ce269527574ef in CMUCL git) with
comment "Updated for the sgi.", which added the version that used
a temporary variable, but left the original version (which called
scavenge() directly with a cast context register pointer) in place.

  * The semantic difference is that some systems have context
registers that are wider than our heap words and are big-endian,
and on those systems casting a pointer to a narrower target type
picks up on the high-order bits of the target data instead of the
low-order bits, thus ending up scavenging the upper part of the
registers instead of the lower part.

  * Removed the "old" call to scavenge(), introduced a temporary
variable to hold a pointer to the context register instead of
calling os_context_register_addr() twice, renamed the temporary
variable that holds the datum being scavenged, folded out the
"index" variable once it had only a single use, and added
commentary describing the situation.

  * Also added commentary about possible losses due to sign
extension or the lack of it.  Investigating and possibly fixing
issues related to this is not something that I wish to get into at
this point, and the overall behavior hasn't changed so it's not a
regression if there is breakage here.

  * Tested by Douglas Katzman on PPC.
src/runtime/gc-common.c