[GHC] #6084: Add stg_ap_pnnv and related call patterns
GHC
ghc-devs at haskell.org
Sat Oct 26 12:54:36 UTC 2013
#6084: Add stg_ap_pnnv and related call patterns
-------------------------------------+------------------------------------
Reporter: SimonMeier | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: 7.8.1
Component: Runtime System | Version: 7.4.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: 8313 | Related Tickets:
-------------------------------------+------------------------------------
Changes (by int-e):
* status: closed => new
* resolution: fixed =>
Comment:
This needs more work--currently the stage 2 compiler crashes occasionally.
The obvious problem is that the new fast path in the code generated by
{{{StgCmmLayout.slowCall}}} does not untag the pointer to the closure
(this affects the arity test as well which makes it hard to trigger). I
tried to fix this as follows:
{{{
--- a/compiler/codeGen/StgCmmLayout.hs
+++ b/compiler/codeGen/StgCmmLayout.hs
@@ -192,9 +192,12 @@ slowCall fun stg_args
let n_args = length stg_args
if n_args > arity && optLevel dflags >= 2
then do
+ funv <- (CmmReg . CmmLocal) `fmap` assignTemp fun
+ let untaggedFunv = cmmOffset dflags funv (-1) -- is the tag
always 1?
+
fast_code <- getCode $
emitCall (NativeNodeCall, NativeReturn)
- (entryCode dflags (closureInfoPtr dflags fun))
+ (entryCode dflags (closureInfoPtr dflags untaggedFunv))
(nonVArgs ((P,Just fun):argsreps))
slow_lbl <- newLabelC
@@ -202,10 +205,9 @@ slowCall fun stg_args
is_tagged_lbl <- newLabelC
end_lbl <- newLabelC
- funv <- (CmmReg . CmmLocal) `fmap` assignTemp fun
-
- let correct_arity = cmmEqWord dflags (funInfoArity dflags
funv)
- (mkIntExpr dflags
n_args)
+ let correct_arity = cmmEqWord dflags
+ (funInfoArity dflags untaggedFunv)
+ (mkIntExpr dflags n_args)
pprTrace "fast call" (int n_args) $ return ()
}}}
But now I get
{{{
ghc-stage2: internal error: PAP object entered!
}}}
and indeed PAPs are treated specially in the {{{stg_ap_*}}} functions, and
the fast path does not mirror that special treatment.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/6084#comment:19>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list