Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
  • 6 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
View
12 compiler/Lambdachine/Options.hs
@@ -10,7 +10,8 @@ data Options = Options
{ inputFile :: FilePath
, package_name :: String
, dumpCoreBinds :: Bool
- , dumpBytecode :: Bool }
+ , dumpBytecode :: Bool
+ , optLevel :: Int }
deriving (Show, Data, Typeable)
options = Options
@@ -19,9 +20,14 @@ options = Options
, dumpCoreBinds = def &= explicit &= name "dump-core-binds"
&= help "Dump GHC's Core."
, dumpBytecode = def &= explicit &= name "dump-bytecode"
- &= help "Dump generated bytecode" }
+ &= help "Dump generated bytecode"
+ , optLevel = def &= opt (0 :: Int) }
&= summary "The Lambdachine Compiler, v0.1"
&= program "lc"
getOptions :: IO Options
-getOptions = cmdArgs options
+getOptions = do
+ opts <- cmdArgs options
+ let level = max 0 (min 2 (optLevel opts))
+ return opts{ optLevel = level }
+
View
3  compiler/Main.hs
@@ -34,7 +34,8 @@ main = do
opts <- Cli.getOptions
runGhc (Just libdir) $ do
dflags0 <- getSessionDynFlags
- let dflags1 = dflags0{ ghcLink = NoLink }
+ let dflags1 = dflags0{ ghcLink = NoLink
+ , optLevel = Cli.optLevel opts }
dflags2 | Cli.package_name opts /= ""
= setPackageName (Cli.package_name opts) dflags1
| otherwise = dflags1
View
7 tests/Bench/SumSquare1.hs
@@ -2,6 +2,7 @@
-- RUN: %bc_vm_chk
-- CHECK: @Result@ IND -> GHC.Bool.True`con_info
module Bench.SumSquare1 where
+--import Prelude ( print )
import GHC.Prim
import GHC.List
@@ -16,7 +17,7 @@ enumFromTo'Int from@(I# m) to@(I# n) =
sum :: [Int] -> Int
sum l = sum_aux (I# 0#) l
-{-# NOINLINE sum_aux #-}
+{- # NOINLINE sum_aux #-}
sum_aux :: Int -> [Int] -> Int
sum_aux !acc [] = acc
sum_aux !(I# a) (I# x:xs) = sum_aux (I# (a +# x)) xs
@@ -28,3 +29,7 @@ root x = sum [ I# (a# *# b#)
, I# b# <- enumFromTo'Int a x ]
test = root 20 == 23485
+
+test2 = root 11000 == 1830679628709250
+
+--main = print test2
View
6 vm/assembler.cc
@@ -856,9 +856,11 @@ void Assembler::assemble(IRBuffer *buf, MachineCode *mcode) {
TraceId thisTraceId = Jit::fragments_.size();
if (stopins_ != REF_FIRST) {
buf->setRegsAllocated();
- buf->debugPrint(cerr, thisTraceId);
+ if (DEBUG_COMPONENTS & DEBUG_ASSEMBLER)
+ buf->debugPrint(cerr, thisTraceId);
if (!mergeWithParent()) {
- exit(3);
+ cerr << "NYI: merge with parent failed\n";
+ exit(EXIT_FAILURE);
}
}
View
6 vm/ir_fold.cc
@@ -369,8 +369,10 @@ TRef IRBuffer::optFold() {
return TRef(ref, ir(ref)->t());
if (ref == KLITFOLD)
return literal(fold_.ins.type(), fold_.literal);
- if (ref == FAILFOLD)
- exit(44);
+ if (ref == FAILFOLD) {
+ cerr << "NYI: Recover from FAILFOLD\n";
+ exit(EXIT_FAILURE);
+ }
LC_ASSERT(ref == DROPFOLD);
return TRef();
}
View
11 vm/jit.cc
@@ -169,8 +169,10 @@ void Jit::beginSideTrace(Capability *cap, Word *base, Fragment *parent, SnapNo s
replaySnapshot(parent, snapno, base);
- buf_.debugPrint(cerr, 0);
- buf_.slots_.debugPrint(cerr);
+ if (DEBUG_COMPONENTS & DEBUG_ASSEMBLER) {
+ buf_.debugPrint(cerr, ~0);
+ buf_.slots_.debugPrint(cerr);
+ }
// exit(1);
}
@@ -544,7 +546,7 @@ bool Jit::recordIns(BcIns *ins, Word *base, const Code *code) {
case BcIns::kMOV_RES: {
if (!(IRRef)lastResult_) {
- cerr << "NYI: MOV_RES with out-of trace input." << endl;
+ DBG(cerr << "NYI: MOV_RES with out-of trace input." << endl);
goto abort_recording;
}
buf_.setSlot(ins->a(), lastResult_);
@@ -683,7 +685,6 @@ bool Jit::recordIns(BcIns *ins, Word *base, const Code *code) {
<< parent->traceId() << ") found." COL_RESET "\n";
buf_.emit(IR::kSAVE, IRT_VOID | IRT_GUARD, IR_SAVE_LINK,
parent->traceId());
- buf_.debugPrint(cerr, 1);
finishRecording();
return true;
exit(7);
@@ -730,7 +731,7 @@ void Jit::finishRecording() {
DBG(cerr << "Recorded: " << endl);
asm_.assemble(buffer(), mcode());
if (DEBUG_COMPONENTS & DEBUG_ASSEMBLER)
- buf_.debugPrint(cerr, 1);
+ buf_.debugPrint(cerr, Jit::numFragments());
int tno = fragments_.size();

No commit comments for this range

Something went wrong with that request. Please try again.