Fix a really nasty bug in SMP
authorSimon Marlow <simonmar@microsoft.com>
Tue, 14 Mar 2006 11:21:19 +0000 (11:21 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Tue, 14 Mar 2006 11:21:19 +0000 (11:21 +0000)
commita9dc96582699e24c7d67eec9e4296b80dee53e92
tree38001cea901a489c7b9599ba3e952a60df975d7d
parent2f861d149686a96d7783ce984afa7c263a39c355
Fix a really nasty bug in SMP
In SMP mode a THUNK can change to an IND at any time.  The generic
apply code (stg_ap_p etc.) examines a closure to determine how to
apply it to its arguments, if it is a THUNK it must enter it first in
order to evaluate it.  The problem was that in order to enter the
THUNK, we were re-reading the info pointer, and possibly ending up
with an IND instead of the original THUNK.  It isn't safe to enter the
IND, because it points to a function (functions are never "entered",
only applied).  Solution: we must not re-read the info pointer.
ghc/compiler/cmm/CmmParse.y
ghc/utils/genapply/GenApply.hs