Commit 5f37e0c7 authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghc

parents 14ddde0e 412af8c2
...@@ -464,8 +464,8 @@ conflicts dflags (r, rhs, addr) node ...@@ -464,8 +464,8 @@ conflicts dflags (r, rhs, addr) node
-- foreign call. See Note [foreign calls clobber GlobalRegs]. -- foreign call. See Note [foreign calls clobber GlobalRegs].
| CmmUnsafeForeignCall{} <- node, anyCallerSavesRegs dflags rhs = True | CmmUnsafeForeignCall{} <- node, anyCallerSavesRegs dflags rhs = True
-- (5) foreign calls clobber memory, but not heap/stack memory -- (5) foreign calls clobber heap: see Note [foreign calls clobber heap]
| CmmUnsafeForeignCall{} <- node, AnyMem <- addr = True | CmmUnsafeForeignCall{} <- node, memConflicts addr AnyMem = True
-- (6) native calls clobber any memory -- (6) native calls clobber any memory
| CmmCall{} <- node, memConflicts addr AnyMem = True | CmmCall{} <- node, memConflicts addr AnyMem = True
...@@ -523,6 +523,21 @@ data AbsMem ...@@ -523,6 +523,21 @@ data AbsMem
-- that was written in the same basic block. To take advantage of -- that was written in the same basic block. To take advantage of
-- non-aliasing of heap memory we will have to be more clever. -- non-aliasing of heap memory we will have to be more clever.
-- Note [foreign calls clobber]
--
-- It is tempting to say that foreign calls clobber only
-- non-heap/stack memory, but unfortunately we break this invariant in
-- the RTS. For example, in stg_catch_retry_frame we call
-- stmCommitNestedTransaction() which modifies the contents of the
-- TRec it is passed (this actually caused incorrect code to be
-- generated).
--
-- Since the invariant is true for the majority of foreign calls,
-- perhaps we ought to have a special annotation for calls that can
-- modify heap/stack memory. For now we just use the conservative
-- definition here.
bothMems :: AbsMem -> AbsMem -> AbsMem bothMems :: AbsMem -> AbsMem -> AbsMem
bothMems NoMem x = x bothMems NoMem x = x
bothMems x NoMem = x bothMems x NoMem = x
......
...@@ -2777,7 +2777,7 @@ findRetryFrameHelper (Capability *cap, StgTSO *tso) ...@@ -2777,7 +2777,7 @@ findRetryFrameHelper (Capability *cap, StgTSO *tso)
case CATCH_RETRY_FRAME: case CATCH_RETRY_FRAME:
debugTrace(DEBUG_stm, debugTrace(DEBUG_stm,
"found CATCH_RETRY_FRAME at %p during retrry", p); "found CATCH_RETRY_FRAME at %p during retry", p);
tso->stackobj->sp = p; tso->stackobj->sp = p;
return CATCH_RETRY_FRAME; return CATCH_RETRY_FRAME;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment