X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fcmm%2FCmmParse.y;h=7ad1dd55a74ff41d064354451971c5e4d2417c4c;hp=c3a37b2f23603fd8ad79da74f42a04b978c2debf;hb=b017f34bebf1588e5e579d7c653413e2a4c2d170;hpb=a02e7f40afc1aab7fe466f949f505c1d7250713d diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y index c3a37b2..7ad1dd5 100644 --- a/compiler/cmm/CmmParse.y +++ b/compiler/cmm/CmmParse.y @@ -214,7 +214,7 @@ static :: { ExtFCode [CmmStatic] } | 'CLOSURE' '(' NAME lits ')' { do lits <- sequence $4; return $ map CmmStaticLit $ - mkStaticClosure (mkForeignLabel $3 Nothing True IsData) + mkStaticClosure (mkForeignLabel $3 Nothing ForeignLabelInExternalPackage IsData) -- mkForeignLabel because these are only used -- for CHARLIKE and INTLIKE closures in the RTS. dontCareCCS (map getLit lits) [] [] [] } @@ -346,14 +346,21 @@ decl :: { ExtCode } -- an imported function name, with optional packageId importNames - :: { [(Maybe PackageId, FastString)] } + :: { [(FastString, CLabel)] } : importName { [$1] } | importName ',' importNames { $1 : $3 } importName - :: { (Maybe PackageId, FastString) } - : NAME { (Nothing, $1) } - | STRING NAME { (Just (fsToPackageId (mkFastString $1)), $2) } + :: { (FastString, CLabel) } + + -- A label imported without an explicit packageId. + -- These are taken to come frome some foreign, unnamed package. + : NAME + { ($1, mkForeignLabel $1 Nothing ForeignLabelInExternalPackage IsFunction) } + + -- A label imported with an explicit packageId. + | STRING NAME + { ($2, mkCmmCodeLabel (fsToPackageId (mkFastString $1)) $2) } names :: { [FastString] } @@ -1025,8 +1032,8 @@ parseCmmFile dflags filename = do showPass dflags "ParseCmm" buf <- hGetStringBuffer filename let - init_loc = mkSrcLoc (mkFastString filename) 1 0 - init_state = (mkPState buf init_loc dflags) { lex_state = [0] } + init_loc = mkSrcLoc (mkFastString filename) 1 1 + init_state = (mkPState dflags buf init_loc) { lex_state = [0] } -- reset the lex_state: the Lexer monad leaves some stuff -- in there we don't want. case unP cmmParse init_state of