Changeset 6248 for src/Pugs/CodeGen

Show
Ignore:
Timestamp:
08/14/05 17:32:14 (3 years ago)
Author:
autrijus
svk:copy_cache_prev:
8452
Message:

* -CBinary - dump PIL1 tree as opaque GhcBinary? file for fast loading.

Location:
src/Pugs/CodeGen
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/CodeGen/PIL.hs

    r6229 r6248  
    55import Pugs.Internals 
    66import Pugs.AST 
     7import Pugs.PIL1 
    78import Pugs.Compile 
    89 
    910genPIL :: Eval Val 
    1011genPIL = do 
    11     glob        <- askGlobal 
    12     main        <- asks envBody 
    13     globPIL     <- compile glob :: Eval [PIL_Decl] 
    14     mainPIL     <- compile main :: Eval PIL_Stmts 
     12    penv <- compile () 
    1513    return . VStr . unlines $ 
    1614        [ "PIL_Environment" 
    17         , "    { pilMain = (" ++ show mainPIL ++ ")" 
    18         , "    , pilGlob = (" ++ show globPIL ++ ")" 
     15        , "    { pilMain = (" ++ show (pilMain penv) ++ ")" 
     16        , "    , pilGlob = (" ++ show (pilGlob penv) ++ ")" 
    1917        , "    }" 
    2018        ] 
  • src/Pugs/CodeGen/PIR.hs

    r6229 r6248  
    1919import Pugs.Types 
    2020import Pugs.Eval.Var 
     21import Pugs.PIL1 
    2122import Emit.PIR 
    2223import Pugs.Pretty 
     
    338339    local (\env -> env{ envDebug = Nothing }) $ do 
    339340        opEval style "<prelude-pir>" preludeStr 
    340     glob        <- askGlobal 
    341     main        <- asks envBody 
    342     globPIL     <- compile glob 
    343     mainPIL     <- compile main 
    344     globPIR     <- runCodeGenGlob tenv globPIL 
    345     mainPIR     <- runCodeGenMain tenv mainPIL 
     341    penv        <- compile () 
     342    globPIR     <- runCodeGenGlob tenv (pilGlob penv) 
     343    mainPIR     <- runCodeGenMain tenv (pilMain penv) 
    346344    libs        <- liftIO $ getLibs 
    347345    return . VStr . unlines $ 
     
    385383            , InsNew tempPMC PerlScalar 
    386384            , "store_global"    .- [lit "$_", tempPMC] 
    387             ]) ++ [ StmtRaw (text (name ++ "()")) | PSub name@('_':'_':_) _ _ _ <- globPIL] ++ 
     385            ]) ++ [ StmtRaw (text (name ++ "()")) | PSub name@('_':'_':_) _ _ _ <- pilGlob penv ] ++ 
    388386            [ StmtRaw (text "main()") 
    389387            , StmtIns $ tempPMC  <-- "find_global" $ [lit "Perl6::Internals", lit "&exit"] 
  • src/Pugs/CodeGen/Perl5.hs

    r6236 r6248  
    66import Pugs.AST 
    77import Pugs.Compile 
     8import Pugs.PIL1 
    89import DrIFT.Perl5 
    910 
    1011genPerl5 :: Eval Val 
    1112genPerl5 = do 
    12     glob        <- askGlobal 
    13     main        <- asks envBody 
    14     globPIL     <- compile glob :: Eval [PIL_Decl] 
    15     mainPIL     <- compile main :: Eval PIL_Stmts 
     13    penv <- compile () 
    1614    return . VStr . unlines $ 
    1715        [ "bless({" 
    18         , "    pilMain => " ++ showPerl5 mainPIL ++ "," 
    19         , "    pilGlob => " ++ showPerl5 globPIL 
     16        , "    pilMain => " ++ showPerl5 (pilMain penv) ++ "," 
     17        , "    pilGlob => " ++ showPerl5 (pilGlob penv) 
    2018        , "} => 'PIL::Environment')" 
    2119        ] 
  • src/Pugs/CodeGen/XML.hs

    r6239 r6248  
    1111genXML :: Eval Val 
    1212genXML = do 
    13     glob        <- askGlobal 
    14     main        <- asks envBody 
    15     globPIL     <- compile glob :: Eval [PIL_Decl] 
    16     mainPIL     <- compile main :: Eval PIL_Stmts 
    17     return . VStr . showXml $ PIL_Environment globPIL mainPIL 
     13    penv <- compile () :: Eval PIL_Environment 
     14    return $ VStr (showXml penv)