Changeset 4876
- Timestamp:
- 06/20/05 19:23:02 (4 years ago)
- svk:copy_cache_prev:
- 6641
- Location:
- src
- Files:
-
- 2 modified
-
Emit/PIR.hs (modified) (6 diffs)
-
Pugs/Compile/PIR.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Emit/PIR.hs
r4874 r4876 521 521 parrotBrokenXXX = True 522 522 523 -- calls and place result in tempPMC524 callBlock :: VarName -> Expression -> [Ins]525 callBlock label fun =526 [ "newsub" .- [funPMC, bare ".Continuation", bare label]527 ] ++ callBlockCC fun ++ collectCC label528 529 523 collectCC :: LabelName -> [Ins] 530 524 collectCC label = … … 535 529 ] 536 530 537 call BlockCC :: Expression -> [Ins]538 call BlockCC fun | parrotBrokenXXX =531 callThunkCC :: Expression -> [Ins] 532 callThunkCC fun | parrotBrokenXXX = 539 533 [ tempINT <-- "get_addr" $ [fun] 540 534 , tempSTR <:= tempINT … … 542 536 , "invoke" .- [fun] 543 537 ] 544 call BlockCC fun =538 callThunkCC fun = 545 539 [ "set_args" .- sigList [funPMC] 546 540 , "invoke" .- [fun] … … 554 548 [ "newsub" .- [funPMC, bare ".Continuation", bare postL] 555 549 , comp .- [arg0, bare altL] 556 ] ++ call BlockCC arg1 ++550 ] ++ callThunkCC arg1 ++ 557 551 [ InsLabel altL 558 ] ++ call BlockCC arg2 ++ collectCC postL) --> [tempPMC]552 ] ++ callThunkCC arg2 ++ collectCC postL) --> [tempPMC] 559 553 where 560 554 altL = ("sc_" ++ name ++ "_alt") … … 572 566 , "returncc" .- [] 573 567 , InsLabel altL 574 ] ++ call BlockCC arg1 ++ collectCC postL) --> [tempPMC]568 ] ++ callThunkCC arg1 ++ collectCC postL) --> [tempPMC] 575 569 where 576 570 altL = ("sc_" ++ escaped name ++ "_alt") … … 612 606 , sub "&statement_control:loop" [arg0, arg1, arg2, arg3] $ 613 607 [ InsLabel "sc_loop_next" 614 ] ++ callBlock "loopCond" arg1 ++ 615 [ "unless" .- [tempPMC, bare "sc_loop_last"] 616 ] ++ callBlock "loopBody" arg2 ++ 617 [ -- ..throw away the result of body... 618 ] ++ callBlock "loopPost" arg3 ++ 619 [ "goto" .- [bare "sc_loop_next"] 608 , [reg tempPMC] <-& arg1 $ [] 609 , "unless" .- [tempPMC, bare "sc_loop_last"] 610 , [] <-& arg2 $ [] -- throw away the result of body... 611 , [] <-& arg3 $ [] -- ...and the post-condition 612 , "goto" .- [bare "sc_loop_next"] 620 613 , InsLabel "sc_loop_last" 621 614 , "returncc" .- [] -
src/Pugs/Compile/PIR.hs
r4875 r4876 335 335 compile (Cxt cxt rest) = enter cxt $ compile rest 336 336 compile (Var name) = return . PExp $ PVar name 337 compile exp@(Val (VCode _)) = compile (Syn "sub" [exp]) 337 338 compile (Val val) = fmap PLit (compile val) 338 339 compile Noop = compile (Val undef) … … 436 437 trans (PApp _ exp@(PBlock _) []) = do 437 438 blockC <- trans exp 438 [appC] <- genLabel ["invokeBlock"] 439 tell $ map StmtIns $ callBlock appC blockC 439 tellIns $ [reg tempPMC] <-& blockC $ [] 440 440 return tempPMC 441 441 trans (PApp (TCxtLValue _) (PExp (PVar "&postcircumfix:[]")) [(PExp lhs), rhs]) = do
